HexCore ships aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Indroic/HexCore/llms.txt
Use this file to discover all available pages before exploring further.
typer-based CLI that accelerates the repetitive parts of a DDD project: scaffolding new projects from opinionated templates, generating domain module boilerplate, managing Alembic migrations, and running your test suite. This page covers every command, its flags, and example terminal output.
Entry Point
The CLI is exposed as thehexcore command after installing the package. You can also drive it from a manage.py file in your project root:
manage.py
Commands
hexcore init
Scaffolds a new project directory from one of two structural templates.
The name of the project to create. A directory with this name is created in the current working directory. Fails if the directory already exists.
Structural template to use. Accepted values:
hexagonal or vertical-slice.- hexagonal
- vertical-slice
Creates the classic layered hexagonal architecture layout:
config.py is pre-populated with repository_discovery_paths pointing at src.infrastructure.repositories.init does automatically:
Create directories
All directories are created with
__init__.py files so they are importable Python packages from the start.Write base files
README.md, .gitignore, manage.py, and config.py are generated with sensible defaults.Configure Alembic
Runs
alembic init alembic, patches alembic.ini with the correct version_locations, and patches alembic/env.py to import your models, set target_metadata = Base.metadata, and pull the database URL from LazyConfig.hexcore create-domain-module
Generates all boilerplate files for a new domain module inside src/domain/<name>/.
The module name. Must be a valid Python identifier (no hyphens, no spaces). The value is lower-cased internally. Example:
users, billing, inventory.| File | Contents |
|---|---|
__init__.py | Empty package marker |
repositories.py | Abstract I<Name>Repository(IBaseRepository[<Name>]) interface |
services.py | Stub <Name>Service(BaseDomainService) class |
value_objects.py | Commented example of a Pydantic value object |
events.py | Commented example of an EntityCreatedEvent subclass |
enums.py | Empty |
exceptions.py | Empty |
tests/domain/<name>/ with an __init__.py and a blank test_<name>_entities.py file.
Example output:
repositories.py (example for billing):
src/domain/billing/repositories.py
services.py:
src/domain/billing/services.py
hexcore make-migrations
Generates a new Alembic migration file by comparing your SQLAlchemy models against the current database schema.
A human-readable label for the migration. Becomes the
-m argument to alembic revision. Use snake_case or a short sentence. Example: "add users table".hexcore migrate
Applies all pending Alembic migrations to the database.
The database URL is read from
ServerConfig.sql_database_url via the LazyConfig integration that was injected into alembic/env.py by hexcore init. Make sure sql_database_url is set in config.py or via the HEXCORE_CONFIG_MODULE environment variable before running migrations.hexcore test
Runs your test suite with pytest.
Path or directory to pass to
pytest. Defaults to test/. Pass a specific file or directory to narrow the run.Additional arguments forwarded verbatim to
pytest. Useful for -k, -x, -v, --cov, etc. Wrap the value in quotes if it contains spaces.pytest, so it integrates cleanly with CI/CD pipelines.