Skip to content

jramaya/nest-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tipicos Delivery - Ravn Challenge V2

Welcome to Tipicos Delivery.

Getting Started

Requirements

Setting up the project

  1. Clone the repository

    git clone https://github.com/jramaya/Ravn-Challenge-V2-EdgarAmaya.git
    cd Ravn-Challenge-V2-EdgarAmaya
  1. Install dependencies

    Using npm:

    npm install

    Using yarn:

    yarn install
  2. 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
  3. Create the .env file

    Copy 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
  4. 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
  5. Generate Prisma Client

    After running the migration, generate the Prisma Client for database interaction:

    npx prisma generate
  6. Seed the database

    Run the seeding script to populate the database with some initial data:

    npm run seed
  7. 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
  8. 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
    

Features

  • 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

Next Steps

  • 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

Checklist

  • 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

Notes

This project uses the template from nestjs-prisma-starter for initial setup.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 92.7%
  • PLpgSQL 5.8%
  • Other 1.5%