Quickstart For Developers
Put a bucket in a reusable Python Stack class, make an App factory the CLI entry
point, and use nf to review and apply a plan. The example uses the typed AWS bindings.
1. Start With A Tiny Project
Set up Python 3.15 or later and the CLI in your project. See installation.
my-web-app/
app.py
pyproject.toml
2. Install The AWS Binding Package
For a source checkout, see AWS binding installation.
uv add netherframe.providers.hashicorp.aws
pip install netherframe.providers.hashicorp.aws
3. Point The CLI At Your Python Entry Point
Add these settings to pyproject.toml.
[tool.nf]
apps = ["app:app"]
4. Write A Minimal App
Create app.py:
# coding: nf_autoid
from nf.core import App, Bind, BindContext, Output, Stack, autoscope
from nf.providers.hashicorp.aws import AwsProvider, S3Bucket
@autoscope
class DemoStack(Stack):
def __init__(self, *, nf_scope: App | None = None, nf_id: str | None = None) -> None:
super().__init__(nf_scope=nf_scope, nf_id=nf_id)
aws: Bind = AwsProvider(region="us-east-1")
self.bucket: Bind[S3Bucket] = S3Bucket(
bucket="replace-with-a-globally-unique-name",
force_destroy=True,
tags={"Name": "developer-quickstart-bucket"},
)
bucket_id: Bind = Output(value=self.bucket.output.id)
def app() -> App:
with App() as app, BindContext:
demo: Bind = DemoStack()
app.enable_hybrid_execution_local(path=".nf.out/hybrid.tfstate")
return app
app:app tells the CLI to call app() from app.py. The DemoStack groups the
bucket, provider, and output. The app factory chooses the state backend.
5. Review a plan
Configure AWS credentials and choose a globally unique bucket name before running this app. Keep the project's Python environment active.
nf plan --app app --out reviewed-plan.json
Netherframe loads app:app and runs the AWS provider. Review the bucket create and its
output in the plan.
6. Apply and clean up
nf apply --app app --plan-file reviewed-plan.json
nf plan --app app
nf destroy --app app
The second plan should report no changes. Run destroy when you’re done with the example.
Why This Shape Works Well For Developers
- your infrastructure entry point is a normal Python function
Stacksubclasses are just Python classes- imported AWS resources are normal Python classes too
- you can factor shared logic into helper functions or reusable constructs
- you can grow from one file to several modules without changing the CLI contract
A Useful Mental Shift
Try not to treat this like "Terraform but written in Python strings".
Treat it more like:
- a small Python package
- with infrastructure-oriented classes
- whose resources Netherframe plans and applies through provider binaries
That framing makes refactors, shared helpers, and code review much clearer.
A Good Next Refactor
Once the first stack feels comfortable, split the app into modules such as:
my-web-app/
app.py
stacks/
network.py
storage.py
That is the point where Building Your First Application becomes the better next guide.
You can also start extracting things like:
- a reusable network construct
- shared tagging helpers
- environment-specific config loaders
Why The Generated AWS Package Helps
- IDE autocomplete is better
- resource names are Python imports instead of Terraform type strings
- examples are easier to read in code review
- you can gradually build reusable abstractions on top of those classes
Naming and scope
BindContext names the app from as app, and Bind names the stack from demo
and the resources and outputs from their assignment names. with App() makes the
app the parent of DemoStack. After super().__init__, @autoscope makes the stack
the parent of the constructs created in its constructor.
If you later automate deploys in CI, nf deploy --auto-approve is available.
Next Steps
- Building Your First Application
- Quickstart For CDK And CDKTF Users
- Custom Codec And Autoscope explains these bindings and constructor scopes.
- CLI Reference