Welcome to Tipicos Delivery.
- PostgreSQL
- Docker
- Node.js (v16 or higher)
- NestJS
- Prisma
- Typescript
- Jest (for testing)
- Prettier & ESLint (for code formatting)
- Swagger (for API documentation)
- Github repository: https://github.com/jramaya/Ravn-Challenge-V2-EdgarAmaya
-
Clone the repository
git clone https://github.com/jramaya/Ravn-Challenge-V2-EdgarAmaya.git cd Ravn-Challenge-V2-EdgarAmaya
-
Install dependencies
Using npm:
npm install
Using yarn:
yarn install
-
Set up the PostgreSQL database with Docker
The project uses Docker to run PostgreSQL. Use the provided
docker-compose.db.yml
file to spin up the database.docker-compose -f docker-compose.db.yml up -d
-
Create the
.env
fileCopy the
.env.example
file and rename it to.env
.cp .env.example .env
Update the variables in the
.env
file according to your PostgreSQL setup:POSTGRES_USER=<your_postgres_user> POSTGRES_PASSWORD=<your_postgres_password> POSTGRES_DB=<your_database_name> DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?schema=public
-
Run Prisma migrations
To set up the database schema, run the Prisma migrations:
npx prisma migrate dev
Alternatively, if you want to customize the migration SQL file:
npx prisma migrate dev --create-only
-
Generate Prisma Client
After running the migration, generate the Prisma Client for database interaction:
npx prisma generate
-
Seed the database
Run the seeding script to populate the database with some initial data:
npm run seed
-
Start the NestJS server
For development mode with hot reload:
npm run start:dev
For production mode:
npm run start:prod
For debugging with VSCode:
npm run start:debug
-
Access the API
The REST API documentation is available via Swagger at:
http://localhost:3000/api
GraphQL Playground can be accessed at:
http://localhost:3000/graphql
- Authentication Endpoints
- Signup
- Signin
- Signout (by deleting jwt on client)
- Product Management
- List products with pagination
- Search products by category
- Add, update, delete, and disable products (for managers)
- User Roles
- Manager: Full control over products, view client orders
- Client: Browse products, see details, buy products
- Testing
- Unit tests with Jest (aiming for 80% coverage)
- Linting
- Use
npm run lint
- Use
- Finish implementing CRUD for Cart and Order
- like products
- Implement extra features for bonus points, including:
- E2E testing
- Forgot password functionality
- Email notifications for product stock
- Deployment on Heroku
- Authentication endpoints (sign up, sign in, sign out)
- List products with pagination
- Search products by category
- Manager role functionality (create, update, delete, disable products, view orders)
- Client role functionality (view products, product details, like products, buy products)
- Cart functionality (CRUD operations for cart)
- Order functionality (CRUD operations for orders)
- Email notifications
- Swagger documentation
- Unit tests
- Extra features (e2e testing, stock notifications, password reset)
- Deploy to Heroku
This project uses the template from nestjs-prisma-starter for initial setup.