Skip to content

Latest commit

 

History

History
50 lines (42 loc) · 1.16 KB

File metadata and controls

50 lines (42 loc) · 1.16 KB

CatalogX Backend

Node.js + Express API for CatalogX.

Technologies

  • Runtime: Node.js
  • Language: TypeScript
  • Database: PostgreSQL (pg)
  • Cache: Redis (ioredis)
  • Auth: JWT + Bcryptjs
  • Validation: Zod

Backend Architecture

graph TD
    Request[HTTP Request]
    Router[Express Router]
    Auth[Middleware - Auth]
    Validators[Middleware - Zod Validation]
    Controller[Controllers]
    Service[Services]
    Database[(PostgreSQL)]
    Redis[(Redis Cache)]

    Request --> Router
    Router --> Auth
    Auth --> Validators
    Validators --> Controller
    Controller --> Service
    Service --> Database
    Service --> Redis
Loading

Getting Started

  1. cd backend
  2. npm install
  3. Configure .env (use .env.example as template)
  4. npm run build
  5. npm run dev

API Routes

  • POST /auth/register: Register a new user.
  • POST /auth/login: Login and get JWT.
  • GET /products: List products (cached).
  • GET /products/:id: Get product detail (cached).
  • POST /products: Create product (Auth required).
  • PUT /products/:id: Update product (Auth required).
  • DELETE /products/:id: Deactivate product (Auth required).