Inside UniUI: the code and architecture behind a study platform for Nigerian universities

Inside UniUI: the code and architecture behind a study platform for Nigerian universities

●1 ●8 ●29
calendar_today • schedule20 min read

I'm a student at the Federal University of Technology, Owerri (FUTO). Over the last five months I've built UniUI, a platform where a Nigerian university student uploads their whole semester (courses, notes, past questions, deadlines, groups) and gets help running it. It's live at FUTO with 152 students and launches publicly in 50 days.

This post is the engineering tour: the data model, the two content pipelines, retrieval, the wallet, the agents that watch the platform, and the offline sync design, with the mistakes I made along the way.

A note on the code. Everything below is simplified and illustrative. I've kept real names where they're real (table names, tools, numbers) and removed secrets, edge cases and anything that would just add noise. Treat the snippets as sketches of the design, not copy-paste production code.


What's in it

  • 2,000+ API routes and 237 database tables across 5 schemas
  • 4,936 courses, 64,747 content chunks, 11,128 retrieval sections
  • 11,071 structured study notes, 21,607 past questions, 3,708 formulas
  • A 10-stage upload pipeline and a 6-stage content pipeline
  • 7 operations agents running as containers
  • 20+ containers on one Oracle Cloud VPS with 7.8GB of RAM
Layer What I use
Web Next.js 15 (App Router), TypeScript, Tailwind, shadcn/ui, TanStack Query, Zustand, react-hook-form with zod
Mobile React Native with Expo and Expo Router, SQLCipher for encrypted on-device storage
API Python 3.12, FastAPI, Pydantic v2, asyncpg, SQLAlchemy, Alembic, Celery
Data PostgreSQL 18 with pgvector, pg_cron, pg_trgm and pgcrypto; Supabase for identity; Redis; MinIO; MeiliSearch
AI Voyage AI embeddings, OpenAI models in three tiers, Whisper, Tesseract, FFmpeg
Payments A primary provider with Paystack and Monnify as fallbacks, NIBSS for bank transfers
Ops Docker Compose, Caddy, Cloudflare, Sentry, Prometheus, Grafana, Loki, UptimeRobot

The shape of the system

Next.js web / React Native app
          |
        Caddy (TLS, routing)
          |
        FastAPI --- Pydantic validation on every request and response
          |
   +------+-----------------------------+
   |                                    |
 Postgres + pgvector              Celery workers
 Redis / MinIO / MeiliSearch      (uploads, notifications, batch jobs)
   |
 AI orchestrator -> Voyage embeddings + OpenAI tiers

Jarvis guardians -> core -> policy engine (OPA) -> audit ledger
(watching all of the above)

The rule I try to follow is that nothing crosses a boundary without a type. On the web that's TypeScript and zod. On the API it's Pydantic on every request, response and state object. That matters more than it sounds once agents are writing a lot of the code.


Data model first

Most of my early mistakes were data mistakes.

A course code doesn't identify a course. MTH 101 at one university isn't MTH 101 at another, so courses are unique per institution, not globally:

CREATE TABLE courses (
  id             bigserial PRIMARY KEY,
  institution_id bigint   NOT NULL,
  code           text     NOT NULL,   -- e.g. 'MTH201'
  title          text     NOT NULL,
  level          smallint,
  UNIQUE (institution_id, code)
);

Raw material becomes chunks. Chunks get grouped into retrieval_sections, and those are what the AI actually searches:

CREATE TABLE chunks (
  id          bigserial PRIMARY KEY,
  course_id   bigint REFERENCES courses(id),
  source_id   bigint NOT NULL,           -- the upload or document it came from
  ord         int    NOT NULL,
  body        text   NOT NULL,
  embedding   vector(1024),              -- null until embedded
  quarantined boolean NOT NULL DEFAULT false
);

CREATE TABLE retrieval_sections (
  id         bigserial PRIMARY KEY,
  course_id  bigint NOT NULL REFERENCES courses(id),
  topic      text,
  body       text   NOT NULL,
  source_ids bigint[] NOT NULL,          -- provenance: which sources fed this section
  embedding  vector(1024) NOT NULL
);

CREATE INDEX ON retrieval_sections USING hnsw (embedding vector_cosine_ops);
CREATE INDEX ON retrieval_sections (course_id);

