The architecture of the PhoenixUptime backend is designed to provide a scalable, secure, and efficient uptime monitoring solution. Below is a detailed step-by-step breakdown of the system components.
Component | Description |
---|---|
Fiber | A lightweight web framework used to handle HTTP requests, routing, and middleware integration. It is fast and efficient, making it ideal for high-performance APIs. |
Purpose | Manages routing, middleware, and request processing for API endpoints. |
Steps:
- Initializes the server.
- Configures middleware like CORS, logging, and authentication.
- Routes incoming requests to the appropriate handlers.
Component | Description |
---|---|
Session ID / API Key Auth | Authenticates users with session IDs stored in BadgerDB or via API keys. Secures access to protected API endpoints. |
Steps:
- Checks incoming requests for valid session IDs or API keys.
- Validates credentials against stored values in the cache or database.
- Grants or denies access based on authentication results.
Component | Description |
---|---|
Endpoints | Manages API requests for users, monitoring services, and alerts. |
Steps:
- Handles CRUD operations for user accounts, monitoring configurations, and alert settings.
- Validates inputs and responds with appropriate data or error messages.
Component | Description |
---|---|
Validation Layer | Validates incoming request data to ensure correctness and security. |
Parsing | Parses JSON payloads and prepares them for processing. |
Steps:
- Checks request formats and required fields.
- Converts data into usable formats for internal processing.
Component | Description |
---|---|
Scheduler | Manages scheduling of uptime checks at regular intervals. |
Steps:
- Schedules uptime checks for configured services.
- Triggers checks at defined intervals.
Component | Description |
---|---|
Executors | Sends HTTP/HTTPS requests to services and measures response time. |
Steps:
- Executes HTTP requests to target URLs.
- Measures response status, time, and other critical metrics.
Component | Description |
---|---|
Processing Layer | Analyzes the results of uptime checks and determines actions based on performance or downtime. |
Steps:
- Evaluates response data from checks.
- Flags failures and generates alerts if thresholds are breached.
Component | Description |
---|---|
Alerting System | Sends notifications via email, SMS, or webhooks based on monitoring results. |
Steps:
- Determines alert type based on configuration.
- Sends notifications to the configured channels.
Component | Description |
---|---|
Database | Handles persistent data storage for user information, monitoring configurations, and alert logs. |
ORM | Uses GORM for database interaction, supporting Postgres primarily and SQLite as a fallback. |
Steps:
- Connects to the database and manages data transactions.
- Runs migrations to maintain the schema.
Component | Description |
---|---|
BadgerDB | Provides fast access to session data and temporary storage of frequently accessed information. |
Steps:
- Manages session data and caching to reduce database load.
- Enhances performance by quickly retrieving frequently used information.