All Projects
Beta2025AI/ML · SaaS · Education

VarsityOS

The AI University Companion for SA Students Facing a 50%+ Dropout Rate

Multi-agent AI platform built to address South Africa's university dropout crisis. Six specialist Claude agents cover study coaching, budget management, meal planning, wellness monitoring, registration guidance, and crisis detection — with SADAG + Lifeline SA helplines surfaced automatically.

Serving

1M+ SA university students

Market

50%+ dropout rate addressed

Problem

Zero AI support at the critical moment

Result

6 AI agents live, crisis detection active

The Problem

What needed solving

50%+ of South African university students drop out — not because they fail academically, but because they fail at navigation. No money for accommodation. No idea how to manage NSFAS. No mental health support at 2am when the spiral begins.

The Solution

How I built it

A PWA with six specialist Claude AI agents (Study Coach, Budget Manager, Meal Planner, Wellness Monitor, Registration Guide, Crisis Detector) sharing a Supabase session store. Crisis detection surfaces SADAG and Lifeline SA helplines immediately. Offline-capable for SA mobile data realities.

Build Journey

VarsityOS was built around a single question: what does a first-generation SA university student actually need to survive and thrive? Not a generic student planner. Not a ChatGPT wrapper. Infrastructure — NSFAS budgeting, load-shedding study strategies, crisis support, part-time work balancing, all with 11-language awareness, woven together with an AI companion named Nova. The 15-table Supabase schema (profiles, budgets, expenses, tasks, modules, exams, meals, shifts, wellness entries) was built with full RLS from day one. 14 strategic indexes. Auto-triggers for profile creation, updated_at, and task completion timestamps. The database layer carries the complexity so the AI layer can stay focused. Nova's breakthrough was prompt caching on the knowledge base. The system prompt is ~5,000 lines of SA-specific context: 25+ universities, NSFAS rules and appeal processes, SADAG mental health resources, load-shedding study strategies, student finance. This entire block is cached by Anthropic's server — after the first call, cache reads cost ~90% less per token. Nova's real cost is in the dynamic block: each student's actual budget, tasks, exams, and mood score injected per request. Crisis detection is a product ethics decision as much as an engineering one. When a student message matches distress signals, the system does not send a chatbot reply. It surfaces SADAG and Lifeline SA helplines first, then wraps any response in human-connection framing rather than advice.

Nova AI — prompt caching + crisis detection pattern
typescript
// Nova AI — cached knowledge base + dynamic student context injection
// ~5000-token system prompt cached; only per-student context charged at full rate

export async function callNova(message: string, student: StudentContext) {
  const response = await anthropic.messages.create({
    model: 'claude-sonnet-4-6',
    system: [
      {
        type: 'text',
        text: NOVA_SA_KNOWLEDGE_BASE, // ~5000 lines — SA universities, NSFAS, SADAG, etc.
        cache_control: { type: 'ephemeral' }, // Anthropic caches this block server-side
      },
    ],
    messages: [
      {
        role: 'user',
        content: `Student context:
Budget remaining: R${student.nsfas_balance}
Upcoming exams: ${student.exams.slice(0,3).map(e => `${e.module} in ${e.days_away}d`).join(', ')}
Wellness score (today): ${student.mood_score}/5
Module averages: ${student.academic_summary}

Message: ${message}`,
      }
    ],
    max_tokens: 1024,
  });

  const text = response.content[0].text;

  // Crisis detection — surface helplines before any response
  if (isCrisisSignal(message)) {
    return `SADAG: 0800 567 567 (24h) | Lifeline SA: 0861 322 322

${formatCrisisResponse(text)}`;
  }

  return text;
}

What This Taught Me

  1. 1

    SA university context (NSFAS, SADAG, load-shedding) cannot be retrofitted — it must be the schema, not a feature

  2. 2

    Prompt caching on a 5000-token knowledge base reduces Nova's per-conversation cost by ~90%

  3. 3

    Crisis detection is a product ethics decision: no chatbot reply when a student is in distress — helplines first, always

  4. 4

    Dynamic context injection (real budget, exams, mood) is what separates Nova from a generic AI — the personalisation is in the database, not the model

  5. 5

    PWA offline mode is not optional for SA students on intermittent data — service worker caching is a feature parity requirement

Tech Stack & Decision Rationale
01

Next.js 14

App Router + PWA for offline capability

02

TypeScript

Type-safe agent message contracts

03

Supabase

Shared session store + per-agent context windows

04

Claude API

6 specialist agents with intent routing layer

05

PayFast

ZAR subscription billing for premium tiers

06

PWA

Offline-first for SA students on intermittent data

README.md — campus-compass
📄 README.md
# VarsityOS
> The AI University Companion for SA Students Facing a 50%+ Dropout Rate

## Project Context
**Category:** AI/ML · SaaS · Education
**Status:** Beta · 2025
**Author:** Nandawula Regine Kabali-Kagwa — East London, South Africa
**Company:** Mirembe Muse (Pty) Ltd · Reg: 2026-005658

## Stack
```
Next.js 14                     # App Router + PWA for offline capability
TypeScript                     # Type-safe agent message contracts
Supabase                       # Shared session store + per-agent context windows
Claude API                     # 6 specialist agents with intent routing layer
PayFast                        # ZAR subscription billing for premium tiers
PWA                            # Offline-first for SA students on intermittent data
```

## Architecture Notes
- All data mutations validated server-side via Next.js API routes
- Row-Level Security enforced at database level (Supabase)
- Mobile-first, PWA-ready, offline-tolerant where connectivity is unreliable
- PayFast integration for ZAR-native payments (no USD conversion)
- SEO-optimised: metadata, JSON-LD, canonical URLs, sitemap
- POPIA compliant — data minimisation + user consent by design

## Environment Variables
```env
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
ANTHROPIC_API_KEY=
NEXT_PUBLIC_PAYFAST_MERCHANT_ID=
NEXT_PUBLIC_PAYFAST_MERCHANT_KEY=
PAYFAST_PASSPHRASE=
RESEND_API_KEY=
```

## Links
- Live:   https://campus-compass-phi.vercel.app
- GitHub: Private repository
- Portfolio: https://creativelynanda.co.za/projects/campus-compass

---
Built from East London, South Africa · Nine months · Zero to production

Interested in similar work?

Let's discuss how I can build something like this for your business.

Let's Talk