Two details do real work here.

Provenance. Every chunk knows its course and source, and every section keeps the list of sources it was built from. The product promise is that an answer comes from your course. If I can't prove where a chunk came from, I can't keep that promise.

Only some things are embedded. Of the 64,747 raw chunks, about 15% are embedded. All 11,128 retrieval sections are. You embed what you search, and you search the curated layer.

The other data mistake was leaving structured LLM output in JSONB, which is quick to create and painful to query. I now normalise on write, and migrate old data like this:

CREATE TABLE section_topics (
  section_id bigint NOT NULL,
  topic      text   NOT NULL,
  difficulty smallint,
  PRIMARY KEY (section_id, topic)
);

INSERT INTO section_topics (section_id, topic, difficulty)
SELECT e.section_id, t->>'topic', (t->>'difficulty')::smallint
FROM section_enrichment e,
     jsonb_array_elements(e.payload->'topics') AS t
ON CONFLICT DO NOTHING;

JSONB is a fine place to land data and a bad place to leave it.


The upload pipeline (10 stages)

Students upload photos of notes, PDFs, and lecture recordings. Before any of it touches the corpus it goes through ten stages: client-side validation, chunked upload, virus scan, text extraction, classification, deduplication, quality scoring, course rep review, enrichment, and attribution.

Each stage is a Celery task, and the design rule that saved me the most pain is that every stage must be safe to run twice. Workers die, tasks retry, and an upload shouldn't be processed twice because a container restarted.

@shared_task(bind=True, acks_late=True,
             autoretry_for=(TransientError,), retry_backoff=True, max_retries=5)
def stage_extract(self, job_id: int) -> int:
    job = jobs.get(job_id)
    if job.stage_done('extract'):          # idempotent: a retry is a no-op
        return job_id
    text = EXTRACTORS[job.mime_type](job.object_key)   # pdf, image, audio, video
    jobs.save_stage(job_id, 'extract', output=text)
    return job_id

def start_pipeline(job_id: int) -> None:
    chain(stage_scan.s(job_id), stage_extract.s(), stage_classify.s(),
          stage_dedupe.s(), stage_score.s(), stage_route_review.s(),
          stage_enrich.s(), stage_attribute.s()).apply_async()

The upload_jobs table records every job, stage and error, so when a student says their upload vanished I can answer in one query. Extraction is mostly well-worn tools: pdftotext for PDFs, Tesseract for images, FFmpeg then Whisper for audio and video.

Deduplication

This matters in Nigeria in a way it might not elsewhere. The same past questions get forwarded across WhatsApp groups for years, re-photographed, re-typed, with a page missing. Exact hashes catch the lazy copies. MinHash catches the near-duplicates:

from datasketch import MinHash, MinHashLSH

def minhash(text: str, k: int = 5, num_perm: int = 128) -> MinHash:
    words = text.lower().split()
    m = MinHash(num_perm=num_perm)
    for i in range(len(words) - k + 1):
        m.update(' '.join(words[i:i + k]).encode())
    return m

lsh = MinHashLSH(threshold=0.85, num_perm=128)

def is_duplicate(job_id: str, text: str) -> bool:
    m = minhash(text)
    if lsh.query(m):          # something at least 85% similar already exists
        return True
    lsh.insert(job_id, m)
    return False

Quality scoring and human review

Every upload gets a 0 to 100 score on a six-factor rubric (legibility, completeness, course match, structure, originality, language). Routing is the generic part:

AUTO_APPROVE, REJECT_BELOW = 80, 40

def route(score: float) -> str:
    if score >= AUTO_APPROVE:
        return 'enrich'
    if score < REJECT_BELOW:
        return 'reject'
    return 'course_rep_review'     # a human decides

The middle band goes to a course rep, a student in the same course who approves or rejects. That human loop is deliberate: a rep knows when a past question paper is from the wrong year or the wrong lecturer, and a model doesn't.


The content pipeline (6 stages)

Stage Input Output
1. Chunking Source material 64,747 chunks
2. Processing Chunks 11,128 sections
3. Enrichment Sections 11,098 enriched
4. Rich notes Enriched sections 11,071 notes
5. Derived content Rich notes Practice questions, formulas, definitions
6. Indexing Rich notes Search index

