# 🏛️ 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

-   **🏗️ Smart Scaffolding**: Create project structures based on Clean Architecture principles out of the box.
-   **🧩 Component Generation**: Generate models, schemas, services, and controllers with a single command.
-   **🛡️ Type-Safe by Default**: Generated code is 100% compliant with mypy and Pydantic v2 best practices.
-   **🚀 Language Agnostic DNA**: While it excels in Python, the core engine is built to scale across any modern tech stack.
-   **🎨 Artisanal Code**: We don't generate "junk code." Every file follows strict industry conventions and pep8 standards.

---

## 🚀 Quick Start

### 1. Initialize your project

You can use `uv` to initialize your project library:

```bash
uv init --lib strura
```

### 2. Install Strura

Install Strura globally or within your virtual environment:

```bash
pip install strura
```

### 3. Verify the installation

```bash
strura --version
```

---

## 🛠️ Usage & Commands

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

-   **Initialize a Project**
    Set up a professional folder structure including Docker, Git, and Dependency Injection configurations.
    ```bash
    strura init my-awesome-api
    ```
-   **Generate a Database Model**
    Create a SQLAlchemy model with pre-configured mixins and migration support.
    ```bash
    strura gen:model User
    ```
-   **Generate a Validation Schema**
    Create Pydantic DTOs for data input, output, and partial updates.
    ```bash
    strura gen:schema User
    ```
-   **Generate a Full API Resource**
    Generate the model, schema, service layer, and API routes in one single step.
    ```bash
    strura gen:api Product --resource
    ```

---

## 📂 The Strura Directory Standard

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

```
.
├── app/
│   ├── api/          # Route definitions and endpoints
│   ├── core/         # Global config, security, and constants
│   ├── models/       # Database models (SQLAlchemy/SQLModel)
│   ├── schemas/      # Validation schemas (Pydantic)
│   ├── services/     # Business logic (The "Craft" layer)
│   └── main.py       # Application entry point
├── tests/            # Unit and integration test suites
├── alembic/          # Database migrations
├── pyproject.toml    # Modern dependency management
└── README.md
```

---

## 🔧 Customization

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

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

---

## 🧑‍💻 Development

### 1. Clone and set up the virtual environment

```bash
git clone https://github.com/m4ck-y/strura.git
cd strura
uv sync
source .venv/bin/activate
```

### 2. Install the package in editable mode

```bash
uv pip install -e .
```

### 3. Run the CLI locally

```bash
strura hello-world
# Output: Hello, World!
```

### 4. Run the tests

```bash
uv run pytest -v
```

---

## 🤝 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.
