ื“ืœื’ ืœืชื•ื›ืŸ ื”ืจืืฉื™

๐Ÿ—๏ธ 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โ€‹

ServiceLanguageDeployOwns
api-gatewayNode.js / FastifyECS FargateAll HTTP routes, auth middleware
notification-serviceNode.jsECS FargateEvent processing, delivery orchestration
websocket-hubNode.js / Socket.ioECS FargateReal-time connections
workerNode.jsECS FargateAsync jobs, exports, email digests
web-appReact / TypeScriptCloudFront + S3Frontend SPA

Request Lifecycleโ€‹


Data Architectureโ€‹

Databasesโ€‹

StoreTypeUse case
PostgreSQL 15Relational (primary)All domain data
Redis 7Cache + Pub/SubSession cache, WS fan-out, rate limits
S3Object storageUser 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