Shop Microservers uses Prisma ORM with three logical PostgreSQL 16 databases. Each service that needs persistence manages its own Prisma schema independently — there is no shared ORM instance or shared schema file. This keeps the data boundary between services explicit and enforced at the schema level. The three databases areDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/astrxnomo/shop-microservers/llms.txt
Use this file to discover all available pages before exploring further.
auth_db (managed by the auth service), catalog_db (managed by the catalog service), and orders_db (managed by the orders service).
Databases at a Glance
| Database | Used By | Tables |
|---|---|---|
auth_db | auth service | User |
catalog_db | catalog service | Product |
orders_db | orders service | Order, OrderItem |
Each service owns its own dedicated database. The auth service owns
auth_db and manages the User table; the orders service owns orders_db and manages the Order and OrderItem tables. Neither service uses the other’s Prisma client.Schema Reference
Auth — User
The auth service stores one record per registered user. Passwords are stored as bcrypt hashes; the plain-text password is never persisted.
Catalog — Product
The catalog service stores the full product inventory. The stock field is decremented atomically by the orders service at checkout time via the catalog’s stock endpoint.
Orders — Order, OrderItem, and OrderStatus
The orders service records each completed checkout as an Order with one or more OrderItem rows. Product details (name, price) are copied into OrderItem at the time of purchase so that the record remains accurate even if the catalog changes later.
Migration Commands
All three services with a database expose the same npm scripts for schema management.In the Docker Compose setup, each service’s
CMD runs prisma db push on startup before launching the Express server. This applies the current schema state directly without creating a migration history file. For a production deployment, consider replacing prisma db push with prisma migrate deploy so that schema changes are tracked and applied incrementally.Seeding the Catalog
The catalog seed script inserts 12 sample products across five categories (Electronics, Footwear, Accessories, Home & Kitchen, Sports). The seed is idempotent: it checks the current row count before inserting and skips entirely if any products already exist.npm run db:seed manually when developing locally.
Prisma Client Output Location
Every service generates its Prisma client into../generated/client — a directory that sits alongside prisma/ as a sibling, not inside it. This means each service has a completely isolated generated client.
schema.prisma file, regenerate the client for that service: