This document provides an overview of the EdgeOS system architecture, showing how various components interact to deliver functionality.
┌──────────────────────────────────────┐ ┌───────────────┐
│ │ │ │
│ Frontend │◄──────► Client │
│ │ │ Browser │
└───────────────────┬──────────────────┘ └───────────────┘
│
▼
┌──────────────────────────────────────┐
│ │
│ EdgeOS FastAPI Backend │
│ │
└───────────────────┬──────────────────┘
│
┌───────────┴───────────┐──────────────────────┐
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌───────────────┐ ┌─────────────────┐
│ │ │ │ │ │
│ PostgreSQL │◄─────► NocoDB │ │ Postmark │
│ Database │ │ │ │ Email API │
│ │ └───────────────┘ │ │
└────────────────┘ └────────┬────────┘
│
▼
┌─────────────────┐
│ │
│ End User │
│ Email │
│ │
└─────────────────┘
The EdgeOS architecture consists of the following major components, all containerized using Docker:
| Component | Description |
|---|---|
| FastAPI Backend | The core API service that handles business logic and data operations |
| PostgreSQL Database | Persistent storage for all application data |
| NocoDB | A no-code interface for database management without requiring SQL knowledge |
| Postmark | External email service for all communication with users |
The FastAPI application connects to PostgreSQL using SQLAlchemy ORM
Key interactions include:
- Database initialization during startup
- CRUD operations for all data entities (applications, citizens, payments, etc.)
- Transaction management for complex operations
- Schema validation using Pydantic models
Configuration details are stored in environment variables and managed through the Settings class in app/core/config.py.
NocoDB provides a user-friendly interface for database operations
Particularly useful for:
- Data visualization and exploration
- Simple CRUD operations without SQL knowledge
- Webhooks that trigger API functionality
The integration works as follows:
- NocoDB connects directly to the PostgreSQL database
- The API retrieves data from PostgreSQL through SQLAlchemy
- NocoDB webhooks call API endpoints to trigger specific business logic
The application uses Postmark for all email communications
- The
send_mailfunction inapp/core/mail.pyhandles communication with the Postmark API - Email templates are managed through Postmark's template system
- The application logs all email operations in the database for tracking
- Scheduled emails and reminders are handled by background processes
- User requests access via email
- System generates unique authentication URL using citizen spice
- Email sent via Postmark
- User clicks link and gains authenticated access
- User submits application data
- Data stored in PostgreSQL
- Status updates trigger webhook notifications
- Email notifications sent at various stages
- Payment information submitted
- Payment processed and recorded
- Confirmation emails sent
- Status updated in database
The system is containerized using Docker Compose for simplified deployment:
| Container | Purpose |
|---|---|
| API Container | Runs the FastAPI application |
| PostgreSQL Container | Runs the database with persistent volume |
| NocoDB Container | Runs the NocoDB service with persistent volume |
The containers are networked together, with PostgreSQL available only to the API and NocoDB containers for security.
The system integrates with Postmark for reliable email delivery
- Template-based emails for consistent formatting
- Delivery tracking and reporting
- Support for attachments
- Authentication emails with secure links
| Area | Approach |
|---|---|
| Configuration | Environment variables for sensitive configuration |
| Secrets | Secret keys and tokens stored securely |
| Authentication | API authentication using secure tokens |
| Database | Database credentials isolated within the Docker network |