75 lines
5.1 KiB
Markdown
75 lines
5.1 KiB
Markdown
# Mani Candles backend
|
|
|
|
Explore the [Graphify code graph](docs/graphify.md) to trace source-level dependencies and open the interactive backend map.
|
|
|
|
Phase 1A provides the service foundation. Phase 1B adds staff account provisioning, authentication, sessions, recovery, configurable RBAC, and audit records. Phase 1C implements core commerce APIs.
|
|
|
|
## Setup
|
|
|
|
Use Node 24 LTS and pnpm 11.19.0. Copy `.env.example` to `.env` and set a PostgreSQL connection URL. Never commit credentials.
|
|
|
|
```sh
|
|
pnpm install --frozen-lockfile
|
|
pnpm db:generate
|
|
pnpm db:deploy
|
|
pnpm check
|
|
pnpm build
|
|
pnpm start
|
|
```
|
|
|
|
Development: run `pnpm dev` to compile on changes and `pnpm start:watch` in a second terminal after the first compilation. HTTP endpoints: `GET /api/v1/health/live` and `GET /api/v1/health/ready`. Readiness returns 503 when the database query fails. Health responses deliberately omit infrastructure details.
|
|
|
|
## Layout
|
|
|
|
- `src/config`: validated configuration, injected once.
|
|
- `src/database`: Prisma connection lifecycle and database probes.
|
|
- `src/health`: controller and application service.
|
|
- `prisma/migrations`: ordered, committed SQL migrations.
|
|
- `test`: configuration, lifecycle, and HTTP tests.
|
|
- `docs`: delivery roadmap and engineering workflow.
|
|
|
|
Production must use a managed secret store, TLS termination, a restricted database account, backups, and the deployment migration command. Do not expose this foundation as a completed commerce platform.
|
|
|
|
Identity: see [API contract](docs/identity-api.md) and [setup/release guide](docs/identity-operations.md).
|
|
Phase 1C adds catalog, private addresses and inventory. See [commerce API](docs/commerce-api.md), [errors](docs/error-contract.md), [migrations](docs/migrations.md), [security preparation](docs/vapt-readiness.md) and [verification](docs/verification.md).
|
|
Phase 1D adds versioned carts, coupons, atomic checkout and private order snapshots. See [checkout API and pricing boundary](docs/checkout-api.md). Payment remains disabled until tax, shipping and payment rules are finalized.
|
|
Phase 1E provides a [provider-independent blueprint and test matrix](docs/phase1e-blueprint.md), configurable pricing snapshots and an [operational outbox/API](docs/operations-api.md). No real gateway or message delivery is enabled.
|
|
Phase 2A adds organization-scoped [supplier and material master data](docs/procurement-api.md).
|
|
Phase 2B adds [purchase-order drafts and issuance](docs/purchase-orders-api.md).
|
|
Phase 2C adds [partial goods receipts and quality inspection](docs/goods-receipts-api.md).
|
|
Phase 2D adds [supplier invoice matching and voids](docs/supplier-invoices-api.md).
|
|
Phase 2E adds [supplier payment records and reversals](docs/supplier-payments-api.md). Material stock movements and production remain later milestones.
|
|
Phase 2F adds [private versioned supplier documents and review](docs/supplier-documents-api.md).
|
|
Phase 2G adds [versioned product bills of materials](docs/bom-api.md).
|
|
Phase 2H adds [production batches](docs/production-batches-api.md).
|
|
Phase 2I adds [material consumption and wastage records](docs/material-usage-api.md).
|
|
Phase 2J adds [versioned packaging BOMs](docs/packaging-boms-api.md).
|
|
For a development owner, see [local admin setup](docs/local-admin.md).
|
|
|
|
### Swagger UI
|
|
|
|
Open http://localhost:3000/api/docs in development to browse and test the API. See [API explorer](docs/swagger.md) for authentication and configuration.
|
|
Packaging execution: see [Phase 2K API guide](docs/packaging-execution-api.md).
|
|
Cost estimates: see [Phase 2L API guide](docs/costing-api.md).
|
|
Batch cost snapshots: see [Phase 2M API guide](docs/batch-cost-api.md).
|
|
Warehouse material stock: see [Phase 2N API guide](docs/material-warehouse-stock-api.md).
|
|
Production material stock posting: see [Phase 2O API guide](docs/production-material-stock-api.md).
|
|
Packaging material stock posting: see [Phase 2P API guide](docs/packaging-material-stock-api.md).
|
|
Finished-goods receipts: see [Phase 2Q API guide](docs/finished-goods-receipt-api.md).
|
|
Material warehouse transfers: see [Phase 2R API guide](docs/material-transfers-api.md).
|
|
Manual material-stock adjustments: see [Phase 2S API guide](docs/material-adjustments-api.md).
|
|
Business-account profiles and manual verification: see [Phase 3A API guide](docs/b2b-business-verification-api.md).
|
|
Partner price lists and minimum quantities: see [Phase 3B API guide](docs/b2b-price-lists-api.md).
|
|
B2B quotations and response tracking: see [Phase 3C API guide](docs/b2b-quotations-api.md).
|
|
B2B credit proposals and independent review: see [Phase 3D API guide](docs/b2b-credit-policies-api.md).
|
|
B2B sample requests, review, and dispatch records: see [Phase 3E API guide](docs/b2b-samples-api.md).
|
|
B2B branding and artwork approvals: see [Phase 3F API guide](docs/b2b-artwork-api.md).
|
|
B2B partner purchase orders: see [Phase 3G API guide](docs/b2b-partner-orders-api.md).
|
|
B2B partner partial payments: see [Phase 3H API guide](docs/b2b-partner-payments-api.md).
|
|
|
|
B2B custom candle requests and staff review: see [Phase 3I API guide](docs/b2b-custom-candles-api.md).
|
|
|
|
B2B partner reports: see [Phase 3J API guide](docs/b2b-partner-reporting-api.md).
|
|
|
|
Private wishlists: see [Phase 4A API guide](docs/wishlist-api.md).
|