- Amplication-generated monorepo with three independently deployable services under
apps/(see README.md). ecommerce-server(NestJS + Prisma + PostgreSQL) publishes Kafka messages for order and product lifecycle events via topics such asorder.create.v1andproduct.update.v1(README.md).logistic-server(NestJS + Prisma + MySQL) consumes the same Kafka topics using the broker's receive pattern and authenticates via HTTP Basic (README.md).ecommerce-adminis a React + react-admin dashboard that ships with forms, routing, and authentication pre-wired to the backend (apps/ecommerce-admin/README.md).
| Path | Contents | Notes |
|---|---|---|
/README.md |
High-level description of all services and broker topics | Use it for quick capability reminders. |
/apps/ecommerce-server |
NestJS backend with Prisma schema, Kafka integration, Jest tests, Docker assets | Service README documents env vars and scripts. |
/apps/logistic-server |
NestJS backend mirroring the ecommerce patterns but targeting MySQL and HTTP Basic auth | Includes identical script surface for parity. |
/apps/ecommerce-admin |
Vite-powered React Admin frontend with resource components under src/ |
Scripts for dev server, build, lint, and container packaging. |
- Manage configuration exclusively via each service's
.envas outlined in their READMEs (e.g.,DB_URL,JWT_SECRET_KEY,PORT). - Keep Node.js, npm, and Docker installed before running scripts; run
npm installfollowed bynpm run prisma:generateprior to local development (apps/ecommerce-server/README.md, apps/logistic-server/README.md). - Generated resources live in
src/<entity>/base; extend them in sibling files (seeapps/ecommerce-server/src/product/product.service.ts).
- Kafka wiring is centralized in
apps/ecommerce-server/src/kafka/, wherekafka.module.tsdeclares a global module that creates a client viaClientProxyFactoryand exportsKafkaProducerService. - Topic names are fixed (
order.create.v1,order.update.v1,product.create.v1,product.update.v1) and must stay aligned with partner services (root README.md).
- Use
npm run prisma:generatewhenever schema files change (script defined in each backendpackage.json). - Database lifecycle scripts (
db:migrate-save,db:migrate-up,db:clean,db:init) orchestrate migrations and seeding;db:initchains migration creation, deployment, andseed(per backendpackage.json).
- Components follow react-admin patterns: e.g.,
ProductListcomposes<List>+<Datagrid>with a sharedPaginationcomponent and 50-item pages (apps/ecommerce-admin/src/product/ProductList.tsx). - Environment relies on
PORT(default 3001) andREACT_APP_SERVER_URLpointing to the running backend (apps/ecommerce-admin/README.md).
- Service customization:
ProductServiceextendsProductServiceBaseand injectsPrismaService, illustrating how to add logic without touching generated files (apps/ecommerce-server/src/product/product.service.ts). - Kafka module:
kafka.module.tsis marked@Global()and registers aKAFKA_CLIENTprovider plusKafkaProducerService, enabling broker usage across modules without repeated wiring. - Testing: Jest specs live under
apps/ecommerce-server/src/tests/; the JWT strategy spec asserts that unauthenticated users triggerUnauthorizedException(apps/ecommerce-server/src/tests/auth/jwt/jwt.strategy.spec.ts). - Frontend resources: Each entity directory (e.g.,
src/product) holdsList,Create,Edit,Show, andTitlecomponents following the pattern shown inProductList. - Containers: Backends expose
docker:dev,compose:up, andpackage:containerscripts for local infrastructure and image builds (per backendpackage.json). The frontend also offerspackage:container(perapps/ecommerce-admin/package.json).
- Environment parity: Never hard-code credentials—update
.envvariables documented in each service README before booting a service. - Generated code safety: Do not edit files under
src/<entity>/base; extend them as shown inproduct.service.tsto keep Amplication upgrades painless. - Authentication defaults: Each server ships with an
admin/adminuser, and the admin UI expects the same credentials; change these via seeding before production (apps/ecommerce-server/README.md, apps/logistic-server/README.md, apps/ecommerce-admin/README.md). - Broker contract: Maintain the documented Kafka topic names so
logistic-servercontinues to receive events emitted byecommerce-server(root README.md). - Testing discipline: Extend Jest coverage within
apps/*/src/tests/and keep expectations aligned with existing strategy tests (jwt.strategy.spec.ts).
cd apps/ecommerce-server # or apps/logistic-server
npm install
npm run prisma:generatecd apps/ecommerce-server
npm run docker:dev # spins up Postgres/MySQL per service config
npm run db:init # create initial migration, apply, seed
npm run start # launches NestJS on port 3000(Commands mirrored in apps/logistic-server, per each README.)
cd apps/ecommerce-server
npm run db:migrate-save -- --name "feature-name"
npm run db:migrate-up
npm run seed # reruns scripts/seed.ts
npm run db:clean # resets the schema when needed(Script names identical in apps/logistic-server/package.json.)
cd apps/ecommerce-server
npm run testThis runs Jest using the configuration declared in package.json. Repeat inside apps/logistic-server to validate its services.
cd apps/ecommerce-admin
npm install
npm run start # Vite dev server on http://localhost:3001Set REACT_APP_SERVER_URL to the reachable backend before running (per apps/ecommerce-admin/README.md).
cd apps/ecommerce-admin
npm run build # production assets under dist/
npm run type-check
npm run lintUse npm run package:container here (and in backends) to build Docker images.
cd apps/ecommerce-server
npm run compose:up # or docker:dev for DB-only
# ... work ...
npm run compose:down # remove containers and volumesIdentical scripts exist in apps/logistic-server for consistent workflows.
| File | Why it matters |
|---|---|
apps/ecommerce-admin/src/product/ProductList.tsx |
Shows the canonical react-admin list pattern with shared pagination and field declarations. |
apps/ecommerce-server/src/product/product.service.ts |
Demonstrates extending generated base services while injecting PrismaService. |
apps/ecommerce-server/src/kafka/kafka.module.ts |
Illustrates the global Kafka module that provisions the broker client and producer service. |
apps/ecommerce-server/src/tests/auth/jwt/jwt.strategy.spec.ts |
Provides a Jest example validating authentication flows and error handling. |