System Architecture · Deep Dive

Engineering Sri Lanka's First AI-Native Learning Ecosystem: A Deep Dive into ZisuGen's Architecture

Client: ZisuGen | Scope: Full-Stack Engineering, AI Integration, PWA Development

Written by Shehan ChamikaDec 15, 202512 min read
ZisuGen Architecture Overview

Core Stack

Next.js 14

Database

Firebase

AI Engine

OpenAI API

Compute

Vercel Edge

🚀The Challenge

Beyond Standard EdTech

ZisuGen required more than a simple LMS. They needed a self-sustaining ecosystem where content is generated, moderated, and personalized by Artificial Intelligence. The challenge was to build a system that handles:

  • Real-time interactions (Chat, Stories, Notifications) for thousands of concurrent users.
  • Content Moderation without human teams (using AI).
  • Complex Access Control for paid content versus public resources.
  • Zero-latency performance on mobile devices via PWA standards.
💡The Solution (Deep Dive)

Engineering the Architecture

Here is how SoftGen engineered the solution.

01The "AI Gatekeeper" & Content Safety Engine

One of the most complex features we built was the Automated Moderation Layer.

The Problem

Allowing students to post freely creates risks of spam, bullying, or inappropriate content.

Our Solution

We engineered an "AI Gatekeeper" middleware. Before any post, comment, or image is written to the database, it passes through our AI filter.

  • Text Analysis: Detects hate speech, harassment, and irrelevant spam in both Sinhala and English.
  • Image Recognition: Scans uploaded images for inappropriate content.

Result: The system automatically rejects unsafe content and flags users, reducing the administrative burden by 90%.

02The Personalized AI Tutor (RAG Architecture)

We moved beyond simple chatbots. The ZisuGen AI Tutor utilizes Context-Aware Prompt Engineering.

  • Role-Playing capabilities: The AI switches modes between a "Math Solver" (step-by-step logic) and an "Essay Assistant" (creative writing) based on user intent.
  • Visual Logic: Users can snap a photo of a math problem, and the AI utilizes vision capabilities to interpret and solve handwriting.

03Mobile-First PWA Architecture

Recognizing that 95% of traffic is mobile, we optimized the frontend using Progressive Web App (PWA) standards.

  • Service Workers: We implemented advanced caching strategies, allowing the app to load instantly even on slow 3G networks.
  • Native Gestures: The "Story System" and "Video Feed" feature smooth, touch-responsive animations (built with Framer Motion) that mimic native iOS/Android experiences.
  • Installability: Users can add ZisuGen to their home screen, bypassing the friction of app stores.

04The "Smart Classroom" & Payment Logic

We built a sophisticated Role-Based Access Control (RBAC) system for the monetization layer.

  • Dynamic Content Locking: The system checks user enrollment status in milliseconds. If a user hasn't paid, Tute links display a "Lock" state; upon payment via PayHere Webhooks, access is instantly granted without manual approval.
  • Teacher Dashboards: A real-time admin panel where tutors can track income, student attendance, and manage their "Mini-Site" content.

05Advanced Community Features

To drive engagement, we engineered social features typically found in massive social networks:

  • Ephemeral Data (Stories): A system for 24-hour disappearing content, managing storage efficiency automatically.
  • Real-time Synchronization: Using Firestore listeners, the Chat Community and Game Arena update instantly across all devices without page reloads.
  • AI Daily Polls: A cron-job triggers the AI every morning to generate a relevant academic poll based on trending exam topics, keeping the feed active automatically.

06Interactive Learning (Virtual & Visual Labs)

We integrated lightweight web-based simulations for the Visual Lab. Students can interact with 3D concepts and biological diagrams directly within the browser, rendering complex visuals without sacrificing load times.

07The "Zero-Touch" Programmatic SEO Engine

Manual SEO is impossible for a platform with thousands of daily uploads. We engineered an automated SEO architecture using Next.js 14 Metadata API that ensures ZisuGen dominates Google Search results without manual effort.

  • Dynamic Metadata Generation: Every time a teacher creates a class or a student shares a note, the system automatically generates unique, keyword-optimized Titles, Descriptions, and Open Graph (social share) tags. A Class Page for "2025 Physics" instantly ranks for keywords like "Physics Classes in Sri Lanka" minutes after creation.
  • Rich Snippets (JSON-LD Schema): We implemented advanced structured data. Google doesn't just see a webpage; it sees a "Course" (with price and instructor), a "Book", or a "Video Object". This allows ZisuGen to appear with rich details (Star Ratings, Prices) directly on the Google Search Results page.
  • The "Teaser" Indexing Strategy: To solve the conflict between Privacy and SEO, we built a hybrid rendering system. Locked content (like paid classes) is rendered as "Public Teasers" for Google Bots, allowing private inventory to be indexed and searchable, driving organic traffic to the sign-up page.
🏆The Impact

Scalable, Secure, Intelligent.

SoftGen delivered a scalable, secure, and intelligent platform. ZisuGen is now capable of serving the entire island's student population with minimal server costs and maximum efficiency.

🛠️The Tech Stack

Next.js 14

Frontend Speed & SEO

Tailwind CSS

Styling & Animations

Node.js

Backend Logic

Firebase

Real-time Database

OpenAI API

AI Engine

Vercel

Global Edge Network

📊The Result

Bridging the Gap

ZisuGen is now a fully functional SaaS platform that bridges the gap between students and technology. It stands as a prime example of how SoftGen can transform a complex idea into a user-friendly, high-performance digital product.

Ready to build your vision?

Looking to build your own SaaS?

At SoftGen, we build the future. Contact us today to discuss your project.