Welcome to BookShelfX! This full-stack web application replicates the functionality of a local library, allowing librarians to manage books and customers to borrow them. The application supports user authentication, book checkout, customer reviews, and more. ofcourse powered by AI
- Node.js
- npm
- Next.js
- PostgreSQL, pgadmin4 {optional} - do checkout https://www.youtube.com/watch?v=PShGF_udSpk for setting postgresSQl.
This application has requirement for .env and .env.local files to run the application locally while I cannot share my files here due to privacy issues, would share a format of how does the file shoudl look like so you can set it up for your requirement, also will leave few tutorial links next to them for your reference to set them up.
.env file:
DATABASE_URL="postgres://username:password@host:port/dbname"
GOOGLE_BOOKS_API_KEY="<INSERT YOU GOOGLEBOOKS API KEY HERE>" #Resource: https://developers.google.com/books/docs/v1/using
-How to get database URl ?????? - In PostgresSQl create a database called bookShelfX and the formulate a url that would look like
postgres Url format postgres://username:password@host:port/dbname
#-------------------------------------------------------------------
# - **`postgresql://`**: This specifies the protocol and the type of database you're connecting to, which in this case is PostgreSQL.
# - **`username`**: This is the username used to connect to the database.
# - **`password`**: This is the password for the 'username' user.
# - **`host`**: This indicates that the database server is running on the local machine.
# - **`port`**: This is the port number on which the PostgreSQL server is listening for connections. The default port for PostgreSQL is 5432.
# - **`bookShelfX`**: This is the name of the database you want to connect to.
# So, this URL connects to a PostgreSQL database named `bookShelfX` running on your local machine, using the `username` user with the password.
- Input this URL in the .env File to use it
.env.local file:
OPENAI_API_KEY='<INSERT OPENAI API KEY HERE>' #Resource : https://platform.openai.com/docs/api-reference/introduction
RESEND_API='<INSERT RESEND API KEY HERE>' #Resource : https://resend.com/docs/api-reference/introduction
- Root into ./bookshelfx_technicalassesment in your terminal
cd ./bookshelfx_technicalassesment
- Now in Terminal put the below commands in the same sequence as given
npm i npx prisma migrate dev
- Once the migration of the database schema is done, use the following command to seed the database
npx prisma db seed
- Once the database seeding is finished, checkout the /prisma/userData.txt for mock username and passwords with the specific role of the account for testing the application
- Now run the NextJS app using command
npm run dev
- Open your browser and navigate to
http://localhost:3000
.
This application is also deployed using Vercel. You can access the live version here.
- Frontend: Next.js, TypeScript, MUI (Material-UI)
- Backend: Next.js
- Database: PostgreSQL [Local and Serverless over vercel]
- ORM: Prisma
- Deployment: Vercel
-
Use Typescript
-
Use a single-page application framework/library (NextJs)
i. Users
- Users should be able to sign up, log in, and log out.
- During sign-up, allow the user to specify if they are a Librarian or a Customer.
ii. Featured Books
- Display a list of random books that includes the Title, Author, Description, Cover Image, and Average User Rating of each book.
- Users can filter and sort books by Title, Author, and Availability.
iii. View Book Details
- When a user selects a book, they should view the book's complete details including new fields such as Publisher, Publication Date, Category, ISBN, Page Count, and Customer Reviews.
iv. Search For Books
- Implement a search functionality that allows users to search for books by text that is partially contained in the book’s title.
v. Manage Books
- A librarian can add a new book, edit an existing book, or remove a book from the library.
vi. Book Checkout
- A customer can check out a book if it is available
- A book is checked out for 5 days
- There is only one copy of each book in this library
- Only a librarian can mark a book as returned to the library
vii. Customer Reviews
- A customer can leave a review for a book that consists of a short message and a rating from 1-5 stars.
- The API should have controllers and routes that support all functionality needed for the application
- Support authentication and authorization
- Use an ORM with code-first database migrations
- The database should be created and migrations applied
- The database should be seeded with Books
- Ensure the Book table includes,
- Title, Author, Description, Cover Image, Publisher, Publication Date, Category, ISBN, Page Count
- Add the ability for a Librarian to view all checked-out books and their due dates
- Use a component library
- Add a unit test for the API
- Create a database diagram
- Implement a feature using WebSockets
Working on this project has been a rewarding experience. It provided an opportunity to integrate various technologies and create a functional, user-friendly application. The process of building both the frontend and backend, ensuring seamless interaction between them, and deploying the application has been both challenging and fulfilling.
Thank you for checking out BookShelfX! Feel free to contribute or provide feedback.