119 lines
2.6 KiB
Markdown
119 lines
2.6 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
# 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
|
|
|
|
```bash
|
|
# Build everything
|
|
npm run build
|
|
|
|
# Or individually
|
|
npm run build:web
|
|
npm run build:api
|
|
```
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
# Run API tests
|
|
npm test
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### Auth
|
|
- `POST /api/auth/register`
|
|
- `POST /api/auth/login`
|
|
- `GET /api/auth/me`
|
|
|
|
### Resources
|
|
#### users
|
|
- `GET /api/users` — List
|
|
- `GET /api/users/:id` — Get
|
|
- `POST /api/users` — Create
|
|
- `PUT /api/users/:id` — Update
|
|
- `DELETE /api/users/:id` — Delete
|
|
|
|
#### contracts
|
|
- `GET /api/contracts` — List
|
|
- `GET /api/contracts/:id` — Get
|
|
- `POST /api/contracts` — Create
|
|
- `PUT /api/contracts/:id` — Update
|
|
- `DELETE /api/contracts/:id` — Delete
|
|
|
|
#### approvals
|
|
- `GET /api/approvals` — List
|
|
- `GET /api/approvals/:id` — Get
|
|
- `POST /api/approvals` — Create
|
|
- `PUT /api/approvals/:id` — Update
|
|
- `DELETE /api/approvals/:id` — Delete
|
|
|
|
#### customers
|
|
- `GET /api/customers` — List
|
|
- `GET /api/customers/:id` — Get
|
|
- `POST /api/customers` — Create
|
|
- `PUT /api/customers/:id` — Update
|
|
- `DELETE /api/customers/:id` — Delete
|
|
|
|
#### reminders
|
|
- `GET /api/reminders` — List
|
|
- `GET /api/reminders/:id` — Get
|
|
- `POST /api/reminders` — Create
|
|
- `PUT /api/reminders/:id` — Update
|
|
- `DELETE /api/reminders/:id` — Delete
|
|
|
|
#### assets
|
|
- `GET /api/assets` — List
|
|
- `GET /api/assets/:id` — Get
|
|
- `POST /api/assets` — Create
|
|
- `PUT /api/assets/:id` — Update
|
|
- `DELETE /api/assets/:id` — Delete
|
|
|
|
#### items
|
|
- `GET /api/items` — List
|
|
- `GET /api/items/:id` — Get
|
|
- `POST /api/items` — Create
|
|
- `PUT /api/items/:id` — Update
|
|
- `DELETE /api/items/:id` — Delete
|
|
|
|
#### stats
|
|
- `GET /api/stats` — List
|
|
- `GET /api/stats/:id` — Get
|
|
- `POST /api/stats` — Create
|
|
- `PUT /api/stats/:id` — Update
|
|
- `DELETE /api/stats/:id` — Delete
|
|
|
|
### System
|
|
- `GET /api/health` — Health check
|
|
|
|
## Environment Variables
|
|
|
|
See `.env.example` for all available configuration.
|