Examples
Real-world StructKit configurations for various project types.
Python FastAPI Service
A production-ready FastAPI service with Docker and tests.
fastapi-service.yamlyaml
project_name: fastapi-service
variables:
python_version: "3.11"
port: "8000"
hooks:
after:
- cd {{ project_name }} && python -m venv venv
- echo "Run: source venv/bin/activate && pip install -e ."
structure:
- app/:
- __init__.py
- main.py:
content: |
from fastapi import FastAPI
app = FastAPI(title="{{ project_name }}")
@app.get("/health")
def health():
return {"status": "ok"}
- routes/:
- __init__.py
- models/:
- __init__.py
- tests/:
- test_main.py:
content: |
from fastapi.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_health():
response = client.get("/health")
assert response.status_code == 200
- Dockerfile:
content: |
FROM python:{{ python_version }}-slim
WORKDIR /app
COPY . .
RUN pip install -e .
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "{{ port }}"]
- requirements.txt:
content: |
fastapi>=0.100.0
uvicorn[standard]>=0.23.0
pytest>=7.0.0
httpx>=0.24.0
- .gitignore:
source: https://raw.githubusercontent.com/github/gitignore/main/Python.gitignoreTerraform AWS Module
Reusable Terraform module with documentation and examples.
terraform-module.yamlyaml
project_name: terraform-aws-module
variables:
provider: "aws"
min_terraform: "1.0"
structure:
- main.tf:
content: |
terraform {
required_version = ">= {{ min_terraform }}"
required_providers {
{{ provider }} = {
source = "hashicorp/{{ provider }}"
version = "~> 5.0"
}
}
}
- variables.tf:
content: |
variable "name" {
description = "Name of the resource"
type = string
}
variable "tags" {
description = "Tags to apply"
type = map(string)
default = {}
}
- outputs.tf:
content: |
output "id" {
description = "Resource ID"
value = ""
}
- examples/:
- basic/:
- main.tf:
content: |
module "example" {
source = "../../"
name = "my-resource"
}
- README.md:
content: |
# {{ project_name }}
Terraform module for {{ provider }} resources.
## Usage
\`\`\`hcl
module "this" {
source = "path/to/{{ project_name }}"
name = "my-resource"
}
\`\`\`CLI Tool with Click
Python CLI application with plugins and packaging.
cli-tool.yamlyaml
project_name: my-cli
variables:
description: "A powerful CLI tool"
hooks:
after:
- cd {{ project_name }} && pip install -e .
structure:
- {{ project_name }}/:
- __init__.py:
content: |
"""{{ description }}"""
__version__ = "0.1.0"
- cli.py:
content: |
import click
@click.group()
@click.version_option()
def cli():
"""{{ description }}"""
pass
@cli.command()
@click.argument("name")
def hello(name):
"""Say hello."""
click.echo(f"Hello, {name}!")
if __name__ == "__main__":
cli()
- plugins/:
- __init__.py
- tests/:
- test_cli.py
- setup.py:
content: |
from setuptools import setup, find_packages
setup(
name="{{ project_name }}",
packages=find_packages(),
entry_points={
"console_scripts": [
"{{ project_name }}={{ project_name }}.cli:cli",
],
},
install_requires=["click>=8.0"],
)
- README.md:
content: |
# {{ project_name }}
{{ description }}