A full-stack monorepo project structured using npm workspaces with React, Express Node.js, TypeScript, PostgreSQL, and MongoDB.
loramel-stock/
├── package.json # Root workspaces & script orchestrator
├── tsconfig.json # Monorepo shared base TypeScript config
├── docker-compose.yml # Local PostgreSQL & MongoDB container orchestration
│
├── frontend/ # React 18 + Vite + TypeScript Web Dashboard
│ ├── src/
│ │ ├── App.tsx # Interactive Status & Data Control Dashboard
│ │ ├── index.css # Glassmorphism dark mode aesthetic design system
│ │ └── main.tsx
│ ├── vite.config.ts # Vite server & API proxy (/api -> http://localhost:5001)
│ └── package.json # Workspace package: @loramel/frontend
│
├── backend/ # Express + Node.js + TypeScript API Server
│ ├── src/
│ │ ├── index.ts # Express server entrypoint
│ │ ├── config.ts # Server & env configuration
│ │ └── routes.ts # API endpoints for Health, Postgres, & Mongo
│ └── package.json # Workspace package: @loramel/backend
│
├── database-pg/ # PostgreSQL Database Module
│ ├── schema.sql # Relational SQL schema & sample data seed
│ ├── src/
│ │ ├── client.ts # pg Connection Pool & typed query helpers
│ │ └── index.ts # Module exports
│ └── package.json # Workspace package: @loramel/database-pg
│
└── database-mongo/ # MongoDB Database Module
├── src/
│ ├── client.ts # Mongoose connection & logging helpers
│ ├── models/ # ActivityLog Mongoose schemas & interfaces
│ └── index.ts # Module exports
└── package.json # Workspace package: @loramel/database-mongo
npm install
npm run db:up
localhost:5432 (db: loramel_stock_db, user: postgres, pass: postgrespassword)localhost:27017 (db: loramel_stock_mongo, user: admin, pass: mongopassword)npm run build
npm run dev
http://localhost:3000http://localhost:5001| Command | Description |
|---|---|
npm run dev |
Starts frontend (Vite) and backend (Express TS) concurrently |
npm run dev:backend |
Starts only the Express TypeScript backend API |
npm run dev:frontend |
Starts only the React Vite frontend |
npm run build |
Compiles TypeScript across all workspace packages |
npm run db:up |
Boots PostgreSQL and MongoDB containers in background |
npm run db:down |
Stops and removes database containers |
npm run db:logs |
Streams live logs from Postgres & Mongo containers |
/api/health: Check system status across Node, PostgreSQL, and MongoDB./api/stock: Returns all stock items from PostgreSQL./api/stock: Adds a new item to PostgreSQL and logs action to MongoDB./api/activity: Returns recent audit/activity logs from MongoDB./api/activity: Logs custom activity into MongoDB.