# OAFlow — 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

#### tickets
- `GET    /api/tickets` — List
- `GET    /api/tickets/:id` — Get
- `POST   /api/tickets` — Create
- `PUT    /api/tickets/:id` — Update
- `DELETE /api/tickets/: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

### System
- `GET /api/health` — Health check

## Environment Variables

See `.env.example` for all available configuration.
