This is an online bookstore application with the following features:
- Browsing books
- Searching books by
- title
- description
- View book details
- Browing authors
- Searching authors by
- name
- bio
- Login/Signup
- Favoriting books
- Managing favorites
- NextJS
- Tailwind CSS
- NextJS, Server Actions
- Prisma
- Postgres
- Docker Compose
- Jest
This app has the following routes:
- /
- /auth
- /auth/login
- /auth/signup
- /authors
- /authors/[id]
- /books
- /books/[id]
- /favorites
Docker compose for containerization and easy project setup.
- Clone the repository:
git clone https://github.com/zthh626/novel-nook.git
cd novel-nook
- Setup environment variables:
Modify the .env
file in the root directory. SECRET_KEY
is the key used for signing the JWT key change this to some secret key for security purposes. DATABASE_URL
is pointed to the docker-compose PostgreSQL instance.
-
Install node modules with
npm install
-
Run the application with docker-compose:
docker-compose up
-
Migrate the database with
npx prisma db push
-
Seed the database with
npx prisma db seed
This command uses the DATABASE_URL
in the .env
file. The mock data for this seed is located at authors.json and books.json.
- Access the application at
http://localhost:3000/
Currently, only unit tests for auth
- Run
npm run test
The database schema has the following 4 tables:
- Users
- Favorites
- Books
- Authors
For a deeper explanation view database.md.
- Misnamed
favourites
in database schema but everything else is calledfavorites
. SearchInput
has quick search half implemented, the feature will have a short list of search results as the user typed.