AIMS / System Architecture
Live 5 repos · K8s + ArgoCD
Architecture Reference

AIMS System Architecture

AIMS (Africa Information Management System) is a multi-tenant SaaS school management platform. Each school gets an isolated environment with its own subdomain, database, and Kubernetes namespace.

Platform: aimsgo.com
5 Repositories
Next.js + Django + PostgreSQL
Kubernetes / ArgoCD
5
Repositories
15+
Django Modules
Tenants
3
Core Services
GitOps
Deployment
🏛️

aims-core

Central platform — marketing site, school signup, super-admin dashboard. Entry point for all new tenants.

aimsgo.com
🏫

aims (tenant)

Per-school dashboard with 15+ feature modules. Each school runs its own isolated instance.

{school}.aimsgo.com
🛡️

admindash

Internal platform admin — KPIs, analytics, school management and user monitoring.

aimsgo.com/admindash
🧩

aims-apps

Shared standalone HTML apps and brand assets. Synced into aims and aims-core at build time. Includes calendar, template editor, finance, HR manager, guardian portal, and more.

⚙️

aimsgo-argocd-apps

GitOps repository. All Kubernetes and ArgoCD configuration lives here. ArgoCD watches this repo and auto-deploys all changes to the cluster.


2
Repository Structure

Each subdirectory is an independent Git repository. The workspace folder is a parent directory containing all repos but is not itself a Git repo.

DirectoryGitHub (current)GitLab (target)Purpose
aims/africaone-dev/aimsaims/tenantTenant dashboard (Next.js + Django)
aims-core/africaone-dev/aims-coreaims/coreCentral platform (Next.js + Django)
aims-apps/africaone-dev/aims-appsaims/appsShared HTML apps + brand assets
admindash/africaone-dev/admindashaims/adminPlatform admin (Django)
aimsgo-argocd-apps/africaone-dev/aimsgo-argocd-appsaims/infraK8s/ArgoCD GitOps config

3
Services & Components

aims-core — Central Platform

Frontend (Next.js)

Marketing landing page, school signup wizard, super-admin dashboard. Runs on port 3000.

Next.js 14TypeScriptTailwind

Backend (Django)

Core API: tenant management, OTP auth, school registry. Triggers tenant deployment via GitHub Actions.

Django 5DRFPostgreSQL

aims — Tenant Dashboard Modules

ModuleDescription
studentsStudent profiles, enrollment, records
admissionsAdmissions pipeline and applications
attendanceDaily/class attendance tracking
feesFee structures, invoicing, payments
examsExam scheduling, results, grading
timetableClass scheduling and timetable management
hrStaff HR, payroll, leave management
libraryBook catalog, borrowing, returns
subjectsSubjects, classes, streams
clubsStudent clubs and activities
meal_plansCafeteria / meal planning
reportsAnalytics and report generation
health_wellnessStudent health records (clinic)
notificationsIn-app and email notifications
auditAudit log for all sensitive actions

aims-apps — External Apps

AppTypeDescription
brand-assets/CSS/JSShared theme, fonts, logos
calendar-app/HTML AppSchool calendar interface
template-editor/HTML AppDocument/report template designer
finance-app/HTML AppFee & finance standalone surface
hr-manager/HTML AppHR management standalone surface
guardian-portal/HTML AppParent/guardian-facing portal
admissions-portal/HTML AppAdmissions portal (external-facing)
comms-hub/HTML AppCommunications hub
clinic/HTML AppHealth/wellness clinic app
library/HTML AppLibrary standalone app

4
Tech Stack

Frontend

LayerTechnology
FrameworkNext.js 14.2.18
LanguageTypeScript, React 18
StylingTailwind CSS 3.4, SASS
UI ComponentsRadix UI, Lucide React
Rich TextTipTap
ChartsApexCharts, Recharts
AnimationFramer Motion
ExportjsPDF, html2canvas
RuntimeNode.js 20 (Alpine)

Backend

LayerTechnology
FrameworkDjango 5.0+
REST APIDjango REST Framework 3.14
LanguagePython 3.11+
Pkg Manageruv
AuthSession cookies + SimpleJWT
Storageboto3 + django-storages
File ProcessingPillow, openpyxl, pdfplumber
ServerGunicorn

Infrastructure

