- Ability for users to sign up and log in.
- Ability to add products to a cart.
- Ability to remove products from a cart.
- Ability to view and search for products.
- Ability for users to checkout and pay for products.
- Admin panel to add products, set the prices and manage inventory
- Use asaas as payments gateway
- Use Next.js for build the frontend
- Use server-client architecture
- Use mongodb as database
- Use NodeJS and NestJS for backend
- Users
- Products
- Carts
- Orders
- login user (public)
- signup user (public)
- create product (admin)
- delete product (admin)
- update product (admin)
- list products (client)
- search products (client)
- add products to cart (client)
- clear cart (client)
- remove product of cart (client)
- find current user cart (client)
- create order (client)
- cancel order (client)
- list current user orders (client)
- pay order (client)
- list orders (admin)
- search orders (admin)
- docker and docker compose
Create a file called .env on project's root folder, and put something like this inside:
# Database
DB_HOST=localhost
DB_NAME=ecommerce
DB_USER=admin
DB_PASSWORD=admin
DB_PORT=27017
# Server
SERVER_URL=http://localhost:8080
SERVER_SECRET=your secret key
# Gateways
PAYMENT_GW_URL=https://sandbox.asaas.com/api/v3
PAYMENT_GW_KEY=your asaas key
Tu run in production mode just go to the project's root folder and run:
docker compose up -d
docker compose -f docker-compose.dev.yml up -d
This will start the api on http://localhost:8080 and the database at the specified port on .env.
The database is empty, and you have to create a user with ADMIN role in the database for creating new products.
You can access the postman documentation on /docs/ecommerce-api.postman_collection.json on root folder.
- POST /auth/signup
- POST /auth/login
- POST /products
- PUT /products
- GET /products
- DELETE /products/:productId
- GET /carts/my-cart
- DELETE /carts/my-cart
- POST /carts/my-cart/products/:productId?quantity=1
- DELETE /carts/my-cart/products/:productId?quantity=1
- GET /orders
- GET /orders/my-orders
- POST /orders/my-orders
- DELETE /orders/my-orders/:orderId
- POST /payments/credit/orders/:orderId