The numbers shrink at each step, and that attrition is the quality gate doing its job. Another 1,951 chunks are quarantined entirely. I'd rather lose content than serve bad content.

To run stages over tens of thousands of rows I use the Postgres work-queue trick, FOR UPDATE SKIP LOCKED. Several workers claim batches without stepping on each other and without a separate queue:

WITH batch AS (
  SELECT id FROM chunks
  WHERE embedding IS NULL AND NOT quarantined
  ORDER BY id
  LIMIT 200
  FOR UPDATE SKIP LOCKED
)
SELECT c.id, c.body FROM chunks c JOIN batch USING (id);

Two things I'd flag for anyone doing this. Use input_type='document' when indexing and 'query' when searching, because the embedding model treats them differently. And do the whole claim-embed-write cycle in one transaction per batch, so a crashed worker releases its rows and the next one picks them up.


Retrieval and answers

The retrieval query is course-scoped first and ranked second:

-- pgvector 0.8+: keep scanning the HNSW index until the course filter is satisfied
SET LOCAL hnsw.iterative_scan = relaxed_order;

SELECT id, topic, body, source_ids,
       1 - (embedding <=> $1::vector) AS similarity
FROM retrieval_sections
WHERE course_id = $2
ORDER BY embedding <=> $1::vector
LIMIT 5;

That iterative_scan line is worth knowing. An HNSW index finds nearest neighbours across the whole table, then your WHERE course_id = ... filter throws most of them away, so you can get fewer than five rows back even though plenty exist. Iterative scans keep going until the filter is satisfied.

The orchestration is deliberately boring: embed the question, retrieve, refuse to guess if retrieval is weak, otherwise generate from the retrieved sections only.

class Answer(BaseModel):
    text: str
    sources: list[Source]
    confidence: float = Field(ge=0, le=1)
    grounded: bool          # False when nothing in the course matched well

async def ask(question, student_id, course_id, conn) -> Answer:
    qvec = vo.embed([question], model='voyage-3', input_type='query').embeddings[0]
    rows = await conn.fetch(RETRIEVAL_SQL, str(qvec), course_id)
    if not rows or rows[0]['similarity'] < MIN_SIMILARITY:
        return Answer(text="I couldn't find this in your course materials yet.",
                      sources=[], confidence=0.0, grounded=False)
    context = '\n\n'.join(f"[{r['id']}] {r['body']}" for r in rows)
    text = await llm_answer(model=MODEL_MINI, question=question, context=context)
    ...

The most important line is the early return. A study tool that confidently makes things up is worse than one that says it doesn't know, because a student will carry a wrong answer into an exam.

The Student Graph

Plain retrieval finds relevant paragraphs. What makes "study this, here's why" possible is knowing that this particular student keeps missing questions on one topic. I model that as a graph of 25 node types and 30 edge types (enrolled_in, mastered, struggles_with and so on), held in Postgres as a typed edge table:

CREATE TABLE graph_edges (
  src        bigint NOT NULL,
  dst        bigint NOT NULL,
  kind       text   NOT NULL,        -- 'struggles_with', 'mastered', 'enrolled_in', ...
  weight     real   NOT NULL DEFAULT 1,
  updated_at timestamptz NOT NULL DEFAULT now(),
  PRIMARY KEY (src, dst, kind)
);

Three model tiers

To control cost I route work through a nano model for classification and noise filtering, a mini model for daily work, and a larger model I only escalate to for critical incidents. Repeated queries go through a cache. The lesson is to test models on your own data. I ran the tiers against real student questions and real course material, and on my workload the cheapest model beat the expensive one. I'd never have guessed that from a leaderboard.


Plans and quotas

I sell AI usage by quota instead of by the month, which makes cost per student predictable:

Plan Price Allowance
Quick Ask ₦500 10 questions in 24 hours
Sprint ₦2,500 100 questions in 14 days
Scholar ₦2,500 120 questions in 30 days
Scholar Plus ₦3,500 250 questions in 30 days
Deep Study ₦10,000 Unlimited for 30 days, with offline access

Decrementing a quota must be atomic. Two simultaneous requests shouldn't both spend the last question, so let the database enforce it. No row back means no questions left:

UPDATE quotas
SET remaining = remaining - 1
WHERE student_id = $1 AND remaining > 0 AND expires_at > now()
RETURNING remaining;

