Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cgwire/zou/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Zou is built on Flask, a lightweight Python web framework, and follows a modular architecture that separates concerns into blueprints (routing), services (business logic), and models (data layer).Core Components
Flask Application
The main application is initialized inzou/app/__init__.py and configured with:
- Flask-SQLAlchemy - Database ORM for PostgreSQL
- Flask-JWT-Extended - JWT token authentication
- Flask-Principal - Role-based permissions
- Flask-Migrate - Database schema migrations
- Flask-Mail - Email notifications
- Flasgger - OpenAPI/Swagger documentation
zou/app/__init__.py
Configuration
The application configuration is environment-driven throughzou/app/config.py, supporting:
- Authentication strategies (local, LDAP, SAML)
- Database connection pooling
- JWT token expiration
- File storage backends (local, S3, Swift)
- Email settings
- Search indexer (Meilisearch)
- Two-factor authentication enforcement
Key Configuration Options
Key Configuration Options
Blueprint Architecture
Zou uses Flask blueprints to organize routes into logical modules. Each blueprint handles a specific domain:Blueprint Structure
Blueprint Registration
All blueprints are registered inzou/app/api.py:
zou/app/api.py
Example Blueprint
Each blueprint defines routes and maps them to resource classes:zou/app/blueprints/auth/__init__.py
Service Layer
The service layer contains all business logic and sits between blueprints (controllers) and models (data layer).Service Organization
Service Pattern
Services provide reusable business logic functions:Services are stateless and focus on business logic. They handle:
- Data validation and transformation
- Permission checks
- Event emission
- Cache management
- External API calls
Data Flow
Request Lifecycle
- HTTP Request arrives at a blueprint route
- Route dispatches to a Resource class method (GET, POST, PUT, DELETE)
- Resource validates input and calls service functions
- Service performs business logic and database operations
- Model interacts with PostgreSQL via SQLAlchemy
- Response is serialized and returned as JSON
Database Layer
Base Model
All models inherit fromBaseMixin which provides:
- UUID primary keys
- Audit timestamps (created_at, updated_at)
- Common query methods (get, get_by, get_all)
- CRUD operations (create, update, delete)
- Serialization support
zou/app/models/base.py
Connection Pooling
Zou uses SQLAlchemy’s connection pooling for performance:Caching Strategy
Zou uses Redis for caching frequently accessed data:- Memoization - Function result caching with TTL
- Auth tokens - JWT token blacklist for logout
- User data - Current user profile caching
- Project data - Active project information
Event System
Zou emits events for major operations, allowing plugins and external systems to react:Events are processed asynchronously and can trigger:
- Email notifications
- Slack/Discord messages
- Webhook calls to external systems
- Status automations
- Search index updates
Extensions & Integrations
Search Indexing
Zou integrates with Meilisearch for full-text search:File Storage
Supports multiple storage backends:- Local filesystem - Default for development
- Amazon S3 - Scalable cloud storage
- OpenStack Swift - Object storage
Authentication Providers
- Local - Built-in password authentication
- LDAP/Active Directory - Enterprise directory integration
- SAML SSO - Single sign-on support
- Two-Factor Auth - TOTP, Email OTP, FIDO2/WebAuthn
Scalability Considerations
Horizontal Scaling
Horizontal Scaling
Zou can be scaled horizontally by:
- Load balancing multiple Flask instances
- Shared Redis for cache and sessions
- PostgreSQL read replicas for read-heavy workloads
- CDN for static file delivery
- Background workers for async tasks (email, exports)
Performance Optimization
Performance Optimization
- Database query optimization with indexes
- N+1 query prevention with eager loading
- Response caching with Redis
- Connection pooling for database
- Pagination for large result sets
- Thumbnail generation for preview files
Next Steps
Data Model
Explore the core entities and their relationships
Authentication
Learn about JWT tokens and auth strategies
Permissions
Understand role-based access control
API Reference
Browse the complete API documentation