๐๏ธ Architecture Overview
Last updated: 2026-05-20 ยท Owner: Engineering Lead
This document is the canonical reference for BeWith's system architecture. It is updated with every significant infrastructure change.
System Contextโ
BeWith operates as a SaaS platform with a React frontend, Node.js API layer, and PostgreSQL primary datastore. All services run on AWS.
Service Inventoryโ
| Service | Language | Deploy | Owns |
|---|---|---|---|
api-gateway | Node.js / Fastify | ECS Fargate | All HTTP routes, auth middleware |
notification-service | Node.js | ECS Fargate | Event processing, delivery orchestration |
websocket-hub | Node.js / Socket.io | ECS Fargate | Real-time connections |
worker | Node.js | ECS Fargate | Async jobs, exports, email digests |
web-app | React / TypeScript | CloudFront + S3 | Frontend SPA |
Request Lifecycleโ
Data Architectureโ
Databasesโ
| Store | Type | Use case |
|---|---|---|
| PostgreSQL 15 | Relational (primary) | All domain data |
| Redis 7 | Cache + Pub/Sub | Session cache, WS fan-out, rate limits |
| S3 | Object storage | User uploads, export files, static assets |
Multi-tenancyโ
BeWith uses row-level tenancy โ all tables include a workspace_id column. RLS policies enforce isolation at the database level.
Infrastructureโ
Key infrastructure decisions: โ See ADR-001