Skip to content

Example project showcasing NextJS (Server Actions), Tailwind CSS, Prisma, PostgreSQL, Docker Compose, and Jest.

Notifications You must be signed in to change notification settings

zthh626/novel-nook

Repository files navigation

NovelNook

Screenshots

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

Technologies in this Project

Frontend

  • NextJS
  • Tailwind CSS

Backend

  • NextJS, Server Actions
  • Prisma
  • Postgres

Tooling

  • Docker Compose
  • Jest

App Layout

This app has the following routes:

  • /
  • /auth
    • /auth/login
    • /auth/signup
  • /authors
    • /authors/[id]
  • /books
    • /books/[id]
  • /favorites

More details here

Setup and Running Instructions

Docker compose for containerization and easy project setup.

  1. Clone the repository:
git clone https://github.com/zthh626/novel-nook.git
cd novel-nook
  1. 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.

  1. Install node modules with npm install

  2. Run the application with docker-compose:

docker-compose up
  1. Migrate the database with npx prisma db push

  2. 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.

  1. Access the application at http://localhost:3000/

Testing

Currently, only unit tests for auth

  1. Run npm run test

Database

The database schema has the following 4 tables:

  • Users
  • Favorites
  • Books
  • Authors

For a deeper explanation view database.md.

Design Decisions

design-decisions.md

Authentication

authentication.md

lib functions

/src/lib

TODO

  • Misnamed favourites in database schema but everything else is called favorites.
  • SearchInput has quick search half implemented, the feature will have a short list of search results as the user typed.

About

Example project showcasing NextJS (Server Actions), Tailwind CSS, Prisma, PostgreSQL, Docker Compose, and Jest.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published