From a rapid AI vibe-coded Cloudflare prototype to a sovereign multi-tenant school SaaS on private VPS. A factual engineering account of decoupling architecture, bridging AI Studio dev mocks with relational databases, patching critical security flaws, and automating CI/CD with daily WhatsApp backups.
Prototyping with AI accelerates early development, but running in production demands architectural rigor. Here is a factual engineering account of decoupling, runtime alignment, security hardening, and deployment automation across 207,000+ lines of code.
Mutiara was originally prototyped through rapid AI vibe-coding on Cloudflare Workers. As the system expanded to 104 views and 71 API endpoints, the business encountered strict infrastructural limits.
The original backend was tightly coupled to Cloudflare D1 (SQLite) and proprietary R2 object storage. School clients required full data sovereignty on private server infrastructure (PostgreSQL 16) without third-party vendor lock-in. Furthermore, running disparate school functions—from daily student attendance to academic assessments, tuition billing, and digital correspondence—in a single monorepo backend made independent team iterations risky. Decoupling into 7 autonomous Hono microservices allowed Mutiara's developers to continue prompt-driven feature iteration in Google AI Studio while Samkarsa hardened backend stability and production deployments.
Data Sovereignty & Zero Vendor Lock-in: Migrated from proprietary Cloudflare D1/R2 to open-standard PostgreSQL 16 and host-secured volume storage.
Autonomous Service Boundaries: Grouped 71 endpoints into 7 single-responsibility services (Auth Core, Academic, Attendance, Finance, Document, Portal, SaaS).
Parallel Development Model: Front-line developers iterate features in AI Studio while backend microservices remain safely isolated behind container perimeters.
Tied to Cloudflare D1 SQLite & R2 APIs. Single process failure risks all school features simultaneously.
7 isolated containers on private VPS. 100% PostgreSQL data sovereignty with independent release lifecycles.
When building applications with AI assistance, features that appear to function flawlessly in dev previews often conceal major architectural gaps once deployed to production.
In Google AI Studio, the frontend was tested against Vite middleware backed by 5,600+ lines of mock handlers and in-memory JSON (storage_db.json). Deleting a parent user executed a simple array slice (.splice()), immediately displaying clean UI state. However, in production VPS, the backend auth-core-service only deleted the users record—leaving relational records in parent_students and parent fields in students completely untouched. Crucially, the frontend button called an unlinked endpoint (/unlink-parent) that had never even been implemented in portal-service. Lacking a local PostgreSQL instance, developers resorted to using production Git Tags (./release.sh) as a trial-and-error debugging tool, triggering repetitive 3–8 minute Docker builds. Samkarsa resolved this by implementing the missing portal routes, fixing cascading relational cleanup in PostgreSQL, and establishing clean release boundaries.
/unlink-parent
yang ternyata BELUM DIBUAT sama sekali di backend portal-service.
Implemented Missing Endpoints: Built out missing portal-service routes (/unlink-parent) that previously only existed in local Vite mocks.
Complete Relational Cleanup: Ensured account deletions in auth-core-service explicitly clean up parent_students relationships in PostgreSQL.
Eliminated Anti-Pattern: Stopped the bad habit of using production Git Tags as a debugging tool, keeping release history pristine.
A comprehensive defensive security audit conducted on October 15, 2026 discovered that rapid AI code generation had left critical development bypasses active in production code.
During early prototyping, AI models introduced convenience branches in authentication middleware. If an incoming HTTP request contained insecure mock authorization headers, the middleware automatically synthesized a super_admin session, granting unauthenticated callers full access to school records. In finance-service, billing routes permitted execution when authorization tokens were omitted entirely. Samkarsa remediated these critical vulnerabilities by enforcing cryptographic JWT HS256 signatures, binding internal databases exclusively to 127.0.0.1, and hardening Docker socket access.
Universal Auth Bypass Neutralized (CVSS 9.8): Purged mock tokens across all services and enforced strict JWT token verification.
Zero-Auth Finance Route Patched (CVSS 9.8): Replaced unprotected fallbacks with mandatory role-based access checks on school ledgers.
Network & Container Defense: Rebound PostgreSQL and Redis services away from public interfaces (0.0.0.0) strictly to localhost, and removed read-write mounting of /var/run/docker.sock to prevent container escape.
Delivering one-time password (OTP) verification emails is essential for school onboarding. However, standard SMTP ports (25 and 587) are routinely blocked by internet service provider (ISP) firewalls.
To eliminate dependency on expensive third-party email APIs, Samkarsa deployed a self-hosted Docker Mailserver (Postfix + Dovecot) configured with complete domain reputation records: SPF, DKIM (mail._domainkey), and DMARC for @mutiarapaud.id. For container-to-container communication, auth-core-service transmits email payloads over an internal HTTPS endpoint (Port 443) behind Traefik SSL, completely bypassing ISP SMTP port blocks.
Teacher / Parent enters email on web login
Generates secure OTP & calls internal relay
Internal encrypted call immune to SMTP port blocks
Postfix + Dovecot signs SPF, DKIM & DMARC
Arrives in Gmail / Yahoo inbox within seconds
Internal HTTPS Mail Relay (Port 443): Dispatches OTP emails through encrypted HTTPS requests, immune to outward SMTP port filtering.
Primary Inbox Deliverability: Full SPF, DKIM, and DMARC compliance ensures verification codes land reliably in parent and teacher inboxes.
Integrated Roundcube Webmail: Configured a secure webmail client with end-to-end TLS encryption for direct administrative correspondence.
In a 7-service monorepo, recompiling all containers for a small fix wastes CPU cycles and risks Out-Of-Memory (OOM) crashes on the production server.
Samkarsa structured GitHub Actions workflows to parse monorepo git diffs. When a release tag is pushed, the pipeline detects exactly which microservice directories experienced code changes. If only academic-service was updated, only that container is compiled and deployed. This optimization reduced release times from ~15 minutes down to ~7 minutes, accompanied by instant deployment status notifications delivered directly to the developer's Telegram account.
Git Diff Change Detection: Compiles only the specific Docker containers that changed, avoiding unnecessary full-stack rebuilds.
Zero-Downtime Rolling Deployment: Swaps production containers sequentially behind Traefik reverse proxy without dropping active sessions.
Instant Telegram Telemetry: Notifies developers immediately with commit hash, author, tag, build duration, and failure traces.
Multi-tenant school data requires reliable historical backups without consuming limited NVMe disk space on the production server.
Samkarsa engineered a Zero-Disk VPS Backup Strategy. Database dumps stream directly to ephemeral /tmp memory, upload to encrypted Google Drive storage via rclone, and are immediately purged from host disk upon completion (0 MB residual storage on VPS). The system follows the Grandfather-Father-Son (GFS) retention model: daily snapshots (Son) are kept for 14 days, weekly snapshots (Father) for 8 weeks, and monthly archives (Grandfather) for 1 year with auto-pruning. Every morning at 02:00 WIB, the BiZETO engine sends an automated confirmation message directly to the system owner's WhatsApp number.
Short-term recovery snapshots with automated cleanup.
Medium-term checkpoints for weekly rollback safety.
Long-term historical compliance and regulatory archive.
Zero-Disk VPS Footprint: Database dumps are wiped from the host immediately after upload, leaving 0 MB of residual backup files on the server.
Grandfather-Father-Son (GFS) Retention: Combines 14 daily, 8 weekly, and 12 monthly snapshots, using under 80 MB of Google Drive storage.
Automated WhatsApp Notifications: Every morning, an automated BiZETO alert reports file sizes, backup duration, and disk cleanliness directly to WhatsApp.
Each service runs in its own isolated Docker container on Node.js 24 with dedicated network boundaries, Redis queues, and JWT authorization.
JWT HS256 Identity, Session Management, RBAC & Multi-Tenant Context
Curriculum KOSP, Student Development, Classes & Digital Report Cards
Biometric QR Scanner, Geofencing GPS Verification & Daily Attendance
Tuition Invoicing, Cashflow Ledgers, Expense Tracking & Payment Cards
Official School Letters, Digital Signatures, Dispositions & Archiving
Parent-Teacher Communication, Knowledge Base & Activity Feed
School Tenant Provisioning, Resource Quotas & Membership Tiers
“Refactoring our monolithic prototype into microservices on a sovereign VPS gave us the stability our schools needed. We can continue innovating rapidly in Google AI Studio while our production infrastructure runs reliably on PostgreSQL, backed by automated GitHub deployments and daily WhatsApp backup confirmations.”
Samkarsa deploys resilient multi-container distributed architectures on dedicated Hostinger KVM VPS instances. Benefit from AMD EPYC high-frequency computing, enterprise NVMe storage, and automated GitHub CI/CD delivery with zero vendor lock-in.
Deploy your sovereign VPS instance with verified zero-trust networking.
Explore Hostinger KVM VPSDon't gamble operational continuity on fragile monolithic code. Partner with Samkarsa to deconstruct your application into resilient microservices, harden your network perimeter, and automate continuous delivery.