How mailcow/cow-app works
Mailcow App is the Flask backend for the CowUI interface. A browser request reaches registered API or authentication resources; those handlers validate and process account, credential, and settings operations, persist application state, and—in account or mail-feature paths—delegate to the sync engine or Sieve service. The sampled code shows these handler and integration boundaries, but not every route implementation or the full database configuration, so unsampled relationships are omitted rather than inferred.
Main entry points: api/views.py API handlers · utils.py Account and token logic · __init__.py App bootstrap · auth/views.py Auth handlers
Components 24
Application runtime
- Flask server
server.py - App bootstrap
app/__init__.py - Validation logger
app/logger.py - Runtime config
config.py
CowUI API
- API routes
app/api/routes.py - API handlers
app/api/views.py - Users and settings
app/api/models.py - API errors
app/api/exceptions.py - Request validation
app/api/validation/validate.py - Settings schema
app/api/validation/schemas/settings.py - HTTP responses
app/httputils.py
Authentication and accounts
- Auth routes
app/auth/routes.py - Auth handlers
app/auth/views.py - Account and token logic
app/auth/utils.py - Token model
app/auth/models.py - Auth errors
app/auth/exceptions.py
Mail settings
- Mail settings logic
app/api/utils.py - Sieve renderer
app/sieve_templates/template.py - CowUI Sieve template
app/sieve_templates/cowui.sieve
External services
- Sync account service
app/auth/services.py - Sync engine
- IMAP and SMTP
- ManageSieve server
Other components
- Browser user
Connections 27
- Browser user → Flask server: sends requests
README.md - Flask server → App bootstrap: runs app
server.py - App bootstrap → Runtime config: loads config
app/__init__.py - App bootstrap → API routes: registers routes
app/__init__.py - App bootstrap → Auth routes: registers routes
app/__init__.py - App bootstrap → API errors: configures errors
app/__init__.py - API routes → API handlers: routes requests
app/api/routes.py - Auth routes → Auth handlers: routes requests
app/auth/routes.py - API handlers → Users and settings: queries and updates
app/api/views.py - API handlers → Request validation: validates settings
app/api/views.py - Request validation → Settings schema: loads schema
app/api/validation/validate.py - API handlers → HTTP responses: builds responses
app/api/views.py - API handlers → Account and token logic: calls account logic
app/api/views.py - API handlers → Mail settings logic: uses mail utilities
app/api/views.py - Auth handlers → Account and token logic: calls auth logic
app/auth/views.py - Auth handlers → Users and settings: queries users
app/auth/views.py - Account and token logic → Users and settings: updates records
app/auth/utils.py - Account and token logic → Token model: stores tokens
app/auth/utils.py - Account and token logic → Auth errors: handles token errors
app/auth/utils.py - Account and token logic → Sync account service: delegates account sync
app/auth/utils.py - Sync account service → Sync engine: calls account API
app/auth/services.py - API handlers → Sync engine: proxies API calls
app/api/views.py - Request validation → Validation logger: logs validation
app/api/validation/validate.py - Mail settings logic → Sieve renderer: renders template
app/api/utils.py - Mail settings logic → CowUI Sieve template: loads template
app/api/utils.py - Mail settings logic → ManageSieve server: updates scripts
app/api/utils.py - Auth handlers → IMAP and SMTP: checks credentials