Architecture¶
Two backends. kwiloai_webapp serves Campus, Classroom and Compliance; kwiloai-b2c serves the consumer Learner product with its own database. Both share the chatbot, eval service, learner memory and the question bank. Clients never talk to a database, AI provider or payment gateway directly.
flowchart TD
subgraph Clients
SITE["Marketing site<br/>kwilo.ai · apps/site"]
WEB["Product app<br/>app.kwilo.ai · apps/web"]
CAMPUS["Kwilo Campus<br/>apps/mobile-b2b"]
LEARN["Kwilo Learn<br/>kwiloai-b2c"]
end
SITE --> WEB
WEB --> API
CAMPUS --> API
LEARN --> B2C
B2C["Consumer API<br/>kwiloai-b2c · own DB"]
B2C --> BOT
B2C --> BANK
B2C --> MEM
API["Backend API<br/>api.kwilo.ai · apps/backend<br/>FastAPI on Azure Container Apps"]
API --> DB[("Azure Postgres<br/>app DB + erp schema")]
API --> MEM[("kwiloai_memory<br/>learner profiles")]
API --> BANK[("knowledge_base_status<br/>question bank, textbooks")]
API --> BOT["Chatbot microservice<br/>all LLM work"]
API --> EVAL["Eval service<br/>solver, heavy jobs"]
API --> EXT["Razorpay · MSG91 · Azure Blob · email"]
Apps and packages¶
| Path | What it is | Hosted |
|---|---|---|
apps/site |
Public marketing site, prerendered HTML for SEO. Deliberately lean: no TanStack Query, Zustand or TipTap. | Cloudflare Pages, kwilo.ai |
apps/web |
Product app for every signed-in role. React 19, Vite, Tailwind 4, TanStack Query, Zustand. | Cloudflare Pages, app.kwilo.ai |
apps/backend |
FastAPI, async SQLAlchemy 2, Alembic. Includes the ERP under src/erp. |
Azure Container Apps, api.kwilo.ai |
apps/mobile-b2b |
Kwilo Campus, In build. Expo, expo-router. | Google Play, via mobile-b2b-play.yml |
MySetu-AI/kwiloai-b2c |
Consumer backend, web and the Kwilo Learn mobile app. Production cutover In build. | Azure Container Apps, Cloudflare Pages |
apps/workers/ph-relay |
Cloudflare Worker relaying PostHog traffic | Cloudflare |
@kwilo/ui, @kwilo/ui-native, @kwilo/core |
Design system, consent, analytics and auth contract. Published from MySetu-AI/kwilo-ui as @mysetu-ai/{web,mobile,core} and installed under the @kwilo/* aliases. |
GitHub Packages |
Rule of placement: anything auth-protected goes in apps/web. Anything public and crawlable goes in apps/site.
Pages¶
| Page | Covers |
|---|---|
| Auth and access | Login, tokens, roles, capabilities, B2C vs institutional identity |
| Data and AI | Databases, the chatbot and eval services, retrieval, the question bank |
| Infrastructure and deployment | Environments, Azure, Cloudflare, secrets, releases |
| Analytics agent | Ask Kwilo isolation walls, tools, config |
| Analytics and error tracking | PostHog events, replay, errors |
| Attribution and UTM | The site → app → backend attribution contract |
| Kwilo Learn app | Builds, env vars, distribution for the consumer Android app |
| App conventions | Each app's AGENTS.md in the code repo |
Principles¶
- Backend is the policy layer. Auth, roles, quotas, entitlements, persistence and AI labelling live in the backend.
- Chatbot is the LLM layer. Prompts, generation, retrieval and token usage live in the chatbot service. The backend holds no generation prompts.
- No heavy compute in the request path. Long jobs like timetable solves go to the eval service through a queue.
- Tenant isolation in the database. ERP tables use forced row-level security keyed on the active institution.