How shazzann/colombocosmetics works
Purpose and Entry Points
This is a full-stack order, product, dashboard, and reporting system. The TypeScript backend exposes an HTTP API; the React frontend provides authenticated operational screens for creating and managing orders, inventory/products, receipts, labels, and reports.
• Backend startup: backend/src/index.ts
• Frontend bootstrap and root UI: frontend/src/main.tsx, frontend/src/App.tsx
• Database schema and seed data: backend/prisma/schema.prisma, backend/prisma/seed.ts
Backend API Composition
The backend is organized as route modules delegating to controllers, with a shared database client and authentication middleware. API domains are authentication, products, orders, reports, and dashboard summaries.
• Route boundary: backend/src/routes/authRoutes.ts, backend/src/routes/orderRoutes.ts, backend/src/routes/productRoutes.ts
• Domain handlers: backend/src/controllers/authController.ts, backend/src/controllers/orderController.ts, backend/src/controllers/dashboardController.ts
• Reporting handlers: backend/src/controllers/reportsController.ts
Control flow is expected to be: HTTP request → route selection → authentication where required → controller business/query logic → Prisma persistence → JSON response.
Identity and Access Boundary
Authentication is centralized in backend middleware and consumed by the frontend authentication context and route guard. This separates public registration/login access from protected operational pages.
• Server enforcement: backend/src/middleware/authMiddleware.ts, backend/src/controllers/authController.ts
• Client session state: frontend/src/context/AuthContext.tsx
• Client navigation gate: frontend/src/components/ProtectedRoute.tsx
• Public identity screens: frontend/src/pages/Login.tsx, frontend/src/pages/Register.tsx
Persistence and Business Domains
Prisma defines the system-of-record model and is accessed through one database client. Orders and products are the principal transactional domains; dashboard and report endpoints likely derive aggregates from those records.
• Prisma model contract: backend/prisma/schema.prisma
• Shared DB access: backend/src/db/client.ts
• Product lifecycle API: backend/src/controllers/productController.ts, backend/src/routes/productRoutes.ts
• Order lifecycle API: backend/src/controllers/orderController.ts, backend/src/routes/orderRoutes.ts
The Prisma database is an external infrastructure dependency; its concrete provider and connection settings are defined by the schema/environment rather than visible in the tree.
Frontend Workflow and State
The frontend is a Vite React application. It uses a centralized API client, auth context, and an order-draft context to carry state across order-creation steps and downstream document views.
• HTTP integration boundary: frontend/src/api/client.ts
• Draft/order workflow state: frontend/src/context/OrderDraftContext.tsx
• Core operations screens: frontend/src/pages/CreateOrder.tsx, frontend/src/pages/Orders.tsx, frontend/src/pages/OrderDetails.tsx
• Order outputs: frontend/src/pages/Receipt.tsx, frontend/src/pages/DeliveryLabel.tsx
Order presentation is decomposed into reusable order card and line-item table components under frontend/src/components/orders/.
Reporting and Operational Views
Dashboard and reporting are separate read-oriented surfaces over transactional data, while Products supports catalog/inventory management.
• Dashboard endpoint/controller: backend/src/controllers/dashboardController.ts
• Reports endpoint/controller: backend/src/controllers/reportsController.ts, backend/src/routes/reportRoutes.ts
• Corresponding UI: frontend/src/pages/Dashboard.tsx, frontend/src/pages/Reports.tsx, frontend/src/pages/Products.tsx
Deployment and Built Artifacts
The backend has a Docker image definition and Railway deployment configuration. The frontend has Vercel configuration. Compiled backend output is committed under backend/dist, mirroring the TypeScript source structure.
• Backend container/deployment: backend/Dockerfile, backend/railway.json
• Frontend deployment: frontend/vercel.json
• Production backend entry artifact: backend/dist/src/index.js
Main entry points: App.tsx React application · api/client.ts API client · db/client.ts Prisma client · CreateOrder.tsx Operations screens
Components 19
React frontend
- React application · Authenticated operational application root.
frontend/src/App.tsx - API client
frontend/src/api/client.ts - Auth context
frontend/src/context/AuthContext.tsx - Protected route
frontend/src/components/ProtectedRoute.tsx - Order draft context · Carries order state across creation steps and outputs.
frontend/src/context/OrderDraftContext.tsx - Operations screens · Create, browse, inspect orders and manage products.
frontend/src/pages/CreateOrder.tsx - Order documents
frontend/src/pages/Receipt.tsx - Dashboard and reports
frontend/src/pages/Dashboard.tsx
TypeScript backend
- HTTP API
backend/src/index.ts - Route modules · Auth, order, and product routes select API handlers.
backend/src/routes/orderRoutes.ts - Authentication middleware
backend/src/middleware/authMiddleware.ts - Order and product controllers
backend/src/controllers/orderController.ts - Auth controller · Handles registration and login.
backend/src/controllers/authController.ts - Dashboard and reports controllers
backend/src/controllers/dashboardController.ts
Data platform
- Prisma client · Shared persistence client.
backend/src/db/client.ts - Prisma schema and seed · System-of-record contract and seed data.
backend/prisma/schema.prisma - Prisma database · Provider and connection are configured outside the repository tree.
Deployment
- Backend container deployment
backend/Dockerfile - Frontend deployment
frontend/vercel.json
Connections 22
- React application → Auth context: uses
- React application → Protected route: gates private pages
- Protected route → Operations screens: allows authenticated access
- Operations screens → Order draft context: builds orders
- Order draft context → Order documents: supplies output state
- React application → Dashboard and reports: renders
- Auth context → API client: adds session
- Operations screens → API client: requests API
- Dashboard and reports → API client: queries aggregates
- API client → HTTP API: HTTP JSON
- HTTP API → Route modules: dispatches
- Route modules → Authentication middleware: protects private routes
- Route modules → Auth controller: auth endpoints
- Authentication middleware → Order and product controllers: authorizes
- Authentication middleware → Dashboard and reports controllers: authorizes
- Order and product controllers → Prisma client: persists orders and products
- Auth controller → Prisma client: reads identities
- Dashboard and reports controllers → Prisma client: aggregates records
- Prisma client → Prisma database: Prisma queries
- Prisma schema and seed → Prisma database: defines model
- Backend container deployment → HTTP API: runs backend
- Frontend deployment → React application: serves frontend