Skip to main content
A VeloIQ module is a Python package that lives under backend/app/modules/. Each module owns one domain concept — its models, generated API, custom endpoints, and admin views. On startup, the framework scans app/modules/*/ and registers every module it finds automatically. You never add import statements to main.py.

Module directory layout

Creating a module

Use the CLI to scaffold a new module:
Add optional flags to include extra files in the scaffold:

models.py

Define your entities by inheriting from one of the framework base classes (FrameworkModel, TimestampedModel, or StandardModel). See Models for the full reference on base classes, field types, and relationships.

api.py — generated CRUD endpoints

After running veloiq generate, each module has an api.py that creates a complete CRUD router for your model:
create_crud_router generates these endpoints automatically: List responses include x-total-count and content-range headers to support the Refine data provider pagination convention.
Do not edit api.py. It is overwritten every time you run veloiq generate. Put all custom logic in custom_api.py instead.

custom_api.py — custom endpoints

For business-specific endpoints, create custom_api.py in the module directory and import router from the generated api.py. Add routes to that router and the framework loader picks them up automatically.
The framework imports both api.py and custom_api.py on startup — you don’t need to register the router anywhere else.

admin/admin_views.py — back-office views

Add an SQLAdmin ModelView to expose your model in the admin panel at /admin/.

Frontend schema files

veloiq generate creates a TypeScript schema file for each module that the DynamicResource UI component reads to render list, detail, create, and edit views. To customise or extend the generated schema, create {module}Schema.manual.ts in the same directory and merge it into {module}Schema.ts. Refer to the @veloiq/ui documentation for the ModelDef and FieldDef type reference.

Module auto-loading

On every startup, create_veloiq_app() scans app/modules/*/ and, for each subdirectory that contains an __init__.py, imports models.py, api.py, and custom_api.py (if present) and registers any ModelView classes found in admin/admin_views.py. Because of this automatic discovery, main.py never grows beyond a single line:
Pass a VeloIQConfig instance to create_veloiq_app() when you need to configure roles, the database URL, or other settings. The defaults work for local development with SQLite.

Models

Define fields, base classes, and relationships

Access Control

Apply RBAC and ReBAC to your modules and fields