2.8 KiB
2.8 KiB
MyProject — Fullstack Project
一款根据用户需求定制的应用。
Architecture
apps/
├── web/ # Next.js 15 + TypeScript + Tailwind CSS
└── api/ # Fastify 5 + TypeScript + SQLite (sql.js)
packages/
├── shared-types/ # @shared/types — shared TypeScript interfaces
└── shared-config/ # @shared/config — shared configuration
Quick Start
# Install all dependencies (root + workspaces)
npm install
# Start both frontend and backend in dev mode
npm run dev
# Or start individually
npm run dev:web # http://localhost:3000
npm run dev:api # http://localhost:3001
Build
# Build everything
npm run build
# Or individually
npm run build:web
npm run build:api
Testing
# Run API tests
npm test
API Endpoints
Auth
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/me
Resources
users
GET /api/users— ListGET /api/users/:id— GetPOST /api/users— CreatePUT /api/users/:id— UpdateDELETE /api/users/:id— Delete
contracts
GET /api/contracts— ListGET /api/contracts/:id— GetPOST /api/contracts— CreatePUT /api/contracts/:id— UpdateDELETE /api/contracts/:id— Delete
approvals
GET /api/approvals— ListGET /api/approvals/:id— GetPOST /api/approvals— CreatePUT /api/approvals/:id— UpdateDELETE /api/approvals/:id— Delete
customers
GET /api/customers— ListGET /api/customers/:id— GetPOST /api/customers— CreatePUT /api/customers/:id— UpdateDELETE /api/customers/:id— Delete
reminders
GET /api/reminders— ListGET /api/reminders/:id— GetPOST /api/reminders— CreatePUT /api/reminders/:id— UpdateDELETE /api/reminders/:id— Delete
equipment
GET /api/equipment— ListGET /api/equipment/:id— GetPOST /api/equipment— CreatePUT /api/equipment/:id— UpdateDELETE /api/equipment/:id— Delete
inspection_plans
GET /api/inspection_plans— ListGET /api/inspection_plans/:id— GetPOST /api/inspection_plans— CreatePUT /api/inspection_plans/:id— UpdateDELETE /api/inspection_plans/:id— Delete
tasks
GET /api/tasks— ListGET /api/tasks/:id— GetPOST /api/tasks— CreatePUT /api/tasks/:id— UpdateDELETE /api/tasks/:id— Delete
items
GET /api/items— ListGET /api/items/:id— GetPOST /api/items— CreatePUT /api/items/:id— UpdateDELETE /api/items/:id— Delete
System
GET /api/health— Health check
Environment Variables
See .env.example for all available configuration.