112 lines
2.5 KiB
Markdown
112 lines
2.5 KiB
Markdown
# NoteApp — Fullstack Project
|
|
|
|
> 一款支持多端同步、Markdown 编辑和标签管理的笔记应用。
|
|
|
|
## 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
|
|
|
|
#### items
|
|
- `GET /api/items` — List
|
|
- `GET /api/items/:id` — Get
|
|
- `POST /api/items` — Create
|
|
- `PUT /api/items/:id` — Update
|
|
- `DELETE /api/items/:id` — Delete
|
|
|
|
#### stock_in
|
|
- `GET /api/stock_in` — List
|
|
- `GET /api/stock_in/:id` — Get
|
|
- `POST /api/stock_in` — Create
|
|
- `PUT /api/stock_in/:id` — Update
|
|
- `DELETE /api/stock_in/:id` — Delete
|
|
|
|
#### stock_out
|
|
- `GET /api/stock_out` — List
|
|
- `GET /api/stock_out/:id` — Get
|
|
- `POST /api/stock_out` — Create
|
|
- `PUT /api/stock_out/:id` — Update
|
|
- `DELETE /api/stock_out/:id` — Delete
|
|
|
|
#### stocktaking
|
|
- `GET /api/stocktaking` — List
|
|
- `GET /api/stocktaking/:id` — Get
|
|
- `POST /api/stocktaking` — Create
|
|
- `PUT /api/stocktaking/:id` — Update
|
|
- `DELETE /api/stocktaking/:id` — Delete
|
|
|
|
#### stock_alerts
|
|
- `GET /api/stock_alerts` — List
|
|
- `GET /api/stock_alerts/:id` — Get
|
|
- `POST /api/stock_alerts` — Create
|
|
- `PUT /api/stock_alerts/:id` — Update
|
|
- `DELETE /api/stock_alerts/:id` — Delete
|
|
|
|
#### warehouse
|
|
- `GET /api/warehouse` — List
|
|
- `GET /api/warehouse/:id` — Get
|
|
- `POST /api/warehouse` — Create
|
|
- `PUT /api/warehouse/:id` — Update
|
|
- `DELETE /api/warehouse/:id` — Delete
|
|
|
|
### System
|
|
- `GET /api/health` — Health check
|
|
|
|
## Environment Variables
|
|
|
|
See `.env.example` for all available configuration.
|