Skip to main content

API Architecture

The statux-api/ repository is a NestJS monorepo containing three applications and three shared libraries.

Monorepo Structure

statux-api/
├── apps/
│ ├── statuspages/ # Port 3000, api.statux.io
│ ├── alerting/ # Port 3001, alerts-api.statux.io
│ └── synthetics/ # Port 3002, synthetics-api.statux.io
├── libs/
│ ├── common/ # @app/common
│ ├── auth/ # @app/auth
│ └── database/ # @app/database
├── package.json # Root dependencies
└── nest-cli.json # Monorepo config

Database Schemas

Each application uses a separate PostgreSQL schema:

AppSchemaDatabase
Statux Pagesstatuspagesstatux
Statux Alertsalertsstatux
Statux Syntheticssyntheticsstatux

Shared entities (Organization, Subscription) use the core schema.

Shared Libraries

@app/common

  • ApiResponse interface and ResponseInterceptor
  • PaginationQueryDto for list endpoints
  • HttpExceptionFilter for error handling
  • EncryptionService for AES-256-GCM encryption

@app/auth

  • JwtStrategy for Cognito JWT validation
  • JwtAuthGuard, ProjectAccessGuard, OrgRolesGuard
  • @CurrentUser(), @CurrentProject(), @Public() decorators

@app/database

  • BaseEntity with id, createdAt, updatedAt
  • Shared entities: Organization, OrganizationMember, UserProduct, etc.
  • DatabaseModule.forRoot() configuration

See Shared Libraries for detailed usage.