ComponentTechnology
OrchestrationKubernetes
GitOpsArgoCD (App of Apps pattern)
IngressTraefik
TLScert-manager + Let's Encrypt
Config ManagementHelm 3
DB PoolingPgBouncer
Secret ReplicationReflector
Image RegistryGHCR → migrating to GitLab Registry
CI/CDGitHub Actions → migrating to GitLab CI

5
Database Architecture

Hybrid multi-tenancy: a shared core database for platform-wide data and isolated per-tenant databases for each school's data.

Core Database — aimsgodb

Shared across the entire platform. Contains schools registry, platform user accounts, authentication sessions, newsletter subscriptions, and deployment status per tenant.

Per-Tenant Database — {tenant}_db

One database per school. Contains all school-specific data: students, staff, fees, exams, attendance, timetables, library records, and all module data.

A custom Django database backend (core.db_backend) enforces Row-Level Security, preventing any query from crossing tenant boundaries. PgBouncer runs in the database namespace to pool connections.


6
Infrastructure & Deployment

Kubernetes Namespace Layout

Cluster Layout
Cluster
├── argocd/           — ArgoCD control plane
├── database/         — PostgreSQL + PgBouncer
├── aims-core/        — Central platform (frontend + backend)
├── {tenant-name}/    — One namespace per school
│   ├── frontend deployment
│   ├── backend deployment
│   └── ingress → {tenant}.aimsgo.com
└── ...               — More tenant namespaces

ArgoCD — App of Apps Pattern

root-app.yaml bootstraps everything └── apps/applicationset.yaml ├── aims-core.yaml helm-aims-core/values.yaml └── ApplicationSet helm-template/tenants/ ├── tenant-alpha/values.yaml ├── tenant-beta/values.yaml └── tenant-gamma/values.yaml

Tenant Provisioning Flow

1. School signs up aimsgo.com 2. aims-core creates school record in aimsgodb 3. aims-core dispatches GitHub Actions workflow action=create-tenant, tenant_name={subdomain} 4. Workflow creates helm-template/tenants/{name}/values.yaml commits to aimsgo-argocd-apps repo 5. ArgoCD detects commit deploys new K8s namespace 6. Tenant backend init POST /api/auth/tenant-bootstrap-ready/ 7. aims-core marks school deployment_ready=true 8. User redirects to {tenant}.aimsgo.com/login

Secrets Management

SecretNamespaceNotes
postgres-credentialsPer namespaceDB username/password
django-secretPer namespaceDjango SECRET_KEY
object-storage-credentialsaims-coreReflector mirrors to all namespaces
resend-api-keyaims-coreOTP email sending
github-actions-tokenaims-coreTenant provisioning trigger
tenant-bootstrap-secretAll namespacesShared between core and tenant backends

7
Key Flows

User Request Flow

Browser {tenant}.aimsgo.com └── Traefik Ingress ├── / Next.js Frontend :3000 Serves HTML/JS/CSS API calls to /api └── /api Django Backend :8000 Validates session cookie Reads/writes to tenant DB Returns JSON response

aims-apps Sync Flow

aims-apps/ (separate repo) ├── npm run sync (or automatic via predev hook) ├── aims/frontend/public/ /calendar-app/ /template-editor/ /brand-assets/ └── aims-core/frontend/public/ /user-guide/ /brand-assets/

8
External Integrations
ServicePurposeUsed by
ResendOTP email delivery for authaims-core backend
GitHub Actions APITrigger tenant provisioning workflowaims-core backend
Hetzner Object StorageMedia file storage (S3-compatible)aims + aims-core backends
GHCRDocker image storageAll services (migrating to GitLab)
Let's EncryptAutomatic TLS certificates via ACMEcert-manager

9
Environment Configuration

aims-core backend

VariablePurpose
DB_*Core DB connection
SECRET_KEYDjango secret key
TENANT_BOOTSTRAP_SECRETShared with tenant backends
GITHUB_TOKENTriggers provisioning
RESEND_API_KEYOTP emails
OBJECT_STORAGE_*Hetzner S3 credentials
ADMIN_API_KEYAdmin API auth

aims backend (per tenant)

VariablePurpose
CORE_DB_*Connection to aimsgodb
TENANT_DB_NAMEThis tenant's database
TENANT_BOOTSTRAP_SECRETShared with aims-core
CORE_BOOTSTRAP_READY_URLCallback URL after init
TENANT_SUBDOMAINSchool subdomain
TENANT_SCHOOL_IDSchool ID from core DB
USE_REMOTE_MEDIAToggle local vs S3