puerto 0.7.0

Puerto — Rust full-stack DDD framework CLI. Scaffolds Clean Architecture projects with auto-wired DI, SQLx support, and zero manual wiring. Formerly harbor-framework.
puerto-0.7.0 is not a library.

Harbor

Harbor is a Rust CLI that scaffolds full-stack DDD projects following Clean Architecture (Hexagonal / Ports & Adapters). It generates a 3-crate workspace with auto-wired dependency injection, zero manual wiring.

Install

cargo install harbor-framework

Quick start

harbor new                          # interactive: prompts for name and db support
harbor new --name my-app            # skip name prompt
harbor new --name my-app --db       # fully non-interactive, includes SQLx/Postgres

Commands

harbor new [--name <name>] [--db]

harbor generate scaffold <Name>            # add a DDD entity (InMemory repository)
harbor generate scaffold <Name> --db       # add a DDD entity (SQLx/Postgres repository)
harbor generate use-case <Entity> <action> # add a use case to an existing entity
harbor generate migration <name>           # create a SQLx migration file
harbor generate bootstrap                  # regenerate bootstrap.rs from harbor.toml

Generated project structure

my-app/
├── harbor.toml                    # source of truth for entities + use cases
├── business/                      # domain + application layer (pure Rust)
│   └── src/
│       ├── domain/<entity>/
│       │   ├── model.rs
│       │   ├── errors.rs
│       │   ├── repository.rs      # trait (port) + mockall mock
│       │   └── use_cases/
│       └── application/<entity>/
│           └── <use_case>.rs      # use case impl + unit tests
├── infrastructure/                # adapters (InMemory or SQLx/Postgres)
│   └── src/<entity>/
│       └── repository.rs
└── presentation/                  # poem-openapi REST API
    └── src/
        ├── main.rs                # 5-line entry point — never changes
        ├── generated/
        │   └── bootstrap.rs       # auto-generated DI wiring
        └── api/<entity>/
            ├── routes.rs
            ├── dto.rs
            ├── responses.rs
            └── error_mapper.rs

Architecture

Dependency rule (inward only):

Presentation → Infrastructure → Application → Domain
  • Domain — pure Rust, no external dependencies beyond std / async-trait / thiserror
  • Application — use case implementations, imports domain only
  • Infrastructure — adapters (InMemory or SQLx); imports domain
  • Presentation — poem-openapi REST API; imports all layers via auto-generated DI

Tech stack

License

MIT