I run the spend and the answer in one transaction, so a failed answer rolls the question back instead of charging a student for an error.


A ledger you can't quietly edit

The wallet is where bugs cost real money, so it's the part I was most careful with. Three rules:

  1. Money is integer kobo. Never floats.
  2. The ledger is append-only. Balances are computed, never stored and edited.
  3. Every write carries an idempotency key, so a retried request can't pay twice.
CREATE TABLE wallet_ledger (
  id              bigserial PRIMARY KEY,
  wallet_id       bigint      NOT NULL,
  entry_type      text        NOT NULL,   -- one of 31 types, e.g. 'task_escrow_hold'
  amount_kobo     bigint      NOT NULL,   -- credits positive, debits negative
  idempotency_key text        NOT NULL UNIQUE,
  created_at      timestamptz NOT NULL DEFAULT now()
);

-- Make 'append-only' a property of the database, not a promise in the code.
CREATE FUNCTION forbid_ledger_changes() RETURNS trigger AS \(
BEGIN RAISE EXCEPTION 'wallet_ledger is append-only'; END;
\) LANGUAGE plpgsql;

CREATE TRIGGER ledger_no_update
  BEFORE UPDATE OR DELETE ON wallet_ledger
  FOR EACH ROW EXECUTE FUNCTION forbid_ledger_changes();

CREATE VIEW wallet_balances AS
SELECT wallet_id, SUM(amount_kobo) AS balance_kobo FROM wallet_ledger GROUP BY wallet_id;

If something is wrong, you don't edit a row. You append a reversal. That sounds annoying until the first time you have to explain exactly what happened to someone's ₦4,000.

A transfer writes both sides in one transaction and locks the source wallet first, so two simultaneous spends can't both pass the balance check:

async def transfer(conn, *, src, dst, amount_kobo, entry_type, key):
    async with conn.transaction():
        await conn.execute('SELECT 1 FROM wallets WHERE id = $1 FOR UPDATE', src)
        balance = await conn.fetchval(
            'SELECT COALESCE(SUM(amount_kobo), 0) FROM wallet_ledger WHERE wallet_id = $1', src)
        if balance < amount_kobo:
            raise InsufficientFunds()
        await conn.executemany(
            'INSERT INTO wallet_ledger (wallet_id, entry_type, amount_kobo, idempotency_key) '
            'VALUES ($1, $2, $3, $4) ON CONFLICT (idempotency_key) DO NOTHING',
            [(src, entry_type, -amount_kobo, key + ':debit'),
             (dst, entry_type,  amount_kobo, key + ':credit')])

Calling transfer twice with the same key is a no-op the second time. That removes a whole category of double-payment bugs caused by mobile networks that retry on timeouts.

Escrow as a state machine

UniUI has a marketplace, a task board, tutoring and a notes store, so money regularly sits between two students who've never met. I model every one as an explicit escrow state machine. If a transition isn't in the table, it can't happen:

ALLOWED = {
    S.HELD:      {S.COMPLETED, S.REFUNDED},
    S.COMPLETED: {S.RELEASED, S.DISPUTED},
    S.DISPUTED:  {S.RELEASED, S.REFUNDED},
    S.RELEASED:  set(),
    S.REFUNDED:  set(),
}

def move(escrow, to: EscrowState) -> None:
    if to not in ALLOWED[escrow.state]:
        raise IllegalTransition(f'{escrow.state} -> {to}')
    escrow.state = to

Task board fees, in integer kobo: the poster pays the reward plus 5%, the worker gets the reward minus 5%, and the platform keeps the 10% gap. For a ₦2,000 task, that's 210000 paid, 190000 received, 20000 kept.

Tutoring has a longer fuse. After a session, the tutor submits a note, both sides confirm attendance, and a 7-day dispute window opens before the money moves. A scheduled job releases whatever has aged out, again with SKIP LOCKED so workers can share the queue.

Payouts to bank accounts run in weekly batches. A wallet is only eligible with at least ₦10,000, a verified bank account, and an approved role (creator, ambassador, tutor and a few others), so the batch query encodes the rules directly.

Tokens have a price, and a cron job moves it

