Quick Start¶
Create your first FastAPI project with MoltPy in under a minute.
Interactive Mode¶
Run the wizard and answer a few prompts:
The wizard will ask you:
- Project name — Must be valid snake_case (for example,
my_api) - Description — Optional project description
- Python version — Defaults to 3.12
- Preset — Choose from minimal, standard, full-stack, microservice, or custom
- Modules — If custom, select from 36 available modules
- Advanced Options — Toggle "Enable advanced configuration options" to expose fine-grained settings (for example, Celery queue strategy, Docker multi-worker mode, GraphQL query depth limiting)
- Post-generation — Optionally run
uv sync,git init, andpre-commit install
After module selection, a summary panel shows which modules were explicitly selected and which were auto-implied.
Non-Interactive Mode¶
For CI/CD or scripts, use flags:
# Using a built-in preset
moltpy new \
--name my_api \
--preset standard \
--no-interactive
# Using specific modules
moltpy new \
--name my_api \
--modules auth,database,docker,testing \
--no-interactive
# With custom target directory
moltpy new \
--name my_api \
--preset standard \
--target ./projects \
--no-interactive
# Preview without writing files
moltpy new \
--name my_api \
--preset standard \
--dry-run \
--no-interactive
# Skip post-generation hooks
moltpy new \
--name my_api \
--preset standard \
--skip-post-generation \
--no-interactive
# With custom template overrides
moltpy new \
--name my_api \
--preset standard \
--template-dir ./my-templates \
--no-interactive
# With a GitHub module
moltpy new \
--name my_api \
--modules auth,database,github:user/repo#my-module \
--no-interactive
Declarative Configuration¶
For repeatable, version-controlled project generation, use a configuration file:
1. Generate a starter config¶
2. Edit the config file¶
name: "my_api"
description: "My API project"
python_version: "3.12"
modules:
- auth
- database
- docker
- testing
module_variables:
auth:
token_expire_minutes: 60
post_generation:
uv_sync: true
git_init: true
pre_commit_install: false
# External modules (for example, from GitHub)
external_modules:
- github:user/repo#my-module
3. Generate from the config file¶
You can also use JSON:
CLI overrides¶
When using --config-file, you can still override individual values via CLI flags:
moltpy new \
--config-file moltpy.yaml \
--name different_name \
--modules auth,database \
--no-interactive
--modules and --preset always override the modules list from the config file.
After Generation¶
cd my_api
# The project is ready to run
make run-dev
# Or manually
uv sync
uv run uvicorn app.main:app --reload
Explore Your Project¶
# List installed modules
moltpy modules list
# Get info about a specific module
moltpy modules info auth
# Save your configuration as a preset
moltpy preset save --name my-team --modules auth,database,docker,testing
# List all presets
moltpy preset list
Resource Scaffolding (Day-2 Development)¶
After your project is generated, use MoltPy to scaffold new CRUD resources without writing boilerplate:
cd my_api
# Generate a complete CRUD resource
moltpy generate resource Post title:str content:text is_published:bool
# Preview without writing files
moltpy generate resource Post title:str --dry-run
# Skip the Alembic migration
moltpy generate resource Post title:str --skip-alembic
This creates:
- app/models/post.py — SQLAlchemy model
- app/schemas/post.py — Pydantic schemas
- app/routers/posts.py — FastAPI REST router
- app/services/post.py — Async CRUD service
- tests/api/test_posts.py — pytest tests
And automatically:
- Injects the router into app/main.py
- Registers the model in app/models/__init__.py
- Runs Alembic autogenerate
- Formats everything with ruff
Supported types: str, text, int, bool, float, uuid, datetime, json
Next Steps¶
- CLI Reference — Learn all available commands
- Module Catalog — Explore all 36 modules
- Custom Modules — Build your own modules, use external modules, and template overrides