Star-Lab is a full-stack web application designed to streamline laboratory testing workflows. It features a robust backend API and a modern frontend for managing customer registration, test requests, lab processing, invoicing, and results delivery.
- Role-Based Access Control: Assign roles like
ADMIN,LAB_ADMIN,CUSTOMER,TECHNICIAN, andDOCTORto ensure secure access. - End-to-End Test Tracking: Handle test requests from submission and payment to sample tracking, result uploads, and approval.
- Customer & Doctor Portals: Provide dedicated interfaces for customers and doctors to manage requests and review results.
- Automated Invoicing: Generate invoices, track payments, and manage billing seamlessly.
- Comprehensive API: RESTful API built with Express.js and TypeScript, offering endpoints for all functionalities.
- Modern Frontend: Responsive UI built with React, React Router, and Tailwind CSS.
- Tool: pnpm workspaces
- Framework: Express.js
- Language: TypeScript
- ORM: Prisma
- Database: PostgreSQL
- Authentication: JWT
- API Documentation: Swagger/OpenAPI
- Framework: NextJs
- Styling: Tailwind CSS
- Technology: Prisma for database migrations
- Technology: Node.js with TypeScript
- Tools: Docker and Docker Compose
graph TD
subgraph User Interaction
User --> Frontend(Frontend - Next.js);
end
subgraph Application Services
Frontend --> Backend(Backend - Node.js/Express.js);
Backend --> Database(Database - PostgreSQL via Prisma);
Backend --> HelperService(Helper Service - Node.js);
end
subgraph Project Structure
Monorepo(pnpm Monorepo)
Frontend -- part of --> Monorepo;
Backend -- part of --> Monorepo;
HelperService -- part of --> Monorepo;
end
subgraph Deployment
DockerCompose(Docker Compose)
DockerCompose -- orchestrates --> Frontend;
DockerCompose -- orchestrates --> Backend;
DockerCompose -- orchestrates --> Database;
DockerCompose -- orchestrates --> HelperService;
end
- Node.js (v18 or higher)
- pnpm
- Docker and Docker Compose
-
Clone the repository:
git clone https://github.com/damrongsak/star-lab.git cd star-lab -
Install dependencies:
pnpm install
-
Setup Environment Variables: Configure
.envfiles forapps/backendandapps/frontendas needed. Refer to their respectiveREADME.mdfiles for details. -
Start the development environment:
docker-compose up -d
- Backend:
http://localhost:5001 - Frontend:
http://localhost:5173 - API Docs:
http://localhost:5001/api-docs
- Backend:
Run backend unit tests:
cd apps/backend
pnpm test-
Run
devfor backend:pnpm --filter backend dev
-
Run
buildfor frontend:pnpm --filter frontend build
-
Add a dependency:
pnpm --filter frontend add axios pnpm --filter backend add express
-
Add a dev dependency:
pnpm --filter backend add -D jest
-
Remove a dependency:
pnpm --filter frontend remove axios
Run a script across all packages:
pnpm -r run lintRemove all node_modules:
pnpm -r exec rm -rf node_modulesReinstall dependencies:
pnpm installFor advanced usage, refer to the pnpm documentation.
- Be Specific: Provide detailed requests for better assistance.
- Provide Context: Mention relevant files, functions, or endpoints.
- One Task at a Time: Break complex changes into smaller tasks.
- Review Plans: Confirm proposed plans before proceeding.
- Adding a feature: "Add a
GET /api/v1/customers/recentendpoint to return the 5 most recently registered customers, accessible only toADMINusers." - Writing tests: "Write unit tests for
InvoiceServicecoveringcreateInvoiceandmarkAsPaidmethods." - Refactoring code: "Refactor
getTestRequestinTestRequestController.tsto include the assigned doctor's name in the response." - Frontend changes: "Create a
/dashboard/reportspage displaying statistics fromGET /api/v1/invoices/statistics, visible toADMINandLAB_ADMINroles."
Collaborate effectively to build great solutions!
.
├── AGENTS.md
├── ARCHITECTURE_ANALYSIS.md
├── CLAUDE.md
├── GEMINI.md
├── INITIAL.md
├── PLANNING.md
├── PRPs
│ ├── EXAMPLE_multi_agent_prp.md
│ ├── document-request-list.md
│ └── templates
├── README.md
├── TASK-Overview.md
├── TASK.md
├── apps
│ ├── backend
│ ├── frontend
│ ├── helper-service
│ └── public
├── codex-exec.sh
├── codex-execution.log
├── codex-output.log
├── diagrams
│ └── codeviz-diagram-2025-08-12T14-11-09.drawio
├── docker-compose.overide.yml
├── docker-compose.yml
├── docs
│ ├── 01-01 Lab Tracking Web Application Development Plan.md
│ ├── 01-01 Lab Tracking Web Application Development Plan.pdf
│ ├── 02-01 Customer Registration & Profile Module Design Specification.pdf
│ ├── 02-02 Customer Portal Features Module Design Specification.pdf
│ ├── 03-01 Internal Lab User Management Module Design Specification.pdf
│ ├── 03-02 Lab Internal Operations Module Design Specification.pdf
│ └── 04-01 Doctor Approval Workflow Module Design Specification.pdf
├── examples
│ ├── GEMINI.md
│ ├── README.md
│ ├── backend
│ ├── frontend
│ ├── packages
│ └── pnpm-workspace.yaml
├── file-list.txt
├── node_modules
├── package.json
├── packages
│ └── shared
├── pnpm-lock.yaml
└── pnpm-workspace.yaml