In-app rewards come as tokens with a naira value that floats between a floor of 40 kobo and a cap of ₦1.20. A pg_cron job reprices them every two hours, keeping the logic next to the data it reads. Prices are inserted, never updated, so there's a full history of what a token was worth at any moment.

Payment providers fail

The obvious fallback loop has a nasty trap. If provider A times out after actually charging the card, and you retry on provider B, you've charged the customer twice. So I only fall back on errors that prove nothing was charged, and I treat webhooks as the source of truth:

async def charge(providers, *, reference, amount_kobo, customer):
    last_error = None
    for provider in providers:
        try:
            return await provider.charge(reference=reference,
                                         amount_kobo=amount_kobo, customer=customer)
        except ProviderDown as err:      # raised only when we KNOW nothing was charged
            last_error = err
            continue
        # Any other exception (timeouts, ambiguous failures) is NOT retried here.
        # It goes to reconciliation, which asks the provider what really happened.
    raise PaymentUnavailable() from last_error

Webhook handlers must be idempotent too, because providers deliver the same event more than once:

CREATE TABLE webhook_events (
  provider    text NOT NULL,
  event_id    text NOT NULL,
  received_at timestamptz NOT NULL DEFAULT now(),
  PRIMARY KEY (provider, event_id)
);

-- If this returns no row, we've already processed the event.
INSERT INTO webhook_events (provider, event_id) VALUES ($1, $2)
ON CONFLICT DO NOTHING RETURNING event_id;

Referral attribution

Creators, ambassadors and student unions all earn from referrals, so they share one attribution system and one set of fraud rules. Attribution is last-click within 30 days:

SELECT c.referrer_id
FROM referral_clicks c
WHERE c.visitor_id = $1
  AND c.clicked_at <= $2
  AND c.clicked_at >= $2 - interval '30 days'
ORDER BY c.clicked_at DESC
LIMIT 1;

Commission is a percentage of the first payment plus a smaller percentage on recurring payments for six months, with every commission held for 7 days before it becomes payable and refunds reversing everything. The fraud checks are the unglamorous part: self-referral, duplicate signups from one device, click farming, and refund abuse. Even a crude version catches the cheap abuse.


Jarvis: agents with a policy gate

Separate from the agents that help me write code, I run a layer that watches the platform. I call it Jarvis. It has six guardian agents (infrastructure, security, users, growth, content, finance) and a persona called Treasure that's the only one allowed to talk to humans. Every agent is a container made of a YAML profile and a tools module.

What an agent produces is a typed signal, not free text:

class Signal(BaseModel):
    source: Literal['infrastructure', 'security', 'users',
                    'growth', 'content', 'finance']
    kind: str                                  # e.g. 'disk_pressure'
    severity: int = Field(ge=1, le=5)
    detail: dict
    proposed_action: str | None = None         # e.g. 'restart_container'
    target: str | None = None
    observed_at: datetime

The design decision I care about most is that the agent never decides whether it's allowed to act. The core orchestrator scores the signal, then asks Open Policy Agent, which lives in its own container outside any agent's reach:

package jarvis.actions

import rego.v1

default allow := false

protected := {"postgres", "jarvis-trust-ledger"}

# Low-risk restarts of ordinary containers run on their own.
allow if {
    input.action == "restart_container"
    not input.target in protected
    input.score >= 0.8
}

# Anything touching protected services asks a human first.
needs_approval if {
    input.action == "restart_container"
    input.target in protected
}

The orchestrator posts the action to OPA and gets back execute, ask_human (Treasure sends the approval request) or reject. Every decision, score and approval is written to an audit ledger in Postgres. Resolved incidents are stored in Qdrant with a signature, so the next similar incident can be matched against how the last one was fixed.

One distinction I try to keep honest: a cron job that restarts a container is automation. I only call something autonomy when the system decides what to do, does it, learns from the result and adjusts.


Device-first sync

Offline is the least finished part of the platform, so read this as design, not a victory lap. The app always writes to a local encrypted database first, and syncing is a background concern. Every local change also lands in an outbox:

-- On the device (SQLite, encrypted with SQLCipher)
CREATE TABLE outbox (
  seq          INTEGER PRIMARY KEY AUTOINCREMENT,
  entity       TEXT NOT NULL,
  entity_id    TEXT NOT NULL,
  op           TEXT NOT NULL,      -- 'upsert' | 'delete'
  payload      TEXT NOT NULL,      -- JSON
  base_version INTEGER NOT NULL,
  created_at   INTEGER NOT NULL
);

