# NoteApp — Backend API > 一款支持多端同步、Markdown 编辑和标签管理的笔记应用。 ## Tech Stack - **Runtime**: Node.js - **Framework**: Fastify 5 - **Language**: TypeScript - **Database**: SQLite (better-sqlite3) - **Auth**: JWT + bcrypt ## Getting Started ```bash # Install dependencies npm install # Development (hot reload) npm run dev # Build npm run build # Production start npm run start # Run tests npm test ``` ## Project Structure ``` src/ ├── index.ts # Server entry point ├── db/ │ ├── schema.ts # SQLite schema │ └── client.ts # Database client ├── routes/ │ ├── auth.ts # Auth routes (register/login/me) │ └── *.ts # CRUD routes ├── services/ │ └── *.ts # Business logic ├── middleware/ │ └── auth.ts # JWT middleware ├── types/ │ └── index.ts # TypeScript types └── __tests__/ └── *.test.ts # Tests ``` ## API Endpoints ### Auth - `POST /api/auth/register` — Register - `POST /api/auth/login` — Login - `GET /api/auth/me` — Current user (auth required) ### Resources #### customers - `GET /api/customers` — List all - `GET /api/customers/:id` — Get by ID - `POST /api/customers` — Create - `PUT /api/customers/:id` — Update - `DELETE /api/customers/:id` — Delete #### sales_pipeline - `GET /api/sales_pipeline` — List all - `GET /api/sales_pipeline/:id` — Get by ID - `POST /api/sales_pipeline` — Create - `PUT /api/sales_pipeline/:id` — Update - `DELETE /api/sales_pipeline/:id` — Delete #### follow_ups - `GET /api/follow_ups` — List all - `GET /api/follow_ups/:id` — Get by ID - `POST /api/follow_ups` — Create - `PUT /api/follow_ups/:id` — Update - `DELETE /api/follow_ups/:id` — Delete #### dashboard - `GET /api/dashboard` — List all - `GET /api/dashboard/:id` — Get by ID - `POST /api/dashboard` — Create - `PUT /api/dashboard/:id` — Update - `DELETE /api/dashboard/:id` — Delete ### System - `GET /api/health` — Health check