Introduction

The Stack

An overview of the RawStack architecture and the components that make it up.

RawStack is a monorepo organised into four areas:

PathPurpose
apps/Application packages — API, Web, Admin, App
services/Microservices — Notification
packages/Shared packages — API client
infrastructure/AWS CDK stacks

Components

API (apps/api)

NestJS backend with PostgreSQL, Redis, and JWT authentication. Follows CQRS + Domain-Driven Design. Runs on port 3001 locally or deploy to AWS ECS.

Web (apps/web)

Next.js public-facing website. Uses the shared API client, React Query for data fetching, and Tailwind CSS. Runs on port 3000 locally or deploy to AWS ECS.

Admin (apps/admin)

React + Vite admin dashboard. Includes data tables, drag-and-drop, and real-time API integration. Deployed as a static SPA to S3 + CloudFront.

App (apps/app)

React Native mobile application for iOS and Android. note: this is not great

Notification (services/notification)

AWS Lambda microservice for email and SMS notifications. Triggered by EventBridge events from the API. Uses Resend for email and Twilio for SMS.

Infrastructure (infrastructure/aws)

AWS CDK TypeScript project that provisions the full cloud environment — VPC, RDS, ElastiCache, ECS Fargate, ALB, S3, CloudFront, and Route 53.

Shared packages

API Client (packages/api-client)

Auto-generated TypeScript client built from the API's OpenAPI spec. Used by Web, Admin, and App to communicate with the API. Provides fully-typed request/response models.

How the pieces connect

Browser / Mobile App


CloudFront CDN

  ┌────┴────────────────┐
  │                     │
Next.js (Web)     S3 (Admin SPA)
  │                     │
  └────────┬────────────┘

    ALB (Application Load Balancer)

    ECS Fargate (NestJS API)

    ┌──────┴──────┐
    │             │
  RDS          ElastiCache
(PostgreSQL)    (Redis)

    EventBridge

    Lambda (Notification)

   Resend / Twilio

note: AWS diagram here would be great note: should components be called apps?