All Projects

Live

Platform / SaaS API

Ekawe App

A comprehensive educational platform connecting students and lecturers, featuring a custom financial ledger, RAG-powered AI book interactions, and automated KYC.

Role: Backend Lead


NestJSTypeScriptMySQLRedisAI/RAGKYCLangchainBull Queues
Problem Statement

Lecturers lacked a centralized, secure platform to publish and monetize their educational materials, while students needed an interactive space to purchase, review, and engage with these resources.

Target users: Students, Lecturers (Creators), and Educational Administrators

Project Walkthrough

For the Ekawe App, I architected a comprehensive educational platform backend from the ground up, tasked with solving the complex problem of secure academic distribution and monetization. The core technical challenge was building a multi-sided marketplace that required strict identity verification (KYC), an automated wallet ledger, and an interactive AI component for digital books.

I implemented the foundation using NestJS and TypeScript, heavily leaning on Domain-Driven Design to keep the rapidly expanding bounded contexts isolated. I engineered a robust financial ledger using TypeORM, designing complex aggregate queries that act as a dual-entry system to track student purchases, platform commissions, and lecturer withdrawals with strict ACID compliance. For security, I integrated the Didit.me API with HMAC-secured webhooks, writing custom guards to handle edge cases like duplicate ID submissions and dynamic routing based on school subdomains.

To differentiate the platform, I built a complete RAG (Retrieval-Augmented Generation) pipeline using Langchain and Redis. This system automatically ingests published books, embeds vectors, and allows students to have threaded, context-aware conversations with the text—safeguarded by strict RBAC to ensure users only query books they own. Orchestrating these background processes via Bull queues while maintaining a high-performance REST API was immensely rewarding, resulting in a highly scalable and resilient ecosystem.


Tech Stack

Languages

TypeScriptNode.js

Frameworks

NestJSExpress

Databases

MySQLRedis (Message Broker & Vector Store)SQLite (E2E Testing)

Cloud & Infrastructure

DockerAWS

Dev Tools

Swagger/OpenAPITypeORMJestBull (Job Queues)Socket.io

Authentication

JWT, Passport.js, Google OAuth, Email OTP, bcrypt

Third-Party APIs & Integrations

Didit.me v3 (KYC)

AWS S3

OpenAI / Anthropic (via Langchain)


System Architecture

Architecture Pattern

Layered MVC with Domain-Driven Design (DDD)

Request Data Flow

Client -> Auth Guard / Roles Guard (RBAC) -> Controller -> Service -> TypeORM Repository -> MySQL. Background tasks decouple via Bull Queues -> Redis -> Worker Process.

Key Engineering Decisions

Adopted a strict Domain-Driven structure (`src/domains`) to isolate bounded contexts (e.g., segregating `kyc`, `transactions`, and `book-ai`). Used `@nestjs/bull` backed by Redis to offload heavy processes like AI book ingestion and KYC email notifications, ensuring the main event loop remains unblocked.

Database Design

Relational schema using TypeORM. Highly normalized structure separating `User` from role-specific profiles (`CreatorProfile`, `LecturerProfile`). Financial tables (`transactions`, `lecturer_wallets`) enforce strict constraints to track book purchases vs. withdrawals securely.

Module Structure

authbooksbook-aicreator-walletstransactionskyccommunications

Key Features & Implementation

Financial Ledger & Wallet System

Manages book purchases, automated platform commission splits, and lecturer wallet withdrawals with role-specific views.

How it was built

Built `TransactionsService` utilizing complex TypeORM QueryBuilders. Enforces strict state machines (preventing updates on `Completed` or `Failed` transactions). Dynamically aggregates total earnings, refunds, and available balances by cross-referencing `transactions` with `lecturer_wallets`. Queries dynamically alter based on whether the requester is a student (viewing total spent) or a lecturer (viewing earnings/withdrawals).

Automated KYC Verification Pipeline

Automated identity verification for lecturers to ensure platform authenticity before allowing monetization.

How it was built

Integrated the Didit.me v3 API in `KycService`. Generates dynamic callback URLs per school subdomain (e.g., `school.ekawe.app/lecturer`). Secured webhooks parse Didit sessions and apply guards for edge cases like name mismatches or duplicate verified IDs (`applyVerifiedDocumentUniquenessGuard`). Successful validations trigger `@nestjs/bull` jobs to handle asynchronous communications.

RAG-Powered AI Book Interactions

Allows students to have threaded, contextual conversations with the digital books they've purchased.

How it was built

Implemented a complete Retrieval-Augmented Generation (RAG) pipeline in `BookChatController`. When a book is published, `BookIngestionService` extracts text and embeds vectors into Redis. When a user sends a message, the system verifies purchase ownership, retrieves the top-5 most relevant book chunks from Redis, fetches the last 10 messages for conversational context, and prompts the LLM (via `@langchain`) to generate accurate, localized answers.


Challenges & Engineering Decisions

One of the most complex engineering challenges was ensuring data consistency within the financial ledger while serving dual purposes (tracking system-wide purchases vs. individual wallet balances). Writing secure, optimized TypeORM QueryBuilders to handle aggregate mathematical functions without exposing cross-tenant data required deep SQL knowledge. Additionally, orchestrating the RAG pipeline—ensuring chunks were accurately embedded in Redis and that chat sessions securely validated book ownership before querying the LLM—required carefully balancing performance with strict RBAC constraints.


API Documentation

API Route Namespaces

/v1/auth/v1/book-ai/v1/transactions/v1/kyc/v1/creator-wallets