How tanqdev/acheter works
Acheter Hub is a React storefront backed by an Express API and PostgreSQL. The user journey runs from product browsing through cart management and authenticated checkout to order confirmation and order history; authentication is a supporting session-based workflow. The backend separates routes, controllers, and database-oriented services, with checkout protecting inventory inside a transaction. The README documents the broader client/API relationship and product capabilities; some individual page-to-endpoint calls were not shown in the sampled evidence.
Main entry points: App.tsx Client routing · pool.ts Postgres pool · server.ts Express server · auth.middleware.ts Auth middleware
Components 28
Storefront
- Client routing
client/src/App.tsx - Product browsing
client/src/pages/Products.tsx - Product details
client/src/pages/ProductsDetail.tsx - Shopping cart
client/src/pages/Cart.tsx - Checkout form
client/src/pages/Checkout.tsx - Order confirmation
client/src/pages/OrderConfirmation.tsx - Order history
client/src/pages/Orders.tsx - Auth screens
client/src/pages/Login.tsx - Session client
client/src/context/AuthContext.tsx
Identity
- Auth routes
server/src/auth/auth.routes.ts - Auth controller
server/src/auth/auth.controller.ts - Account service
server/src/auth/auth.service.ts - Session handling
server/src/auth/sessions.ts - Auth middleware
server/src/auth/auth.middleware.ts
Commerce API
- Express server
server/src/server.ts - Product routes
server/src/routes/product.route.ts - Product controller
server/src/controllers/product.controller.ts - Product service
server/src/services/product.service.ts - Cart routes
server/src/routes/cart.route.ts - Cart controller
server/src/controllers/cart.controller.ts - Cart service
server/src/services/cart.services.ts - Order routes
server/src/routes/order.route.ts - Order controller
server/src/controllers/order.controller.ts - Order service
server/src/services/order.services.ts
Persistence
- Postgres pool
server/src/db/pool.ts - PostgreSQL
Other components
- Shopper
- HTTP API
Connections 35
- Shopper → Client routing: uses storefront
- Client routing → Product browsing: routes to
client/src/App.tsx - Client routing → Product details: routes to
client/src/App.tsx - Client routing → Shopping cart: routes to
client/src/App.tsx - Client routing → Checkout form: routes to
client/src/App.tsx - Client routing → Order confirmation: routes to
client/src/App.tsx - Client routing → Order history: routes to
client/src/App.tsx - Client routing → Auth screens: routes to
client/src/App.tsx - Auth screens → Session client: uses session
client/src/context/AuthContext.tsx - Session client → HTTP API: requests auth
client/src/context/AuthContext.tsx - Client routing → HTTP API: makes API requests
- HTTP API → Express server: HTTP requests
- Express server → Product routes: mounts
server/src/server.ts - Express server → Cart routes: mounts
server/src/server.ts - Express server → Auth routes: mounts
server/src/server.ts - Express server → Order routes: mounts
server/src/server.ts - Product routes → Product controller: dispatches
server/src/routes/product.route.ts - Product controller → Product service: calls
server/src/controllers/product.controller.ts - Product service → Postgres pool: queries
server/src/services/product.service.ts - Auth routes → Auth controller: dispatches
server/src/auth/auth.routes.ts - Auth controller → Account service: calls
server/src/auth/auth.controller.ts - Auth controller → Session handling: manages sessions
server/src/auth/auth.controller.ts - Auth routes → Auth middleware: protects routes
server/src/auth/auth.routes.ts - Auth middleware → Session handling: checks session
server/src/auth/auth.middleware.ts - Account service → Postgres pool: queries
server/src/auth/auth.service.ts - Session handling → Postgres pool: queries
server/src/auth/sessions.ts - Cart routes → Cart controller: dispatches
server/src/routes/cart.route.ts - Cart routes → Auth middleware: protects routes
server/src/routes/cart.route.ts - Cart controller → Cart service: calls
server/src/controllers/cart.controller.ts - Cart service → Postgres pool: queries
server/src/services/cart.services.ts - Order routes → Order controller: dispatches
server/src/routes/order.route.ts - Order routes → Auth middleware: protects routes
server/src/routes/order.route.ts - Order controller → Order service: calls
server/src/controllers/order.controller.ts - Order service → Postgres pool: runs transactions
server/src/services/order.services.ts - Postgres pool → PostgreSQL: connects to