summaryrefslogtreecommitdiff
path: root/CLAUDE.md
blob: 2b82961804d57727834b0f12d44663d35a760508 (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
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is a language learning application built with React, Waku, and Bun. It focuses on Thai language learning with features for:

- Flashcard-based study using Spaced Repetition System (SRS)
- Detailed phonetic analysis and syllable breakdown
- Tone pattern visualization and practice
- User progress tracking
- Lessons and organized learning content

## Commands

### Development

```bash
# Start the development server
bun run dev

# Build the project
bun run build

# Start the production server
bun run start
```

## Architecture

### Framework and Runtime

- **Waku**: Server-side rendering (SSR) framework
- **React**: UI framework (v19.1)
- **Bun**: JavaScript runtime
- **TypeScript**: Type system

### Database

The project uses SQLite databases (managed in `src/lib/db/`) with schemas for:

- User accounts and progress tracking
- Language expressions and translations
- Syllable breakdowns and phonetic information
- Flashcards and lessons
- Spaced repetition data

### Key Components

1. **Server Actions** (`src/actions/`)
   - Server-side functions marked with `"use server";`
   - Handle database operations and server-side logic
   - Examples: authentication, database operations, language processing

2. **Client Components** (`src/components/`)
   - React components marked with `"use client";`
   - Import and call server actions
   - Manage UI state and user interactions

3. **SRS System** (`src/lib/services/srs*.ts`)
   - Implements spaced repetition algorithms
   - Tracks user progress and schedules reviews
   - Multiple implementations for different tracking approaches

4. **Language Processing** (`src/lib/lang/`, `src/zoom/`)
   - Thai language syllable parsing and phonetic analysis
   - Tone pattern visualization and analysis
   - Text parsing and hierarchical display

5. **Database Handlers** (`src/lib/db/`)
   - Connection management
   - CRUD operations for all entities
   - Query functions for app features

### Data Flow

1. Server components fetch initial data
2. Client components render UI and handle user interactions
3. User actions trigger server actions
4. Server actions update the database
5. UI updates with new data from server actions

### Key Files

- `waku.config.ts`: Waku framework configuration
- `src/lib/db/schema.sql`: Main database schema
- `src/lib/db/prosodyschema.sql`: Phonetic analysis schema
- `src/lib/services/srs_streamlined.ts`: Main SRS implementation
- `src/actions/`: Server actions for various features