The sync loop pushes the outbox (deleting entries the server accepts, resolving conflicts on the rest), then pulls changes made elsewhere since its last cursor. Conflict strategy is per table: CRDT for notes, last-write-wins per field for goals, append-only for the journal.

For offline AI, the plan is quantised models on the device through llama.cpp, fetched from Hugging Face at download time so I don't store them on my own VPS, plus a limited WebLLM path in the browser.


Running 20+ containers on one 7.8GB VPS

Everything runs on a single Oracle Cloud VPS. It's cheap, which matters when you're a student, and it forces discipline about memory. The compose file is mostly memory limits, because without them one noisy container takes down the rest:

services:
  api:
    image: uniui-api-v2
    command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
    deploy: { resources: { limits: { memory: 1g } } }
    restart: unless-stopped
  worker:
    image: uniui-api-v2
    command: celery -A app.worker worker --concurrency 2
    deploy: { resources: { limits: { memory: 768m } } }
    restart: unless-stopped
  redis:
    image: redis:7
    command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
    restart: unless-stopped

Redis is split by database number so jobs can't trample each other's keys. Caddy terminates TLS in front, Cloudflare handles DNS and DDoS protection, Sentry catches errors, Prometheus and Grafana watch metrics, Loki collects logs, and UptimeRobot pings from outside.

Two infrastructure lessons. Uncapped Docker logs are a silent disk killer, fixed with max-size: 10m, max-file: 3. And MinIO's open-source project was archived and its images pulled from Docker Hub and Quay, so I had to move to the pgsty/minio fork.


Working with agents that write code

I'm one person, and agents wrote a large share of this code. That's the only reason it exists at this size, and it also created the problem I had to deal with. Agents produced 908 frontend pages, and I had to consolidate them to about 150 that matter for launch. Volume is cheap. Coherence is the part you still have to supply.

What I lean on:

  • A design contract. Every page uses components from one design reference file. If a pattern isn't there, I add it there first.
  • Types at every boundary. Strict TypeScript on the frontend, Pydantic on the backend.
  • Reversible migrations. Every schema change goes through Alembic, with a downgrade.
  • CI, which I'm adding. It's on my list and not done, and I'd rather say that plainly. The minimum gate is ruff, mypy --strict and pytest on the API, and tsc --noEmit plus lint on the web.

Here are the three incidents that shaped those rules.

Story 1: The agent that cried wolf 309 times

One agent ran a data-router audit. For every API route, it checked that the database column the route queries actually exists. It came back with 309 findings, all "broken column." I almost shipped the fixes.

Then I stopped. A working admin console doesn't have 309 broken columns. If it did, nothing would work. So I told the agent to verify its own work.

My code talks to two databases: Supabase for user data, and PostgreSQL for content. The agent had compared Supabase-backed routers against the content database's schema. profiles.email doesn't exist there, but it exists fine in Supabase. The audit was comparing apples to oranges and calling every difference a bug. After it checked against the right source of truth, the real count was 4.

What saved me was one line in the prompt: "If you're unsure whether to fix or delete, STOP and ask." An agent that stops to doubt itself is worth more than a confident one. Every agent now has a cry-wolf check: if a finding count is implausibly high, it must verify against the actual source of truth before reporting.

Story 2: The pages that lied

Early in the frontend build, an agent shipped a batch of pages. They compiled, the loading states worked, and the layouts matched the design system. They were also lying to students:

  • /likely-questions showed six exam questions with confidence scores and "appeared in 3/5 past years" labels. The agent had invented all of it. A student could have planned revision around questions no lecturer ever asked.
  • /departments listed departments with named HODs and student counts. None of it was real.
  • /verification shipped with status: 'Verified' as the default, so an unverified user saw a green tick.
  • /notes/create and /practice/flashcards/create discarded what the student typed, then redirected as if it had saved.

Fabricated data is the most dangerous kind of bug because it's invisible. There's no error and no crash, only a convincing lie. Three rules came out of it:

  1. Never ship a page that lies. If the real action can't ship, remove the button. A missing button is honest.
  2. No fabricated data, ever. Not for demos, not for placeholders.
  3. Silent discard is worse than a crash. A crash tells the user something is wrong. A silent discard tells them their work is saved when it isn't.

