Skip to content
Saarrthi Rana

Software / September to October 2026

Masomo

A school management app for primary and secondary schools in Uganda.

Role
Solo developer
Team
Solo
When
September to October 2026
Next.js 16React 19TypeScriptPrismaSQLiteNextAuthVitest
Masomo administrator dashboard showing students, staff, invoices and announcements
Video
How each role signs in and what each one can do.
Overview

Schools juggle paper registers, mark sheets and fee books, and parents wait days for results. Masomo puts all of it in one place, and each role gets its own view.

One installation serves many schools. Each person signs in to a view for their own school and role. The roles are principal, administrator, teacher, student, guardian, bursar, librarian and transport officer, plus a platform owner who looks after everything.

What I did
  1. Designed the database, with 34 tables.
  2. The school's ID comes from the login session, never from a form.
  3. Added several layers of access checks on every page and action, including two-step sign-in for the roles that need it.
  4. Made signing in safer with hashed passwords, authenticator app codes, a lockout after too many wrong tries, and setup links that expire and only work once.
  5. Stored all money as whole numbers, in the smallest unit of the currency, and put the fee math in one billing module.
  6. Changed the database in small steps that can each be rolled back.
  7. Gave each payment a unique key in the database, so a double click doesn't save twice.
  8. Saved corrections as new entries, so the payment history stays intact.
  9. Added 146 automated tests for the money, billing, grading, password and SMS code.
How it works

Publishing marks

Marks go from open to submitted to approved to published. Only certain roles can move them to the next step, and every step is logged. Students see their marks only once they're published.

Change log

It records who changed what. Only the changed fields are saved, with their old and new values, and secrets are hidden before anything is stored.

Attendance drafts

The attendance register saves a draft on the device while a teacher fills it in. The draft comes back after a reload and is sent safely when they're done.

Code

Part of the Masomo code.

The repository is private, so this is one short piece of it. I can walk you through the rest on a screen share.

Recording a payment

src/lib/actions/bursar.ts, TypeScript and Prisma

How Masomo saves a fee payment. The receipt and the invoice status are saved together in one database transaction. Each payment has a unique key in the database, so a double click doesn't save twice.
// Derive an idempotency key when the caller did not supply one.
function derivedIdempotencyKey(invoiceId: string, minor: Minor, method: string): string {
  const minuteBucket = Math.floor(Date.now() / 60_000);
  return createHash("sha256")
    .update([invoiceId, minor, method, minuteBucket].join("|"))
    .digest("hex");
}

export async function recordPayment(formData: FormData) {
  const { tenantId, userId } = await requireSession("/bursar");
  // ...
  const idempotencyKey =
    String(formData.get("idempotencyKey") ?? "").trim() || derivedIdempotencyKey(invoiceId, minor, method);
  const position = applyPayment(invoice, minor);

  try {
    // One transaction: the receipt and the invoice status must move together,
    // or a crash between them leaves a paid invoice still showing as owing.
    await prisma.$transaction([
      prisma.payment.create({
        data: {
          invoiceId,
          method,
          status: "SUCCESSFUL",
          reference: genReference("RCT"),
          recordedBy: userId,
          idempotencyKey,
          ...moneyColumns(minor),
        },
      }),
      prisma.invoice.update({ where: { id: invoiceId }, data: { status: position.status } }),
    ]);
  } catch (error) {
    if (isDuplicateKey(error)) {
      // The database refused a repeat of a payment already recorded. Treat it
      // as success: the bursar's intent was carried out the first time, and
      // showing an error would invite them to try again and double-charge.
      await logEvent({
        tenantId,
        actorId: userId,
        action: "PAYMENT_DUPLICATE_SUPPRESSED",
        target: invoiceId,
        reason: "Matching payment already recorded",
      });
      // ...
      return;
    }
    throw error;
  }
  // ...
}
Result checking screen with approve and send back buttons
Results can be approved or sent back to the teacher.
Teacher attendance register in Masomo
The attendance register, which keeps drafts on the device.

Next project

Avatar Documents

A quoting tool I built for the staff at Avatar Solutions, an IT services company in Kampala. You fill in a form, see a live A4 preview and download a print-ready PDF.