System Design

Architecture
Overview

AWS ap-southeast-1 deployment — Cloudflare CDN terminates TLS, traffic flows through dual ALBs into ECS Fargate containers backed by ElastiCache Redis.

Infrastructure · AWS ap-southeast-1
njinet · infrastructure · ap-southeast-1
👤
Client
browser / app
HTTPS
🔶
Cloudflare
api.njinet.site
▸ AWS Region — ap-southeast-1
VPC 10.0.0.0/16
🌐
Internet
Gateway
Public AZ-1 · 10.0.0.0/24
⚖️
ALB AZ-1
🔀
NAT
Gateway
Public AZ-2 · 10.0.1.0/24
⚖️
ALB AZ-2
:3000
:3000
Private AZ-1 · 10.0.10.0/24
🐳
ECS Fargate
NJinet :3000
Private AZ-2 · 10.0.11.0/24
🐳
ECS Fargate
NJinet :3000
:6379
Private Subnet Group
⚡
ElastiCache Redis
cache.t3.micro
📦
ECR
🔑
SSM Params
📊
CloudWatch
🗂️
S3
🔒
ACM Cert
🏗️
Terraform
IaC
Cloudflare CDN
VPC · Private Network
Public Subnet · ALB
Private Subnet · ECS / Redis
ECS Fargate Container
ElastiCache Redis
Terraform · IaC
System Context · Frontend & Backend
njinet · system context · c1 diagram
CI / CD — Frontend
▲
Vercel
auto deploy
Client Layer
🌐
Next.js App
React 19 · SSR
CI / CD — Backend
⚙️
GitHub Actions
build · push · deploy
deploy
HTTP REST
Socket.IO
deploy
Backend Runtime — njinet-service · NestJS
📡
HTTP API
REST endpoints
🔀
CQRS Bus
Command · Query · Event
🔌
WS Gateway
Socket.IO /chat
🧩
Domain Modules
chat · user · space
Prisma ORM
IORedis · BullMQ
AWS SDK presigned
AI SDK
Infrastructure
🐘
PostgreSQL
Prisma ORM
⚡
Redis / Valkey
Pub/Sub · BullMQ
🗂️
AWS S3
media · archives
🤖
LLM API
AI · external
Client · Next.js
CQRS Bus
Socket.IO Gateway
PostgreSQL
Redis / Valkey
AWS S3
LLM API
Tech Stack
Design Principles