Story 3: The four methods that weren't methods

A page showed a permanent loading spinner, with no error and no timeout. Four API client methods (getMyProgress, getPlatformBadges, followUser, redeemPromoCode) had been declared outside the ApiClient class instead of inside it:

// Inside the class: works
class ApiClient {
  async getMyProgress() { return this.request('/api/v1/my-progress'); }
}

// Declared outside the class: never becomes a method
async getMyProgress() { return this.request('/api/v1/my-progress'); }

TypeScript accepted it because the class had a [key: string]: any index signature. The callers used optional chaining:

apiClient.getMyProgress?.().then(...)

The method was undefined, so ?. short-circuited, .then() never fired, and the spinner never cleared. Optional chaining hid a real failure. The tests passed because none covered those pages, and lint had nothing to flag. Agents now scan for methods declared outside their class and for ?.() calls to methods that don't exist on the actual object.

How I review agent output

Every change goes through four gates:

  1. Does it compile? Types, lint and tests. Table stakes, and it catches almost nothing important.
  2. Does it actually work? I run it in the real environment: open the page, click the button, check the network tab and console. Most bugs live here.
  3. Does it lie? Is every number real? Does every button do what its label says? Does every "saved" mean saved?
  4. Does it break something else? What other pages call this code, what other routes depend on this schema, and what happens if it runs twice?

What I won't let an agent touch

Code. Not one line. Jarvis's guardians can watch containers, correlate logs, ban IPs, score content, and flag wallet anomalies. They cannot edit code, change a config file, modify the frontend, or deploy anything.

A bad code change has an unbounded blast radius. A subtle bug in the payment path costs real money, and a frontend regression hits every student at once. Recovery is slow and the failure modes are catastrophic, so even approval gates at every step don't make the risk-reward work.

Instead, Jarvis detects the bug, finds the root cause, drafts the fix, writes a test and opens a PR. Then I review it, approve it and deploy it. The agent does the analysis and I do the commitment. The operations layer earns trust through demonstrated performance. The code layer doesn't get to earn it yet, because I'd be trusting an agent to act correctly in situations I haven't imagined, at 3 AM, while I'm asleep.


What I'd tell someone starting today

  1. Attach provenance to everything on day one. Course, level and source on every chunk. It makes every later promise possible.
  2. Normalise on write, not on read. JSONB is a fine landing zone and a bad home.
  3. Build the boring parts first. Auth, billing, notifications and sync took about 60% of my engineering time.
  4. Test models against your data, not benchmarks. The cheapest one won on my workload.
  5. Make money paths boring and strict. Integer kobo, append-only ledger, idempotency keys, explicit state machines.
  6. Volume is cheap, coherence is not. Agents produce things. Keeping them consistent is your job.
  7. Some blockers aren't code. My mobile app, with 152 screens built, sat blocked for weeks on an Apple Developer account.

What's next

Public launch is in 50 days, with a planned expansion to six more Nigerian universities in November 2026. I'm recruiting 500 student creators to help distribute it, and the unglamorous legal work (CAC registration, NDPA compliance, a proper privacy policy) has to land first.

If you've built retrieval over messy educational content, wallets or escrow in Nigeria, or a product with a lot of agent-written code, I'd like to hear what you'd do differently. Tell me in the comments.

Want more #ai & #technology deep dives?

Join 6,178+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

1 Comment

1 vote

More Posts

A Textile Mill's Dyehouse Ramp Curve: Get One Step Wrong and the Sheet Belongs to the Master

aiomniu - Oct 18

Breaking the AI Data Bottleneck: How Hammerspace's AI Data Platform Eliminates Migration Nightmares

Tom Smithverified - Mar 16

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Python for commerce students, from a former bio kid

rahuldk1105 - Oct 30

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4
chevron_left
1.2k Points • 38 Badges
Owerri, Nigeria • nmesirionye.ngbaronye.com
9Posts
16Comments
12Connections
I build things at a scale one person shouldn't be able to.

UniUI is a platform where a Nigerian uni... Show more

Related Jobs

View all jobs →

Commenters (This Week)

23 comments
13 comments
5 comments

Contribute meaningful comments to climb the leaderboard and earn badges!