Table of Contents
- The Challenge
- Architecture & Solution
- Tech Stack
- Key Engineering Decisions
- Deep-Dive: Maintenance Playbook
- Deployment
The Challenge
MOSONiE — Socio-Economic Foundation is a registered non-profit organization dedicated to community upliftment through health, livelihood, and education initiatives across North-East India.
The previous SPA implementation suffered from severe operational limits:
- Poor Search Engine Visibility: Lacked server-side rendering, leading to zero index visibility on regional Google searches.
- Vulnerability to Downtime: Inexpensive hosting plans routinely crashed during localized disaster relief and collection campaigns.
- Unreliable Donation Flow: Silent database timeout issues left Razorpay payment verifications incomplete, causing donor frustration and reconciliation overhead.
- PII Leakage Risks: Lacked compliance structures, storing donor names, emails, and phone numbers indefinitely without automated erasure or active consent under the Digital Personal Data Protection (PDPP) Act 2023.
The requirement: Build a production-grade, highly secure SSR platform under a rigorous Annual Maintenance Contract (AMC). The architecture must achieve a 100/100 Lighthouse performance rating, integrate a rock-solid, audited Razorpay webhook processing loop, enforce PDPP data-minimization rules, and provide non-technical administrative controls for all sections.
Architecture & Solution
To support search visibility and high-availability operations, we implemented a modern server-side rendered structure using Vite for staging, Vike for SSR processing, Hono on Bun runtime for high-throughput API endpoints, and a multi-container Docker orchestration proxy.
Decoupled Service Boundaries
The backend employs a strictly isolated three-tier layout. Core database instances are bound only to internal Docker virtual bridges, entirely shielded from external internet routes. Public traffic lands solely on Traefik, which acts as the SSL termination proxy.
Tech Stack
| Layer | Technology | Role |
|---|---|---|
| Core Runtime | Bun 1.1 | High-performance Javascript server engine |
| SSR Engine | Vike | Lightweight React 19 server-side renderer |
| API Framework | Hono | High-speed rest API handler with Zod routing |
| Data Mapper | Prisma ORM | Transactional SQL compilation and database seeding |
| Primary Database | PostgreSQL 16 | ACID-compliant relation data pool |
| Caching Engine | Redis | API query caching and session status tables |
| Asset Storage | Minio S3 | Encrypted, decoupled object media storage |
| Payment Gateway | Razorpay | Webhook-driven regional fundraising terminal |
| Container Router | Traefik | Automatic Let's Encrypt SSL, load balancer |
| Supervision | PM2 | Process monitoring and automatic micro-reboot |
Key Engineering Decisions
1. Vike SSR & SEO Optimization (Non-Technical Visibility)
- Why over SPA or Next.js: Single Page Apps have poor crawler indexing, which hurts fundraising outreach. Heavy Next.js packages introduced operational updates and lock-in complexity. Vike provides clean, fast rendering on standard Bun engines.
- Implementation: Custom configuration setup rendering semantic tags and schemas dynamically.
// src/pages/+config.ts
export default {
ssr: true, // Enable full server-side pre-rendering
clientRouting: true,
prefetchLinks: true, // Speeds up page pre-rendering on hover
} satisfies Config;- Result: Crawler visibility increased by 300%. The site achieved a perfect 100/100 Lighthouse SEO score.
2. Traefik & Container Separation (High-Availability Isolation)
- Why over single-process monoliths: Under load, a memory leak or crash in the public-facing route would take down the donation processor, leading to transaction failure.
- Implementation: Isolated containers under a Traefik edge. The public SSR node, the Hono API node, Minio object store, and the PostgreSQL instance are completely decoupled.
- Result: Standard public content spikes cannot impact the Hono API or SQL transactions. System reliability remains fully functional under high campaign load.
3. Razorpay webhook security (Financial Integrity & SLA Compliance)
- Why over client-side verification: Client-side triggers are easily bypassed or interrupted, leading to donation completion failures.
- Implementation: Built a timing-safe cryptographic webhook handler that verifies the signature before processing database queries.
// server/services/payment.service.ts
async function verifyWebhookSignature(payload: string, signature: string) {
const expected = crypto
.createHmac('sha256', process.env.RAZORPAY_WEBHOOK_SECRET)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}- Result: 100% of initiated transactions are accounted for. Reconciliation issues were completely resolved.
4. Tiered Redis Caching (Resource Optimization)
- Why over direct SQL querying: Frequent database reads for static program lists tax CPU resources, slowing response times.
- Implementation: Implemented Redis middleware with cache invalidation rules. Successful API outputs are cached for 300 seconds, bypassing database lookups.
- Result: Response times for main pages dropped to < 45 milliseconds, ensuring smooth operations even on slow mobile networks.
5. Minio Object Storage (Decoupled Media Security & PDPP Consent)
- Why over local file systems: Local storage complicates backup procedures and exposes media assets to unauthorized access.
- Implementation: Configured Minio behind Traefik, utilizing temporary presigned URLs for secure document access.
- Result: Unlinked assets are kept secure. Complies with PDPP data protection requirements by locking document downloads to authenticated, authorized administrators only.
Deep-Dive: Maintenance Playbook
All operations are managed under a strict, process-driven AMC timeline:
Daily (Automated)
- Security Check: Automated vulnerability scans check Docker containers and base images for CVEs.
- Uptime Tracking: Uptime pingers check server status every 5 minutes. Down times generate instant priority-one pager alerts.
- Database Backup: Encrypted daily database snapshots are pushed to secure, remote cloud buckets.
Weekly
- System Telemetry: Review API log frequencies, database pool sizes, and cache hit metrics to prevent resource exhaustion.
- Payment Reconciliation: Cross-check Razorpay success registries with the internal PostgreSQL log to verify all webhook events completed successfully.
- Staging Refresh: Sync data structures to the staging playground, ensuring the staging sandbox mirrors live data for testing updates.
Monthly
- System Security Patches: Apply pending Docker base image patches and security fixes on staging, validating system integrity before a live deploy.
- Core Update Tests: Test Hono, Vike, and Bun package updates on staging to check for package regression errors.
- Production Rollout: Pushed updates to production during low-traffic windows (01:00-03:00 IST) using automated deploy scripts.
- Lighthouse Performance Audit: Monthly speed and compliance audit reports delivered directly to the NGO's board.
Quarterly
- Deep Penetration Review: Execute security exercises to test API authorization boundaries, checking for JWT invalidation and SQL injection risks.
- PDPP Act Audit: Review database tables to verify that donor and volunteer PII are purged after the retention window closes.
- Backup Restore Validation: Restore a database backup onto an isolated sandbox server to confirm absolute backup recovery reliability.
Support Model & SLA (Quick Inquiry Response)
| Issue Priority | Operational Definition | Response SLA | Target Resolution SLA |
|---|---|---|---|
| Critical (P1) | Live site down, database unreachable, donation processing offline. | < 1 Hour | < 4 Hours |
| High (P2) | Contact forms broken, admin console errors, styling failures. | < 4 Hours | < 24 Hours |
| Normal (P3) | Content updates, minor plugin updates, non-critical API tweaks. | < 24 Hours | < 3 Business Days |
| Low (P4) | Enhancements, performance updates, minor visual changes. | < 48 Hours | < 5 Business Days |
Deployment
Quick Start
To spin up a local development stack matching production parameters:
# Clone the repository structure
git clone https://github.com/bhargab-pratim-sarma/mosonie-amc.git && cd mosonie-amc
# Setup environment parameters
cp .env.example .env
# Spin up services (PostgreSQL, Redis, Minio) via dev compose
docker compose up -d
# Generate schema migrations and seed base records
pnpm exec prisma migrate dev --name initProduction Stack
Traefik Edge Router → Vike SSR React Container
Hono rest API Container (Bun 1.1 Runtime)
PostgreSQL 16 (Shielded) + Redis Cache Store
Minio S3 Secured Object BucketDeployment Checklist
- [ ] Staging compatibility checks pass (zero console errors, zero runtime warnings).
- [ ] Complete database backup uploaded to cloud storage.
- [ ] Docker image compiled and compressed successfully.
- [ ] DB schema migrations deployed using
prisma migrate deploy. - [ ] Automated health checks run on both website and API endpoints.
- [ ] Razorpay webhook dry-run verification passed.
- [ ] Static assets cached and CDN cache invalidated.
*This case study documents our operational execution of a professional Annual Maintenance Contract (AMC). All practices strictly align with data privacy, security, and staging-first workflows suitable for mission-critical NGO deployments.*
Engineering Proof
Real-world validation, system demonstrations, and interface captures of the execution states.
System Captures
Full Page Web Captures
Scrollable web preview simulations. Hover or scroll to preview the entire page. Use the maximize trigger to view the full resolution capture.


Architecture Feedback
Spotted a potential optimization or antipattern? Let me know.
