Manufacturing Admin
A Manufacturing Execution System (MES) for managing production operations, purchase orders, customer shipments, and work orders. This application provides both an administrative interface (AdminJS) and REST APIs for integration with manufacturing workflows.
Overviewโ
Manufacturing Admin is built on Express.js with TypeScript and provides comprehensive tools for managing the full lifecycle of manufacturing orders, from purchase order creation through shipment and individual work order tracking. The system includes barcode generation, multilingual support, and AI-powered features.
Architectureโ
- Runtime: Node.js with Express.js
- Language: TypeScript with strict type checking
- Database: PostgreSQL with Prisma ORM
- Admin UI: AdminJS with custom React components
- API Documentation: Auto-generated OpenAPI specs from Zod schemas
- Deployment: Docker containers on GCP Cloud Run
Core Featuresโ
Purchase Order Managementโ
Create and track purchase orders with associated costs, dates, and status tracking. Purchase orders serve as the top-level container for customer shipments and work orders.
Customer Shipment Trackingโ
Manage shipments linked to purchase orders, including carrier information, tracking numbers, and shipping dates. Each shipment can contain multiple work orders for different SKUs.
Work Order Systemโ
Generate and track individual work orders for specific SKU production. Work orders include:
- Style, color, and size specifications
- Estimated delivery and ship dates
- Quantity tracking
- Barcode generation for manufacturing floor use
- Status management (Open, Printed, Done)
Barcode Generationโ
Create SVG barcodes in multiple formats (CODE128, CODE39) with customizable styling options. Supports both single barcode generation and batch processing for multiple items.
Multilingual Supportโ
Work orders and manufacturing documentation support both English and Chinese translations, facilitating communication with overseas manufacturing partners.
AI Integrationโ
GPT-4o-mini integration for AI-powered assistance and natural language processing capabilities.
Data Modelโ
The application uses a relational data model with the following core entities:
- PurchaseOrder: Top-level order container
- CustomerShipment: Shipment details linked to purchase orders
- WorkOrder: Individual production orders with SKU details
- Style: Garment style definitions with measurements
- Color/Size: Reference data for product variations
- Material/Measurement: Detailed construction specifications
APIsโ
The application provides RESTful APIs organized into six service categories:
Barcode APIโ
- Health check endpoint
- Single barcode generation
- Batch barcode processing
GPT APIโ
- AI chat functionality with GPT-4o-mini
Work Order APIโ
- Work order creation
- Detailed work order retrieval with optional barcode
- Health check endpoint
Purchase Order APIโ
- Purchase order creation and management
Shipment APIโ
- Customer shipment creation
Hello APIโ
- Example endpoints for testing and development
All APIs include authentication, request validation with Zod schemas, and comprehensive error handling. See the API Reference for complete documentation.
Development Workflowโ
Local Developmentโ
npm install
npm run dev
The development server runs on port 8080 with hot reload enabled. AdminJS is accessible at /admin.
Database Managementโ
# Start PostgreSQL with Docker
npm run db:dev
# Run migrations
npm run db:migrate:dev
# Seed development data
npm run db:seed:dev
Code Qualityโ
- Linting/Formatting: Biome handles all code quality checks
- Type Safety: Full TypeScript strict mode
- Pre-commit Hooks: Lefthook runs quality checks automatically
- Testing: Vitest for unit tests
Deploymentโ
The application is deployed via GitHub Actions:
- Staging: Auto-deploys on pushes to
mainbranch - Production:
- Tag & Build: Auto-triggered on SemVer tag pushes (builds Docker image)
- Deploy: Manual workflow to deploy specific or latest tag
- Rollback: Deploy any previous tag manually
Docker images are stored in DigitalOcean Container Registry and deployed to DigitalOcean App Platform.
See the Release Process for complete deployment documentation.
Securityโ
- Helmet: Security headers (CSP, HSTS, etc.)
- CORS: Configurable cross-origin resource sharing
- Authentication: API key authentication for protected endpoints
- Request Validation: Zod schema validation on all inputs
- Sentry: Error tracking and monitoring
Getting Startedโ
- Clone the repository
- Install dependencies:
npm install - Set up environment: Copy
.env.exampleto.envand configure - Start database:
npm run db:dev - Run migrations:
npm run db:migrate:dev - Seed data:
npm run db:seed:dev - Start development server:
npm run dev - Access AdminJS: Navigate to
http://localhost:8080/admin
Documentationโ
- API Reference: Complete OpenAPI documentation for all endpoints
- GitHub Repository: Source code and issue tracking
- Engineering Docs: This documentation site