# Kale Dictionary API
A fast, read-only REST API for the **Kalenjin language dictionary**, built with Bun and SQLite (`bun:sqlite`). Zero native-compilation dependencies — everything runs through Bun's built-in runtime.
## Project Structure
```
kalenjin_dic_backend/
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI
├── assets/
│ ├── database_conv/
│ │ ├── kale_dictionary.db # SQLite database (source of truth)
│ │ ├── create_kale_dictionary.py # Build DB from JSON letter files
│ │ └── verify_db.py # Inspect DB tables & sample data
│ ├── jsons/ # Raw a.json–z.json letter files
│ ├── resources/ # cultural_notes.json, topics.json
│ └── tools/
│ ├── audit_dictionary.py # Audit JSON files for indexing errors
│ ├── compare_words.py # Diff index.json vs new_words.json
│ ├── create_index.py # Flatten all letter files → index.json
│ └── verify_comparison.py # Spot-check comparison output
├── src/
│ ├── app.js # Request dispatcher (routing table)
│ ├── db.js # SQLite singleton (bun:sqlite)
│ ├── helpers.js # json(), paginate(), parsePagination()
│ ├── server.js # Bun.serve() entry point
│ └── routes/
│ ├── words.js # /api/words, /api/words/:id, /api/words/random
│ ├── search.js # /api/search
│ ├── topics.js # /api/topics, /api/topics/:id/words
│ ├── dialects.js # /api/dialects, /api/dialects/:id/words
│ └── metadata.js # /api/metadata, /api/metadata/letters
├── tests/
│ ├── helpers.js # startServer() / stopServer() for tests
│ ├── words.test.js
│ ├── search.test.js
│ ├── topics.test.js
│ ├── dialects.test.js
│ └── metadata.test.js
└── package.json
```
## Prerequisites
- **Bun ≥ 1.0** — install with `curl -fsSL
bun.sh | bash`
No other dependencie …