ATStatus
ATStatus WikiLoading documentation...

Architecture

A technical overview of how ATStatus is designed, built, and operates.

Modern Stack

ATStatus is built on a modern, proven technology stack optimized for performance, reliability, and developer experience.

Technology Stack

Frontend
  • • Next.js 14 (App Router)
  • • React 18 with Server Components
  • • TypeScript for type safety
  • • Tailwind CSS for styling
  • • shadcn/ui component library
  • • Radix UI primitives
Backend
  • • Next.js API Routes
  • • Prisma ORM (database abstraction)
  • • Zod for validation
  • • Custom session management
  • • RBAC permission system
  • • Rate limiting middleware
Database
  • • SQLite (embedded, default)
  • • Prisma migrations
  • • 25 data models
  • • Hash-chained audit trail
  • • Automatic backups supported
Security
  • • SHA-256 password hashing
  • • HMAC session signatures
  • • CSRF token protection
  • • TOTP two-factor auth
  • • Step-up authentication
  • • API key management

System Design

Application Flow

┌─────────────────────────────────────────────────────────────┐
│                        Client Browser                        │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                     Next.js Application                      │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────┐  │
│  │  Public Pages   │  │   Admin Panel   │  │  API Routes │  │
│  │  (Status Page)  │  │  (Dashboard)    │  │  (REST API) │  │
│  └────────┬────────┘  └────────┬────────┘  └──────┬──────┘  │
│           │                    │                   │         │
│           └────────────────────┼───────────────────┘         │
│                                ▼                             │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │                   Middleware Layer                       │ │
│  │  • Authentication  • RBAC  • Rate Limiting  • CSRF      │ │
│  └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                      Prisma ORM Layer                        │
│  • Query Building  • Type Safety  • Migrations               │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                    SQLite Database                           │
│  • StatusPages  • Components  • Incidents  • Users          │
│  • Audit Logs   • Sessions    • Settings   • Monitors       │
└─────────────────────────────────────────────────────────────┘

Monitoring Architecture

┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│   Component  │     │   Component  │     │   Component  │
│   (Service)  │     │   (Service)  │     │   (Service)  │
└──────┬───────┘     └──────┬───────┘     └──────┬───────┘
       │                    │                    │
       └────────────────────┼────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                    Monitor Daemon                            │
│  • Scheduled checks (cron or interval)                       │
│  • 25+ monitor types (HTTP, TCP, DNS, DB, etc.)             │
│  • Response time tracking                                    │
│  • SSL certificate monitoring                                │
└─────────────────────────────────────────────────────────────┘
                            │
                ┌───────────┼───────────┐
                ▼           ▼           ▼
         ┌──────────┐ ┌──────────┐ ┌──────────┐
         │ Status   │ │ Monitor  │ │ Notifi-  │
         │ Update   │ │ History  │ │ cations  │
         └──────────┘ └──────────┘ └──────────┘

Core Data Models

ATStatus uses 25 Prisma models to manage all data:

ModelPurposeKey Fields
StatusPageStatus page instanceslug, name, isDefault, isEnabled
StatusPageSettingsPage configuration (80+ fields)branding, layout, features, notifications
ComponentMonitored servicename, status, monitorUrl, sslExpiry
ComponentGroupComponent organizationname, displayOrder, collapsed, parentId
IncidentService disruptiontitle, status, severity, RCA fields
IncidentUpdateIncident timelinemessage, status, createdAt
MaintenancePlanned maintenancetitle, windowStart, windowEnd, recurring
UserAdmin accountemail, role, 2FA settings
SessionUser sessiontokenHash, expiresAt, device info
AuditEventEnterprise audit logaction, actor, hash chain
MonitorLogCheck historystatus, latencyMs, checkedAt
NotificationSettingWebhook configurationtype, webhookUrl, event toggles

Security Architecture

Layer 1: Transport

HTTPS enforcement, secure cookies, TRUST_PROXY for reverse proxy setups

Layer 2: Authentication

SHA-256 password hashing, HMAC-signed sessions, database-backed tokens, TOTP 2FA

Layer 3: Authorization

Role-based access control (RBAC), 50+ granular permissions, step-up auth for sensitive actions

Layer 4: Request Protection

CSRF tokens, rate limiting, input validation with Zod, parameterized queries

Layer 5: Audit & Compliance

Hash-chained audit trail, tamper detection, complete action logging, GDPR consent tracking

File Structure

statuspage-clean/
├── app/                      # Next.js App Router
│   ├── admin/               # Admin panel pages
│   │   ├── (dashboard)/    # Dashboard layout group
│   │   │   ├── components/ # Component management
│   │   │   ├── incidents/  # Incident management
│   │   │   ├── users/      # User management
│   │   │   └── ...         # Other admin pages
│   │   └── login/          # Authentication
│   ├── api/                 # API Routes (70+ endpoints)
│   │   ├── auth/           # Authentication APIs
│   │   ├── components/     # Component APIs
│   │   ├── incidents/      # Incident APIs
│   │   └── ...             # Other APIs
│   ├── status/             # Public status pages
│   └── history/            # Incident history
├── components/              # React components
│   ├── admin/              # Admin-specific components
│   ├── status/             # Status page components
│   └── ui/                 # shadcn/ui components
├── lib/                     # Utility libraries
│   ├── auth.ts             # Authentication logic
│   ├── rbac.ts             # Permission system
│   ├── monitor.ts          # Monitoring logic
│   └── ...                 # Other utilities
├── prisma/
│   ├── schema.prisma       # Database schema
│   └── migrations/         # Database migrations
├── scripts/                 # Utility scripts
│   ├── setup.js            # Initial setup
│   └── monitor-daemon.js   # Background monitor
└── public/                  # Static assets

Performance Considerations

  • Server Components: Most pages use React Server Components for optimal performance
  • Static Generation: Public pages can be statically generated where appropriate
  • Incremental Regeneration: Status pages update incrementally for fast refreshes
  • Connection Pooling: Prisma manages database connections efficiently
  • Caching: Built-in cache management for frequently accessed data
  • Optimistic Updates: Admin UI uses optimistic updates for responsiveness