# Somali AI Learning Tutor
A Somali-friendly educational web platform where students learn **Physics**, **Biology**, **English**, **Chemistry**, and **Mathematics** through structured lessons, practice exercises, an AI tutor, and progress tracking.
**Learning cycle:** Learn → Practice → Ask AI → Improve → Track → Complete
## Stack
- **Frontend:** React + Vite + TypeScript + Tailwind CSS
- **Backend:** Node.js + Express
- **Database:** SQLite (Better SQLite3)
- **Auth:** JWT + bcrypt (roles: `ADMIN`, `STUDENT`)
- **AI:** Google AI Studio (Gemini) via `@google/genai`, with a built-in Somali tutor fallback
## Quick start
```bash
# From repo root
npm install
npm install --prefix server
npm install --prefix client
npm run dev
```
- App:
127.0.0.1
- API:
127.0.0.1
### Faster loading (cached production mode)
For the fastest startup and repeat visits, build once and serve everything from one port with browser + server caching:
```bash
npm run start:fast
```
Then open **
http://127.0.0.1:3847** (API + cached frontend on the same port).
What this enables:
- **PWA service worker** caches JS/CSS/fonts in the browser
- **Gzip compression** on API responses
- **Memory cache** on course list API (`X-Cache: HIT` header)
- **Lazy-loaded pages** so the first screen loads smaller bundles
## Demo accounts
| Role | Email | Password |
|---------|-------------------------|--------------|
| Student | `ahmed@student.so` | `password123`|
| Admin | `admin@somalilearn.so` | `password123`|
## Subjects (seed data)
- Physics Basics
- Biology Basics
- English Basics
- Chemistry Basics
- Mathematics Basics
Each course includes modules, lessons (with Somali explanations), and exercises.
## Features
### Student
- Register / login
- Dashboard with Continue Learning
- Browse courses & curriculum
- W3Schools-inspired lesson layout (curriculum · content · AI panel)
- Mark lessons complete
- Exercises with instant feedback, hints, …