aboutsummaryrefslogtreecommitdiffhomepage
path: root/README.md
blob: 6c7ad13d60e48fe1e5ac6148886bc6be589b2022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Kioku

A spaced repetition learning application (Anki clone) with PWA offline support and cloud sync.

## Features

- Spaced Repetition: FSRS algorithm for optimal learning scheduling
- Offline Support: Full PWA with IndexedDB local storage
- Cloud Sync: Automatic sync when online with conflict resolution
- Anki Import: Import existing .apkg decks from Anki

## Tech Stack

| Layer | Technology |
|-------|------------|
| Frontend | SvelteKit |
| Backend | Hono + TypeScript |
| Database | PostgreSQL |
| ORM | Drizzle |
| Client DB | Dexie.js (IndexedDB) |
| PWA | @vite-pwa/sveltekit |
| Algorithm | FSRS (ts-fsrs) |
| Auth | Username/password + JWT |
| Test | Vitest |
| Monorepo | pnpm workspace |

## Project Structure

```
kioku/
├── apps/
│   ├── web/        # SvelteKit frontend (PWA)
│   └── server/     # Hono backend API
└── packages/
    └── shared/     # Shared types and schemas
```

## Getting Started

### Prerequisites

- Node.js 22+
- pnpm 9+
- PostgreSQL 15+
- Docker (optional)

### Development

```bash
# Install dependencies
pnpm install

# Start PostgreSQL (with Docker)
docker compose up -d postgres

# Run database migrations
pnpm --filter server db:migrate

# Start development servers
pnpm dev
```

### Environment Variables

Create `.env` files in each app directory:

```apps/server/.env
DATABASE_URL=postgresql://user:password@localhost:5432/kioku
JWT_SECRET=your-secret-key
```

```apps/web/.env
PUBLIC_API_URL=http://localhost:3000
```

## Scripts

```bash
pnpm dev          # Start all apps in development
pnpm build        # Build all apps
pnpm test         # Run tests
pnpm lint         # Lint code
```

## Documentation

See [docs/dev/architecture.md](docs/dev/architecture.md) for detailed architecture documentation.

## License

MIT