This project is proprietary and UNLICENSED. No permission is granted to use, copy,
modify, or distribute any part of it without prior written permission. See LICENSE.
App for creating and tracking production orders across stations:
- profilisanje
- sica
- savijanje
- utovar
Current stack:
- Frontend: React 18 + Vite + Tailwind + Radix UI
- Backend: NestJS + TypeScript
- ORM/DB: Prisma + PostgreSQL (Docker in local dev)
- Auth with roles and httpOnly cookie session (
/auth/login,/auth/me,/auth/logout) - Order workflow and station status transitions
- Station inboxes and worksheet flow
- Local order migration endpoint (
/migration/local-orders/import) - Custom savijanje templates with advanced options (segments, taper, squeeze, pyramid, alignment)
- Custom templates are now persisted on backend and shared between users/devices
- Frontend app:
src/ - Backend app:
backend/ - DB container config:
docker-compose.yml - Frontend env example:
.env.example - Backend env example:
backend/.env.example
- Node.js 18+
- npm
- Docker Desktop
- Install dependencies
npm install
npm --prefix backend install- Start PostgreSQL
docker compose up -d- Create env files
- Frontend:
copy .env.example .env- Backend:
copy backend/.env.example backend/.env- Prepare database and seed users
npm --prefix backend run prisma:generate
npm --prefix backend run prisma:deploy
npm --prefix backend run prisma:seedRun in separate terminals:
- Backend API
npm --prefix backend run start:dev- Frontend
npm run devDefault local URLs:
- Frontend:
http://localhost:5173 - Backend:
http://localhost:4000 - Health check:
http://localhost:4000/health
From backend/prisma/seed.ts:
radnica / radnicaadmin / adminlelo / GlobalTrade(direktor)- station users:
sica,profilisanje,utovar,ekipa1,ekipa2,ekipa3
npm run build
npm --prefix backend run buildnpm run dev- start frontendnpm run build- frontend production buildnpm run preview- preview frontend buildnpm run api:dev- start backend dev servernpm run api:build- backend buildnpm run api:prisma:generate- prisma client generatenpm run api:prisma:migrate- prisma migrate devnpm run api:prisma:seed- seed dev users
Auth:
POST /auth/loginPOST /auth/logoutGET /auth/me
Orders and workflow:
GET /ordersGET /orders/:idPOST /ordersPATCH /orders/:id/stations/:station/statusPATCH /orders/:id/sica-items/:itemId/fulfillmentGET /stations/:station/inbox
Migration:
POST /migration/local-orders/import(admin/direktor)
Custom templates:
GET /custom-templatesPOST /custom-templatesDELETE /custom-templates/:type
- System templates are defined in
src/bending/templates.js - User templates are created from UI (
Novi nalog -> Savijanje -> Custom sabloni -> Novi sablon) - User templates are persisted in backend (
CustomTemplatetable), so other users/devices can see them - Frontend keeps a local cache for fast load, then refreshes from API
- Delete in UI is allowed only for user templates (
USER_TEMPLATE_*), not system templates
Frontend (.env):
VITE_API_BASE_URL=http://localhost:4000VITE_DATA_SOURCE=api
Backend (backend/.env):
PORT=4000DATABASE_URL=postgresql://...JWT_SECRET=...JWT_EXPIRES_IN=8hCORS_ORIGIN=http://localhost:5173
- Frontend and backend are separate deployments.
- Set
VITE_API_BASE_URLto your deployed backend URL (not localhost). - Set backend
CORS_ORIGINto your frontend URL. - If frontend and backend are on different domains, review cookie settings in
backend/src/modules/auth/auth.controller.ts(SameSite/Secure).
ERR_CONNECTION_REFUSEDon login:- frontend is calling unreachable API URL (often localhost in production)
- fix
VITE_API_BASE_URLand deploy backend
- Prisma
EPERMduringprisma:generateon Windows:- stop running backend process first, then run
prisma:generateagain
- stop running backend process first, then run