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

#### pets
- `GET    /api/pets` — List
- `GET    /api/pets/:id` — Get
- `POST   /api/pets` — Create
- `PUT    /api/pets/:id` — Update
- `DELETE /api/pets/:id` — Delete

#### schedules
- `GET    /api/schedules` — List
- `GET    /api/schedules/:id` — Get
- `POST   /api/schedules` — Create
- `PUT    /api/schedules/:id` — Update
- `DELETE /api/schedules/:id` — Delete

#### records
- `GET    /api/records` — List
- `GET    /api/records/:id` — Get
- `POST   /api/records` — Create
- `PUT    /api/records/:id` — Update
- `DELETE /api/records/:id` — Delete

#### albums
- `GET    /api/albums` — List
- `GET    /api/albums/:id` — Get
- `POST   /api/albums` — Create
- `PUT    /api/albums/:id` — Update
- `DELETE /api/albums/:id` — Delete

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

#### daily-logs
- `GET    /api/daily-logs` — List
- `GET    /api/daily-logs/:id` — Get
- `POST   /api/daily-logs` — Create
- `PUT    /api/daily-logs/:id` — Update
- `DELETE /api/daily-logs/:id` — Delete

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

## Environment Variables

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