- Pitch
- Balqalam
- Live Demo
- MVP
- Roadmap
- Launch Sprint
- PRD
- Marketing Brief
- Sales
- Go-to-market
- Marketing
- Product Truth
- Audience & Markets
- Offer & Funnel
- Claim Registry
- Content System
- Channels & Calendar
- 90-Day Plan
- Workflow & Templates
- Measurement
- Growth Editor Agent
- Admission — Feature Spotlight
- Pilot Program
- Leads
- Proposal
- Outreach Templates
- Case Study
- Competitors
- Landing-page teardown
- Competitor FAQ
- Business model
- Shared economy
- Traction
- Get Support
- Investor Deck
- Data Room
- Investors
- Accelerators
- Incubators
- Grants
- Sponsors
- Partners
- Competitions & Hackathons
- Universities & Training Centers
Balqalam is an open-source, multi-tenant K-12 school platform.
| Attribute | Value |
|---|---|
| Repo | github.com/databayt/hogwarts |
| Live | balqalam.com |
| Docs | balqalam.com/docs |
| License | SSPL-1.0 |
| Default locale | Arabic (RTL) |
| Type | SaaS B2B multi-tenant web app |
| Domain | EdTech — K-12 school management |
For shipped capabilities see MVP. For direction see Roadmap. For the commercial layer see Business model. The current commercial focus is the MENA-10 free pilot cohort; pipeline operations live in Leads.
Architecture
Stack
| Layer | Choice |
|---|---|
| Framework | Next.js 16.2.x (App Router) |
| Runtime | React 19.2.x |
| Language | TypeScript 5.x (strict) |
| ORM | Prisma 6.19.x (multi-file schema) |
| Database | PostgreSQL on Neon |
| Auth | NextAuth 5.0.0-beta.30 |
| Authorization | CASL 6.x |
| Styles | Tailwind CSS 4.x (PostCSS) |
| UI primitives | shadcn/ui (Radix) |
| Payments | Stripe + bankak + tap + cash + mobile-money + bank-transfer |
| Banking | Plaid + Dwolla |
| Email / SMS / WhatsApp | Resend, Twilio, WhatsApp Evolution API |
| Storage | AWS S3 + CloudFront (cdn.databayt.org) |
| Cache | Upstash Redis |
| Realtime | Socket.io (custom Node server) |
| Observability | Sentry 10.x |
| Docs | fumadocs (MDX) 16.x |
| AI | Anthropic + OpenAI + Groq via Vercel AI SDK |
Surface area
For canonical counts of models, routes, dashboard pages, and tests, see MVP and Architecture.
Tenancy
Subdomain-based multi-tenancy resolved at the edge.
Production: school.balqalam.com → /[lang]/s/school/...
Pilot tenant: kingfahd.balqalam.com → /[lang]/s/kingfahad/...
Preview: tenant---branch.vercel.app → /[lang]/s/tenant/...
Development: subdomain.localhost:3000 → /[lang]/s/subdomain/...
Custom: www.theirschool.com (CNAME) → Balqalam platformResolution flow:
- Edge
proxy.tsextracts subdomain from host. - Custom domains → canonical subdomain via Upstash Redis (
custom-domain:${host}). - Internal rewrite to
/[lang]/s/[subdomain]/...—/s/[subdomain]is internal only, never used inredirect()/Link href/router.push. x-subdomainheader set for downstream handlers.getTenantContext()reads it and resolvesschoolIdfor every Prisma query.
Single-language storage
Balqalam does not use bilingual columns. All content is stored in the school's chosen language with a lang field. Reads in another language go through Google Translate, cached in Translation. UI strings live in dictionaries (src/components/internationalization/dictionaries/); getText() (@/components/translation/display) is the canonical accessor.
Roles
Eight roles in prisma/models/auth.prisma:UserRole (DEVELOPER, ADMIN, TEACHER, STUDENT, GUARDIAN, ACCOUNTANT, STAFF, USER). Authorization via CASL abilities (@/lib/abilities) and route-level role gates. Full role surface and permissions in Authorization.
Functional scope
The 14-epic shipped state is in MVP. Next + Vision in Roadmap. Detail docs per epic live alongside in content/docs-en/. Block-level CLAUDE.md (src/components/<feature>/CLAUDE.md) documents per-feature implementation contracts.
A school can: accept applicants → register students → manage classes / sections / subjects / timetable → mark attendance (11 capture modes) → grade exams + generate report cards → collect fees (6 payment gateways) → message parents (in-app + email + WhatsApp) → run an LMS → manage library + transport. All on one platform with schoolId-scoped isolation.
Non-functional requirements
Performance
| Metric | Target |
|---|---|
| Initial page load (3G) | < 2s |
| Subsequent navigation | < 500ms |
| API response (P95) | < 500ms |
| Database queries (P95) | < 100ms |
| TTFB | < 200ms via edge |
| Lighthouse | ≥ 90 |
Security
- AES-256 at rest, TLS 1.3 in transit.
- Bcrypt (cost 12) passwords; JWT sessions; 2FA via
TwoFactorToken+TwoFactorConfirmation. - Brute-force protection via
LoginAttemptaudit + rate limits. - RBAC on every route; multi-tenant isolation enforced server-side.
- Zod validation server-side; SQL-injection and XSS prevention.
AuditLogretention with structured event types for sensitive mutations.- 11 daily cron jobs for housekeeping.
Scalability
- Prisma connection pooling on Neon serverless PostgreSQL.
- Vercel serverless, stateless functions; aggressive
outputFileTracingExcludesto stay under 300 MB. - S3 + CloudFront for asset delivery.
experimental.serverActions.bodySizeLimit: "10mb"for uploads.
Accessibility
- WCAG 2.1 AA targeted.
- Keyboard nav, screen-reader support, color contrast ≥ 4.5:1.
- Logical CSS properties — no
ml-*/mr-*. RTL works without overrides. - Semantic HTML — no hardcoded
text-*/font-*Tailwind classes.
Compliance
| Regulation | Scope |
|---|---|
| FERPA | US student privacy |
| GDPR | EU data protection |
| COPPA | Parental consent under 13 |
| WCAG 2.1 AA | Accessibility |
Constraints
These rules apply to every contribution. Enforced by hooks, agents, and review gates.
- License — SSPL-1.0. Self-host free. Reselling Balqalam as a hosted service requires a commercial license.
- Multi-tenant safety. Every Prisma query includes
schoolId(or the model is global and explicitly opts out). Isolation tests intests/multi-tenant/. - Single-language storage. Never bilingual columns; one
langfield per row. - Logical CSS only.
ms-*/me-*/ps-*/pe-*— neverml-*/mr-*/pl-*/pr-*. - No raw HTML primitives in components. Use shadcn
ui/. No raw<button>/<input>/<select>in feature code. - Mirror pattern. Routes import from
src/components/<feature>/content.tsx. Canonical filenames per feature:content.tsx,actions.ts,queries.ts,authorization.ts,validation.ts,form.tsx,table.tsx,columns.tsx. - One central
.env. Never.env.local,.env.development, etc. - Port 3000 in dev — always.
pnpm tsc --noEmitbefore any build. Vercel build hastypescript.ignoreBuildErrors: trueto avoid OOM, so type-check is a separate gate.- Internal rewrite safety.
/s/[subdomain]is internal-only. UI uses clean tenant-relative paths. - All UI text via dictionary keys. No hardcoded English or Arabic strings in components.
Subscription tiers
| Tier | Limits |
|---|---|
| FREE | 100 students, 1 GB storage, community support |
| PRO | 10 GB, priority support, custom branding, API rate-limited |
| ENTERPRISE | Unlimited storage and API, white-label, SLA 99.9%, SSO |
See Business model for pricing and revenue. See Sales for commercial process.
API and integrations
REST API v1
- OpenAPI 3.0 contract.
- API key auth with tiered rate limiting.
- Webhook events:
student.enrolled,payment.received,grade.updated(full log inwebhooks.prisma:ProcessedWebhookEvent). - HMAC-SHA256 request signing; retry with exponential backoff.
SSO (Enterprise)
- SAML 2.0 — Okta, Azure AD, OneLogin.
- OAuth 2.0 — Google Workspace, Microsoft 365.
- SCIM for user provisioning.
Third-party connections (built or wired)
Stripe + bankak + tap + mobile-money + bank-transfer + cash, Plaid + Dwolla, Resend, Twilio, WhatsApp Evolution API, Google Translate, AWS S3 + CloudFront, Upstash Redis, Sentry, Mapbox + Leaflet, Anthropic + OpenAI + Groq.
Design system
| Aspect | Spec |
|---|---|
| Arabic font | Rubik |
| English font | GeistSans |
| Colors | OKLCH — blue primary, amber secondary |
| Components | shadcn/ui (Radix primitives) |
| Theme | Dark / light via next-themes |
| Charts | Recharts + Chart.js |
| Tables | TanStack Table |
Internationalization
| Feature | Implementation |
|---|---|
| Locales | ar (default, RTL) + en (LTR) |
| URL pattern | /[lang]/path → /ar/docs, /en/docs |
| Dictionaries | src/components/internationalization/dictionaries/ — EN + AR pairs across 8 top-level + 16 per-domain files |
| RTL | Bidirectional layouts via logical properties + <DirectionProvider> |
| Storage | Single lang field + on-demand Google Translate cached in Translation |
See Translation for the full dictionary contract.
Development approach
- 1-week sprint cadence.
- Conventional commits, signed.
- Code review with at least one approver before merge to
main. - 80%+ coverage target on critical paths.
- Performance budgets (Lighthouse ≥ 90).
- 20% of sprint capacity reserved for tech debt.
Testing pyramid
| Layer | Share | Tool |
|---|---|---|
| Unit | 70% | Vitest |
| Integration | 20% | Vitest + Supertest |
| E2E | 10% | Playwright (auth, multi-tenant, RBAC, smoke) |
Local DB workflow
Destructive Prisma operations (db execute, db push --accept-data-loss, migrate reset, DROP TABLE, TRUNCATE) are blocked by hooks. Use the Branch-Before-Touch protocol on Neon for risky DB ops. Never run pnpm db:seed directly — always pnpm db:seed:single <name>.
How to contribute
- Read Get started for the local setup.
- Skim Architecture and Pattern for conventions.
- Pick a Roadmap "Next" item or open a feature issue.
- Follow the mirror pattern + the constraints above.
- The Claude harness in
.claude/(50 agents, 47 commands, 16 skills) is wired to enforce most rules automatically —pnpm devplus the project'sCLAUDE.mdis enough.
The OSS contribution model — including how time invested converts to recognition or revenue share — lives in Shared economy.
AGENTS.md is currently
AGENTS.md.draftat the repo root; graduating it toAGENTS.mdis tracked in Roadmap.
See also
- Pilot — MENA-10 free pilot cohort (current commercial focus)
- GTM — three-phase go-to-market
- Sales — B2B process
- Leads — pipeline operations
- MVP — 14-epic shipped state with maturity badges
- Roadmap — Next milestones and Vision
- Architecture — system design and patterns
- Pattern — code conventions
- Translation — i18n contract
- Shared economy — OSS contribution and value-sharing
- Business model — pricing, tiers, ARR projections
- Get started — local setup
On This Page
ArchitectureStackSurface areaTenancySingle-language storageRolesFunctional scopeNon-functional requirementsPerformanceSecurityScalabilityAccessibilityComplianceConstraintsSubscription tiersAPI and integrationsREST API v1SSO (Enterprise)Third-party connections (built or wired)Design systemInternationalizationDevelopment approachTesting pyramidLocal DB workflowHow to contributeSee also