Files
16gagent/cases/teamflow-v2/backend
2026-06-06 10:40:48 +08:00
..
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00

TeamFlow — Backend API

一款支持多端同步、Markdown 编辑和标签管理的笔记应用。

Tech Stack

  • Runtime: Node.js
  • Framework: Fastify 5
  • Language: TypeScript
  • Database: SQLite (better-sqlite3)
  • Auth: JWT + bcrypt

Getting Started

# 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

users

  • GET /api/users — List all
  • GET /api/users/:id — Get by ID
  • POST /api/users — Create
  • PUT /api/users/:id — Update
  • DELETE /api/users/:id — Delete

notes

  • GET /api/notes — List all
  • GET /api/notes/:id — Get by ID
  • POST /api/notes — Create
  • PUT /api/notes/:id — Update
  • DELETE /api/notes/:id — Delete

tags

  • GET /api/tags — List all
  • GET /api/tags/:id — Get by ID
  • POST /api/tags — Create
  • PUT /api/tags/:id — Update
  • DELETE /api/tags/:id — Delete

note_tags

  • GET /api/note_tags — List all
  • GET /api/note_tags/:id — Get by ID
  • POST /api/note_tags — Create
  • PUT /api/note_tags/:id — Update
  • DELETE /api/note_tags/:id — Delete

System

  • GET /api/health — Health check