Directory Overview
The project follows a modular architecture organized by domain and responsibility:Architectural Layers
The application follows a layered MVC architecture with clear separation of concerns:Presentation
routes.py + templates/Handles HTTP requests, renders views, manages form submission
Business Logic
services.pyContains domain logic, validations, and orchestrates operations
Data Layer
models/Defines entities and database mappings using SQLAlchemy ORM
Layer Responsibilities
| Layer | Files | Responsibility |
|---|---|---|
| Presentation | routes.py + templates/ | Define routes, receive HTTP requests, render HTML with Jinja2 |
| Services | services.py | Business logic, validations, operation orchestration |
| Models | models/*.py | Define entities and map to database tables via SQLAlchemy ORM |
| Configuration | config.py, extensions.py | Environment config, database connection, Flask extensions |
Module Organization
Domain Module Structure
Each domain module (e.g.,colors, wood_types) follows a consistent structure:
Example: Colors Module
Blueprint Registration
__init__.py creates and exports the Flask Blueprint:app/catalogs/colors/__init__.py
Request Flow
Understanding how a request flows through the application:Core Components
Application Factory
Thecreate_app() function in app/__init__.py creates and configures the Flask application:
app/__init__.py
Extensions
Flask extensions are initialized inapp/extensions.py:
app/extensions.py
Configuration
Application configuration inconfig.py:
config.py
Database Models
Models define the database schema using SQLAlchemy ORM. Example fromapp/models/color.py:
app/models/color.py
Template Organization
Templates are organized by module with a shared base template:base.html- Shared layout with navigation and flash messages{module}/list.html- List/index view{module}/create.html- Create form{module}/edit.html- Edit formerrors/error.html- Generic error page
Next Steps
Coding Conventions
Learn the project’s coding standards
Templates Guide
Work with Jinja2 templates
Forms Guide
Create and validate forms
Deployment
Deploy to production