- 📦 Module:
core
- 🔢 Version:
v0.01
This module provides the following foundational functions for all aspects of the app, and serves as the base for all other modules:
- Loading and applying environment variables from
.env
- Creating and wiring shared application state via
AppState
- Initializing PostgreSQL and Redis database connections
- Composing and registering all module routes into a single router
- Mounting static pages (
index.html, etc.) via ServeDir
- Providing global fallback and error normalization logic
- Health-check endpoint
Design
Requirements
Tests
Rate Limiting
- None (serves as a base module for all others)
.env config loading
- Global
AppState initialization
- Shared rate limiting middleware
- Static file serving
- Modular router integration
- 404 fallback handler
- Serves built frontend (React + Tailwind) from
/frontend/dist
- Handles basic static assets:
index.html, robots.txt, sitemap.xml
- No interactive client logic (delegated to frontend)
- Expects backend to expose standardized JSON responses
- No native UI handling defined
- No offline or push integration here
¶ Android Specific
- Compatible with generic HTTP client behavior
- No Android-specific tokens or services
- No push or broadcast logic
- Axum-based setup
.env variables loaded with dotenv
- Composes
AppState containing DB, Redis, config
- Registers all routers and paths modularly
- Attaches fallback 404 and error layers
- Serves static frontend from disk (via
ServeDir)
- Exposes health-check endpoints under
/healthz
- Connects to PostgreSQL using SeaORM
- Shared DB connector exposed in
AppState
- Credentials managed per-auth-context (authenticated vs anonymous)
- No core-specific database schema
- Redis connection pool initialized in shared state
- Caching logic split between authenticated/unauthenticated scopes
- Can be used for rate limiting and temporary tokens
- Rate limiter middleware is initialized globally
- Fallback handler returns sanitized JSON errors
- No authentication/authorization logic in this module (handled by
auth)
- Prevents exposure of internals via static file misrouting
- Implemented globally via Axum middleware
- All modules use a shared rate limiter initialized here
- Per-route rate limiting must be applied within individual modules
| Method |
Path |
Description |
| GET |
/api/ |
Returns base API metadata |
| GET |
/sitemap.xml |
Serves sitemap XML |
| GET |
/robots.txt |
Serves robots.txt |
| GET |
/healthz |
Healthcheck endpoint for uptime/LB |
- No associated database tables or SeaORM entities
Mermaid Diagram
erDiagram
core_module ||--|| AppState : uses