Modular Architecture
Tasteful follows a clean, modular architecture that separates concerns into distinct layers. Each flavor is a self-contained module with its own business logic, data access, and configuration.Inspiration from Controller/Service/Repository Pattern
Tasteful’s modular architecture follows the proven Controller/Service/Repository pattern (similar to NestJS or Angular), adapting it for Python API applications:- Controller → Flavor: API endpoints and request/response handling
- Service: Business logic orchestration and workflow management
- Repository: Data access and persistence abstraction

Architecture Overview
The modular architecture is built around four key components that work together to create maintainable and scalable applications:Flavor
Module controller that defines routes, dependencies, and integration points
Service
Business logic and application rules
Repository
Data access and persistence abstraction
Config
Environment-specific settings and configuration
Core Components
1. Flavor (Controller)
The Flavor is the controller layer that defines API routes and handles HTTP requests. It should be kept as simple as possible, delegating all business logic to services.For more detailed information about Flavors, see the Flavors concept page.
Work in Progress: Code examples and implementation details are currently being updated to match the latest framework architecture. Documentation will be updated soon with accurate code samples.
- Keep controllers thin: Minimal logic, maximum delegation to services
- Handle HTTP concerns: Status codes, exceptions, request/response formatting
- Validate input: Basic request validation before passing to services
- Error handling: Convert service exceptions to appropriate HTTP responses
- Define API endpoints and routing
- Handle HTTP request/response logic
- Basic input validation and error handling
- Delegate business logic to services
2. Service (Business Logic)
The Service layer is where ALL business logic should live. This is the most important layer in your application - it contains the core functionality, business rules, and orchestrates complex operations.Important: Keep your Flavors (controllers) as thin as possible. All business logic, validation, and complex operations should be in the Service layer. Flavors should only handle HTTP concerns and delegate to services.
Work in Progress: Code examples for Service implementation are being updated to reflect the latest patterns and best practices. Complete examples will be available soon.
- All business logic lives here: No business rules in controllers or repositories
- Validation and rules: Implement all business validation and constraints
- Orchestration: Coordinate between different repositories and external services
- Error handling: Raise meaningful business exceptions
- Private methods: Use private methods to organize complex business logic
- Implement ALL business rules and validation
- Orchestrate complex workflows and data operations
- Handle business logic errors and exceptions
- Coordinate between repositories and external services
- Maintain data consistency and integrity
3. Repository (Data Connection)
This section is currently under development. Repository patterns and examples will be expanded soon.
Work in Progress: Repository implementation examples are currently being updated to match the latest framework architecture. Documentation will be updated soon with accurate code samples.
- Handle database operations (CRUD)
- Manage data queries and filters
- Abstract database implementation details
- Handle database connections and transactions
Complete repository documentation and patterns will be available soon.
4. Config
The Config component manages all configuration settings for the flavor, including environment variables, feature flags, and integration settings.Tasteful uses Pydantic Settings for configuration management. For advanced configuration patterns, see the Pydantic Settings documentation.
Work in Progress: Configuration implementation examples are currently being updated to match the latest framework architecture. Documentation will be updated soon with accurate code samples.
- Manage environment-specific settings
- Validate configuration values
- Provide default values
- Handle environment variables
- Configure external service integrations