All projects
paysafe-cover

PaySafe

PaySafe

01

Overview

Project name

PaySafe

PaySafe

One-line description

A payroll-linked lending platform API for employers and employees in Zambia, with an interactive architecture map that visualizes how requests move through the system.

My role

Full-Stack Developer (backend API, integrations, architecture documentation tool)

Timeline

2025 to 2026

Category

Fintech · Payroll Lending

Platforms

REST API (AWS App Runner) · Architecture diagram (Vercel)

Tech stack

PythonDjangoDjango REST FrameworkPostgreSQLAWSCeleryReact 18TypeScriptViteReact FlowFramer MotionVercel

02

The Problem

Employers and financial institutions in Zambia need a secure way to offer salary-backed loans to employees, with proper affordability checks, employer approval workflows, rate calculations, and compliant OTP-based authentication. The system had to support multiple user types (employees, sales agents, employer admins), handle sensitive financial data, integrate with async messaging for OTP delivery, and remain understandable to stakeholders who are not reading Python tracebacks.

03

The Solution

I built PaySafe as a Django REST API that powers loan lifecycle management, employee onboarding, employer setup, rate-sheet processing, and multi-channel OTP (SMS, WhatsApp, email via queue workers). Alongside the API, I shipped an interactive architecture diagram, a layered, animated system map where users can simulate real request paths (OTP send, loan application, rates lookup, etc.) and watch nodes and edges light up step by step. This makes the backend tangible for demos, onboarding, and portfolio storytelling.

04

Key Features

  • JWT authentication with MFA / OTP login

    Secure auth flows with multi-factor and one-time password verification.

  • Loan lifecycle management

    Loan creation, approval stages, refinancing, and deductions.

  • Employee & employer operations

    Employee lookup, affordability checks, and employer hierarchy (divisions, departments, units).

  • Rates engine

    PAYE calculations and employer rate-sheet uploads.

  • Async OTP delivery

    OTP generation, verification, and async delivery through AWS SQS.

  • Geo & document storage

    Zambian provinces and districts endpoints; employer MOUs and rate sheets on S3.

  • Interactive architecture diagram

    Four-layer map (Client → Gateway → Services → Data) with five simulatable request flows, glowing nodes, animated edges, layer filtering, and live simulation HUD.

05

Technical Implementation

Architecture

API: mobile/web clients → Django gateway (Gunicorn on AWS App Runner) → DRF viewsets and service modules (OTP, loans, rates, notifications) → PostgreSQL; async work via SQS; files on S3. Diagram app decoupled into four concerns: pure data definitions (nodes, edges, flow paths); React Context simulation engine; custom renderers; React Flow canvas.

Backend

Django 4.2 with Django REST Framework and SimpleJWT. Modular paysafeapp with viewsets, serializers, signals, and Celery tasks. Custom OTP kit: HMAC-hashed codes, rate limiting, Django-backed storage, SQS outbox channel. Employer settings, rate-sheet config, and document upload pipelines.

Frontend

Vite + React 18 + TypeScript for the architecture tool. React Flow v11 for the diagram canvas; Framer Motion for node transitions. Strict edge naming (e-<source>-<target>) so the simulation engine reconstructs active segments from path arrays. All visual state derived from (activeSimulation, flowProgress).

Database

PostgreSQL (AWS RDS) in production; SQLite for local development. Models cover users, employers, employees, loans, approvals, deductions, OTP records, refinances, and notification reminders.

APIs / Integrations

REST API under /api/ (loans, employers, employees, users, deductions, refinances). Auth under /api/auth/ (JWT + MFA). OTP: /api/otp/send/, /api/otp/verify/. Rates health, lookup, suggest terms, tool endpoints. AWS SQS for OTP outbox; S3 via django-storages; Celery for background jobs.

Infrastructure

AWS App Runner + Gunicorn for the Django API. Vercel for the static architecture diagram SPA. Secrets and queue config via AWS Secrets Manager. Migrations and superuser bootstrap in deployment startup script.

06

Challenges & Solutions

  • OTP delivery without blocking the API

    OTP sends must be fast for the user but reliable across SMS/WhatsApp/email. Implemented an outbox pattern: the API writes to Django storage and enqueues SQS; workers handle provider routing separately.

  • Keeping the architecture diagram in sync with reality

    Encoded real PaySafe paths (OTP send, verify, MFA, loan, rates) as data arrays where every consecutive node pair must match a real edge, so the simulation cannot lie about connectivity.

  • Vercel deploying a monorepo with Django present

    Vercel auto-detected Django from manage.py and failed after the Vite build. Fixed by setting framework to Vite explicitly, pointing build output to architecture-flow/dist, and ignoring Python app files during deploy.

  • Complex loan domain logic

    Loans tie together employees, employers, approvals, deductions, refinancing, and notifications. Used DRF viewsets, signals, and dedicated notification modules to keep side effects out of view logic.

07

Results

Shipped a production-grade REST API covering auth, lending, employer setup, rates, and OTP. Deployed an interactive architecture experience at paysafe-architecture.vercel.app. Documented five critical request flows stakeholders can replay in one click. Established a reusable pattern for animated system diagrams (data → engine → renderers → canvas) applicable to other projects.

08

What I Learned

  1. 1.Derive UI state, don’t duplicate it, the simulation works because nodes and edges never own timers or active flags; everything flows from two values and pure helper functions.
  2. 2.Naming conventions are architecture, the e-<source>-<target> edge ID convention let the engine map abstract step indices to concrete SVG paths without a lookup table.
  3. 3.Monorepos need explicit deploy boundaries, hosting a static doc site from the same repo as a Django app requires clear .vercelignore / framework config, or platforms will guess wrong.
  4. 4.Visual tooling pays off for complex backends, a five-minute demo of a glowing request path communicates more than a Swagger page for non-engineer stakeholders.

09

Links

LET'S WORKTOGETHER

I design and ship production-ready systems at the intersection of cloud infrastructure, full-stack engineering, and human-centred product thinking.

Send email · kuzagbechristopher@gmail.com