Final Year ProjectOctober 2025 to June 2026
BahasaBot
An AI Malay language learning platform with a retrieval-augmented tutor.
Live demo. The backend sleeps on a free tier, so the first load may take a minute.
Problem
BahasaBot is built for international students at Malaysian public universities. Its primary use case is the mandatory Bahasa Malaysia subject.
Content follows DBP-standardised Malaysian Malay.
System study
The tutor answers through retrieval. A learner's question becomes a 768-dimension embedding, which finds the matching chunks among the 72 Malay corpus chunks in pgvector. The question and those chunks form the prompt for the Google Gemini API, and the reply streams back over Server-Sent Events.
The store holds each corpus chunk with its gemini-embedding-001 embedding, L2-normalised. The chunks nearest the question's embedding are the ones retrieved.
What was built
A RAG chatbot tutor built with LangChain over a pgvector store of 72 Malay corpus chunks with 768-dimension embeddings. Replies stream over Server-Sent Events, with session memory and automatic vocabulary and grammar extraction.
A course generator that turns any topic into modules, classes and quizzes through concurrent Gemini calls.
An adaptive quiz engine that personalises questions from tracked weak points and recalculates the learner's level on the BahasaBot Proficiency Scale (BPS-1 to BPS-4) from the last three attempts.
Learning roadmaps of 4 to 18 milestones, and pronunciation playback.
XP, daily streaks, a weekly leaderboard and two word games with Leitner-weighted word selection.
An admin panel with per-user activity tracking, a token-usage dashboard and CSV export.
Security through bcrypt, JWT access and refresh tokens, Google OAuth, Redis rate limiting and Sentry monitoring.
Architecture
- Frontend
- Next.js 14 with Tailwind CSS, shadcn/ui and Framer Motion, on Vercel. NextAuth v5 handles sign-in with silent token refresh.
- Backend
- FastAPI on Python 3.12, on Render.
- Data
- PostgreSQL 15 with pgvector on Neon, in a 23-table schema managed with SQLAlchemy and Alembic. Redis backs rate limiting.
- Retrieval
- pgvector stores gemini-embedding-001 embeddings at 768 dimensions with L2 normalisation. LangChain retrieves matching corpus chunks for the tutor.
- Streaming
- Replies stream over Server-Sent Events.
- Course generation
- Modules generate concurrently through asyncio.gather with Semaphore(2).
- Authentication
- Dual JWT, with a 15-minute access token and a 7-day refresh token, plus bcrypt and Google OAuth.
Key decisions
Server-Sent Events over WebSocket for streaming replies.
Rule-based proficiency scoring over AI assessment.
Course deduplication by template cloning. A repeat course is cloned from a template, not generated again.
Prompt separation and RAG grounding against dialect drift. Generated courses slipped into Indonesian Malay phrasing because the prompt did not separate the instruction language from the taught language. The fix separated the two and grounded generation on a curated Malaysian Malay corpus.
Token usage logged for every model call, by user and feature.
Built with Claude Code from a phased plan, governed by CLAUDE.md, PHASES.md and STATUS.md.
Evidence
Silver Award, PIXEL 2026, the final-year project showcase of the USM School of Computer Sciences, 20 June 2026.
A repeat course takes about 280 milliseconds and zero tokens, down from about 78 seconds and 21,300 tokens.
Streaming load test with 10 concurrent users: median time to first token 3.6 s, 95th percentile 5.1 s, against a 3.2 s single-user baseline.
46 documented functional test cases with a defect register and integration testing. All 46 passed after defect correction.
8 cross-feature integration scenarios. 9 latency endpoints measured, 7 met target. More than 100 test cases executed in total.
Evaluated with 30 users through an in-app rating: average 4.3 out of 5.
Projected running cost of about USD 0.11 per active user per month, from logged token usage.
A solo Agile Scrum delivery over 27 sprints and 76 recorded development sessions.
Screenshots
Technology
- Next.js 14
- FastAPI (Python 3.12)
- LangChain
- Google Gemini API
- PostgreSQL 15 with pgvector on Neon
- Redis
- NextAuth v5
- SQLAlchemy
- Alembic
- Tailwind CSS
- shadcn/ui
- Framer Motion
- Sentry
- Resend
Deployed on Vercel and Render.
Limitations and status
The backend sleeps on a free tier when idle, so the first load of the live demo may take a minute.
The figure of USD 0.11 per active user per month is a projection.


