Scaffolding a Server
The bloom server CLI commands provide Django-style scaffolding for entire backend server projects and modular domain applications.
Creating a New Server Project
Run bloom server create <name> to generate a complete backend server repository configured with starter apps, migrations, and a database connection:
CLI Options & Flags:
<name>— Required project name (lowercase letters, numbers, and underscores, starting with a letter).--db=<postgres|sqlite>— Default database dialect forsettings.dart(defaults topostgres).--packages-path=<path>— Optional path to directory containing localbloom_*server packages.
Project Structure & Layout
A scaffolded Bloom Server project follows a standardized, modular layout with two pre-configured starter apps: accounts (user authentication) and notes (ownership-scoped CRUD):
Core Packages Installed
Every scaffolded server project wires in the "core 7" package list in pubspec.yaml, plus dev dependencies:
Core router, requests, responses, DI container, and env config.
ORM runtime, QuerySet API, and PostgreSQL / SQLite executors.
Declarative request body validation schemas.
BCrypt password hashing, JWT tokens, and auth middleware.
Unified error middleware with dev/prod exception masking.
DRF-style ViewSets, serializers, pagination, and filters.
DDL migration runner and schema version tracking.
Optional build_runner codegen for @BloomModel annotations.
Scaffolding New Modular Apps
To add a new domain feature to your project, use bloom server startapp <app_name>:
This command generates:
lib/apps/<app_name>/models.dart— Starter model with@BloomModelandModelMeta.lib/apps/<app_name>/serializers.dart— Placeholder forBloomRequestSchemasubclasses.lib/apps/<app_name>/views.dart— Placeholder for view handlers and ViewSets.lib/apps/<app_name>/permissions.dart— Permissions exports.lib/apps/<app_name>/urls.dart— App-level route registration function.migrations/<app_name>/0001_initial.sql— Initial DDL migration SQL file.
The CLI also automatically wires the new app into lib/urls.dart by adding the import and registering its routes in registerUrls().
Mounting App Routes in urls.dart
The root lib/urls.dart acts as the central router aggregator, similar to Django's root urls.py: