FastBuy is a web application where users can sign up and log in with their email addresses and passwords. The platform allows users to add products for sale or rent at user-specified rates. Rental rates can be hourly, monthly, or daily. Additionally, users can view all their own products on the user top page after being authenticated. Users can delete their own products also.
- Users can buy a product
- Users can rent a product
- Users can see the history of their sold, bought, borrowed, and lent products
- Next.js (Version 15 - App Router framework of React)
- Apollo Client with In-Memory Cache for GraphQL data fetching and mutation
- Node.js
- Express.js server with middleware
- Apollo Server for GraphQL
- PostgreSQL database
- Prisma ORM
- Node.js
- Navigate to the root folder and open a terminal.
- Run
cd serverto move into the server directory. - Run
npm installto install dependencies. - Run
npm startto start the server. - The Apollo server will be available at
http://localhost:4000/graphql.
- Navigate to the root folder and open a terminal.
- Run
npm run devto start the client. - The client will be available at
http://localhost:3000.
- Install Docker Desktop
- Ensure Docker is running
-
Create a
.envfile inside theserverdirectory and set two varibalesDATABASE_URL=postgresql://postgres:postgres@postgres_db:5432/demodb?schema=public JWT_SECRET=6cc98c44c5298080d11a0cae3you can also generate a jwt secret from: https://jwtsecret.com/generate
-
Open terminal and navigate to the Project Directory
cd fastbuy -
Build and Start the Containers
docker-compose up --build
- This command will:
- Build the Docker images for both the client and server.
- Start the containers.
- This command will:
-
Access the Application
- Backend (API Server):
http://localhost:4000 - Frontend (Client App):
http://localhost:3000
- Backend (API Server):
-
Stopping the Containers To stop the running containers, press
CTRL + C, or run:docker-compose down
If you face this prisma related issue (e.g. The table public.User does not exist in the current database) during sign up or login, open terminal and go to server directory. Then run the command below:
docker-compose exec server npx prisma migrate devmake sure your docker container is running before you run this command.
Contributions are welcome! If you find any issues or want to improve the project, feel free to create a pull request. 🚀