Skip to main content

Add your description here

Project description

Strura - The Architect's CLI

Constructing solid foundations for your code.

Strura is a high-performance code generation and scaffolding tool inspired by the elegance of php artisan. It is designed for developers who want to build robust applications using FastAPI, SQLAlchemy, and Pydantic without wasting time on repetitive boilerplate.

"Architecture is not just about how a project looks, but how it stands. Strura builds the foundation for you."


Key Features

  • DDD-First Scaffolding: Create project structures based on Domain-Driven Design and Clean Architecture.
  • Bounded Contexts: Generate isolated contexts with specific layers for Application, Domain, and Infrastructure.
  • Type-Safe by Default: Generated code is 100% compliant with Pydantic v2 and FastAPI best practices.
  • Powered by uv: Extremely fast dependency management and project initialization.
  • Artisanal Code: Every file follows strict industry conventions, Pep8 standards, and structural best practices.

Philosophy

Strura follows the principles of:

  • Domain-Driven Design (DDD)
  • Hexagonal Architecture (Ports & Adapters)
  • Strict layer separation

The core domain does not depend on external frameworks; Strura focuses on building the structural foundation.

Integrations

Strura can optionally integrate with:

  • FastAPI
  • SQLAlchemy
  • core_api (auth, users, etc.)

Customization

The generated code is designed to be:

  • Editable: No hidden logic; what you see is what you own.
  • Extensible: Easily adapt the structure as your project grows.
  • Independent: Once generated, the code does not depend on the scaffolder.

Installation

One-liner (installs uv + strura automatically)

curl -LsSf https://raw.githubusercontent.com/m4ck-y/strura/main/install.sh | bash

With uv (if already installed)

uv tool install strura

With pipx

pipx install strura

With pip

pip install strura

Verify the installation

strura --help

Upgrade to latest version

uv add strura --upgrade-package strura

Quick Start

Initialize a new project

strura init my-awesome-api

Or scaffold the current directory

mkdir my-api && cd my-api
strura init .

Usage & Commands

Strura uses an intuitive verb:subject syntax to keep your workflow fluid and readable.

  • Initialize a Project Set up a professional DDD structure. Supports creating a new folder (Mode A) or formatting the current one (Mode B).
    strura init my-awesome-api
    
  • Generate a Bounded Context Create a new isolated context with Application, Domain, and Infrastructure layers.
    strura gen:context billing
    

Roadmap (Coming Soon)

  • strura gen:schema <context>.<entity>: Pydantic DTOs for input/output.
  • strura gen:api <context>.<resource>: Full CRUD endpoints.

The Strura Directory Standard

Running strura init implements a production-ready directory structure designed for scalability:

.
├── app/
│   ├── contexts/                # Isolated bounded contexts (DDD)
│   ├── settings/                # Environment and Database config
│   ├── shared/                  # Common code across contexts
│   └── main.py                  # FastAPI entry point
├── tests/                       # Unit and integration test suites
├── docs/                        # Command-specific documentation
├── .agent/                      # AI Agent workflows and rules
├── pyproject.toml               # Dependency management (uv)
└── README.md

Customization

Tailor the code generation to your needs by creating a .strura.yaml file in your project root:

framework: fastapi
database: postgresql
orm: sqlalchemy
indentation: 4
naming_convention: snake_case
templates: ./custom_templates

Development & Publishing

1. Testing

To add dependencies and run tests:

uv add --dev pytest
uv run pytest -vv

2. Publishing

To develop locally, build, and publish:

# Install in editable mode
uv pip install -e .

# Clean previous builds (Crucial to avoid 400 errors)
rm -rf dist/*

# Build the package
uv build

# Publish to PyPI (requires API Token)
uv publish

AI-Agent Workflows

This project is specialized for Agentic Development. We maintain strict standards for AI agents in the .agent/ directory:

  • Workflows: Standardized processes for documentation, Git, and automation.
  • Rules: Best practices for FastAPI, Pydantic, and SQLAlchemy.

For more details, check .agents/workflows/WRITING.md.


Contributing

Looking to improve Strura? We welcome architects of all levels!

  1. Fork the project.
  2. Create your feature branch: git checkout -b feature/amazing-logic.
  3. Commit your changes: git commit -m 'Add some amazing feature'.
  4. Push to the branch: git push origin feature/amazing-logic.
  5. Open a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

strura-0.1.4.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

strura-0.1.4-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file strura-0.1.4.tar.gz.

File metadata

  • Download URL: strura-0.1.4.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for strura-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d74725072bd873820cf431c2d4fba7d70eafd1c2185a4262daee5e51464c1683
MD5 5c78e146c7c8eed8b860c198d2a32586
BLAKE2b-256 f1eb0ca359681b450ccd0f94c69317e170b53a00dca4826d6b0cbec326ab1889

See more details on using hashes here.

File details

Details for the file strura-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: strura-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for strura-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 580f7aa91d2c1b1b27dea34fb41f8250e6fbec9e72af58b2ebe73b4cbe18ecf6
MD5 ef862cc809c7d6e98b2e8ee9f3c550dc
BLAKE2b-256 cfe60c029ddbb74f7c8347f24b3953e18a936624a3c5655ef62d74f86c2f14a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page