CASE STUDY · 03 / 15 · BACKEND · 2026
Futureogy
Talk to an astrologer in seconds, paid by the minute.
470+
REST ENDPOINTS
6
BUILDS, ONE PLATFORM
100+
ADMIN SCREENS
100+
DATABASE MIGRATIONS
THE BRIEF
The problem
People who want astrology guidance usually go by word of mouth and pay up front, with no idea how long a session will run. Futureogy wanted a marketplace where you see who is online, start a chat, call or video in seconds, and pay only for the minutes you use, while the business can watch revenue, payouts and quality in one place.
My part
I built the whole product, from mobile to admin to backend to cloud. The user and expert apps in Flutter, the Next.js admin console, the futureogy.com website, the NestJS backend with its real-time layer, and the production AWS platform, designed and run as code in CDK. One person across every layer, so the apps, the API and the infrastructure were shaped together.
Six builds. One product.
- 01Backend & real-time38 modules and 470+ endpoints: OTP auth with revocable sessions, wallet, per-minute billing, Socket.IO presence and the payment webhooks.NESTJS · POSTGRES · REDIS
- 02Admin consoleRevenue, users, astrologers and retention dashboards, plus payouts, refunds, GST, remedies, banners and role-based access.NEXT.JS 16
- 03User appExpert discovery, wallet top-ups, chat, voice and video consultations, free tools, remedies and AI astrologers.FLUTTER · iOS · ANDROID
- 04Expert appGo online, accept incoming requests, consult with Live Activities on the lock screen, track earnings and payouts.FLUTTER · iOS · ANDROID
- 05WebsiteThe futureogy.com marketing site and legal pages, on Next.js.NEXT.JS
- 06AWS platform & CI/CDA private VPC across two availability zones behind WAF and a load balancer; Fargate services; encrypted Postgres and Valkey; GitHub Actions releases with snapshots and one-click rollback. All of it in CDK.ECS · RDS · VALKEY · CDK
How a consultation flows.
Pick a step to see what runs underneath.
STEP 01 · USER APP + BACKEND
A phone OTP issues short-lived access and refresh tokens. Every request is checked against a session row in Postgres, so logging out or blocking a user takes effect instantly.
UNDER THE HOOD
ARCHITECTURE
A production AWS platform I designed and wrote as code, sized for launch and ready to scale.
EDGE
WAF + load balancer, TLS
COMPUTE
2–4 API tasks + 1 worker on Fargate
REAL-TIME
Socket.IO, Valkey pub/sub
DATA
Postgres 17, Valkey, S3 + CloudFront
DELIVERY
CDK, GitHub Actions via OIDC
APP → WAF → LOAD BALANCER → AUTOSCALED API TASKS → POSTGRES / VALKEY IN ISOLATED SUBNETS · ONE WORKER FOR CRONS · ONE FIXED IP OUT · FULL DIAGRAM IN FIG. 03
Decisions that mattered.
01 · REAL-TIME
Publish through Redis, never one server.
Presence and session state go through a Redis publisher and a bridge on every instance, so the API scales out without users seeing stale availability.
02 · BILLING
Clocks on the server, not the phone.
Scheduled jobs drive ringing, billing and low-balance cut-offs, with a grace window for dropped connections, so a flaky network never bills the wrong amount.
03 · RELEASES
Promote the tested image, not a rebuild.
Production runs the exact image tested on dev. Each release snapshots the database, runs migrations as a one-off task, then rolls out with a circuit breaker. Migrations only add, so rollback is one click and never needs a restore.
04 · SECURITY
Only the load balancer faces the internet.
App tasks sit in private subnets; Postgres and Valkey sit in isolated ones with no internet route and TLS required. Secrets live in Secrets Manager, and GitHub deploys through an OIDC role, so there are no long-lived AWS keys.
05 · SCALING
API tasks scale; crons never double up.
The API autoscales from 2 to 4 tasks on CPU and memory, with crons switched off. Exactly one worker task runs every schedule, so adding servers never bills a session twice.
06 · OPERATIONS
One fixed IP out, and alarms on everything.
All calls to SMS, payment and video providers leave through a NAT instance on one Elastic IP that partners can allowlist. CloudWatch alarms on 5xx, health, latency, CPU, database and cache email the team, and WAF rate-limits OTP abuse.
07 · MEDIA
Private buckets, served at the edge.
Uploads land in private, versioned S3 buckets and reach the apps only through CloudFront. Call recordings move to Glacier after 90 days, and tasks reach S3 through a free private endpoint.
08 · COST
Sized for launch, with the next step written down.
ARM Graviton instances, a small NAT instance instead of a managed gateway, and a single-AZ database at launch. The upgrade path, Multi-AZ and a managed NAT on the same IP, needs no downtime.
WHAT I SHIPPED
- A NestJS backend with 38 modules, 470+ endpoints, 47 tables and 100+ migrations, with 60+ test suites
- An admin console with 100+ screens that runs finance, astrologers, catalog and support
- The whole production platform on AWS as code in CDK (network, certificates, data, storage and app stacks), across two availability zones
- Zero-downtime releases: approval-gated deploys, a database snapshot before every release, 14-day point-in-time recovery and one-click rollback
- Both Flutter apps live on Google Play, plus the futureogy.com website on Next.js
STACK

