Skip to main content

CLI tool to put teams in pole position when starting enterprise FastAPI projects

Project description

PolePosition

A CLI tool that puts teams in pole position when starting enterprise FastAPI projects.

PolePosition helps you keep FastAPI's speed while avoiding the usual setup drag of enterprise backend work. It gives you a structured, production-minded starting point from day one.

Create a new project:

polepos start myapp --install

If you prefer not to generate Python bytecode while developing locally:

polepos start myapp --no-bytecode

PyPI version Python License


Example Output

$ polepos start myapp --install
Created project: myapp

Installing project dependencies with uv...
Dependencies installed successfully.

Next steps:
  cd myapp
  cp .env.example .env
  alembic upgrade head
  uv run fastapi dev src/myapp/main.py

Why PolePosition?

PolePosition is named for the same reason teams use it: to start enterprise FastAPI development from pole position.

FastAPI projects should start fast, clean, and predictable, even when the target is a larger production system.

PolePosition provides:

  • A scalable project structure
  • Environment-based configuration
  • Alembic-based database migrations
  • Built-in logging
  • Testing setup
  • Module-oriented organization for growing codebases
  • A ready-to-run FastAPI application

No boilerplate. No setup friction.


Why not just FastAPI?

FastAPI is excellent, but starting a new project often involves:

  • Recreating the same structure
  • Setting up logging and configuration
  • Defining module boundaries
  • Wiring database foundations
  • Organizing modules manually

PolePosition removes that overhead by providing a clean, production-ready starting point out of the box.


Installation

PolePosition follows a uv-first workflow for installation, dependency sync, migrations, and local development.

uv tool install poleposition

or

pip install poleposition

Quick Start

polepos start myapp --install
cd myapp
cp .env.example .env
alembic upgrade head

uv run fastapi dev src/myapp/main.py

Create and run migrations:

alembic upgrade head
alembic revision --autogenerate -m "add garage table"

Open your API documentation:

http://127.0.0.1:8000/docs

Usage

Create a project

polepos start myapp --install

--install runs uv sync inside the generated project for you. --no-bytecode updates generated run instructions to use PYTHONDONTWRITEBYTECODE=1.

Project names:

  • Must not be empty
  • Must not contain whitespace
  • May use hyphens like my-app
  • Are normalized to a Python package name like my_app

Manual setup

polepos start myapp
cd myapp

cp .env.example .env
uv sync
alembic upgrade head

uv run fastapi dev src/myapp/main.py

Add modules

polepos add module garage

Database commands

polepos db upgrade
polepos db revision -m "add garage table"
polepos db downgrade -1

Logging

Generated projects use get_logger(__name__) from bootstrap.logging as the preferred logging entrypoint.

from shop_api.bootstrap.logging import get_logger

logger = get_logger(__name__)

When to use which command

  • polepos start when you want to create a new FastAPI project with the PolePosition structure
  • polepos add module when you want to add a new REST/domain module to an existing project
  • polepos db upgrade when you want to apply migrations to the database
  • polepos db revision -m "..." when you changed models and need a new migration
  • polepos db downgrade when you need to roll back a migration

Help and version

polepos help
polepos version

CLI

polepos help
polepos start <name> [--install] [--no-bytecode]
polepos startproject <name> [--install] [--no-bytecode]
polepos add module <name>
polepos db upgrade [target]
polepos db revision -m "<message>"
polepos db downgrade <target>
polepos version

Project Structure

myapp/
├─ alembic.ini
├─ migrations/
│  └─ versions/
├─ pyproject.toml
├─ .env.example
├─ src/
│  └─ myapp/
│     ├─ main.py
│     ├─ app.py
│     ├─ settings.py
│     ├─ bootstrap/
│     ├─ api/
│     ├─ db/
│     ├─ domain/
│     └─ modules/
│        ├─ status/
│        └─ races/
└─ tests/
   ├─ integration/
   └─ unit/

Status Endpoint

Check if your service is running:

GET /api/v1/status
{
  "status": "ok",
  "service": "myapp",
  "environment": "development",
  "version": "0.1.0",
  "uptime_seconds": 12,
  "timestamp": "2026-04-26T12:00:00Z"
}

Philosophy

PolePosition is built around a few principles:

  • Minimal: no unnecessary abstractions
  • Opinionated: sensible defaults
  • Extensible: easy to grow into larger systems

The CLI is intentionally lightweight and avoids heavy templating engines.


Roadmap

  • Project name validation
  • polepos add module
  • Alembic and database migrations
  • Docker support
  • polepos db ... commands
  • JSON logging support
  • Auth foundation
  • Production-ready presets

Example Workflow

Here is a concrete example for a new PostgreSQL-backed FastAPI REST API project.

Create the project and install dependencies:

uv tool install poleposition
polepos start shop-api
cd shop-api
cp .env.example .env
uv sync

Point the project to PostgreSQL in .env:

DATABASE_URL=postgresql+psycopg://postgres:postgres@localhost:5432/shop_api

Apply the initial migration and start the API:

polepos db upgrade
uv run fastapi dev src/shop_api/main.py

Add a new REST module:

polepos add module customers

Extend src/shop_api/modules/customers/model.py and schemas.py for your domain, then generate and apply a migration:

polepos db revision -m "add customers table"
polepos db upgrade

At that point, your project has:

  • FastAPI app structure
  • PostgreSQL-ready SQLAlchemy setup
  • Alembic migration workflow
  • A generated REST module with router, schemas, service, repository, and tests

That is the core PolePosition flow: start fast, add modules as the API grows, and evolve the database schema through the CLI.

Example: build a users REST API

If you want a REST API that returns users, the flow is:

Generate the module:

polepos add module users

Update src/shop_api/modules/users/model.py with user fields such as:

class Users(Base):
    __tablename__ = "users"

    id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
    email: Mapped[str] = mapped_column(String(255), unique=True)
    full_name: Mapped[str] = mapped_column(String(120))
    is_active: Mapped[bool] = mapped_column(default=True)

Update schemas.py so the API returns those fields, then create and apply a migration:

polepos db revision -m "create users table"
polepos db upgrade

At that point, you already have the generated router shape for:

GET  /api/v1/users/
POST /api/v1/users/

From there, you refine the generated module for your actual domain instead of starting from an empty project structure.


Contributing

Contributions are welcome. Feel free to open an issue or submit a pull request.


License

MIT

License

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

poleposition-0.0.14.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

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

poleposition-0.0.14-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

File details

Details for the file poleposition-0.0.14.tar.gz.

File metadata

  • Download URL: poleposition-0.0.14.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for poleposition-0.0.14.tar.gz
Algorithm Hash digest
SHA256 2c15640010162b7b572153efbac3b316c18a5e4fbb9ec324c332264d6124a573
MD5 4757a479074c9b045bfb4188ab438491
BLAKE2b-256 71b170702df4aa5ae2ba5b2a4ed7aeba2b02171675e5556980c15eea83b59571

See more details on using hashes here.

File details

Details for the file poleposition-0.0.14-py3-none-any.whl.

File metadata

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

File hashes

Hashes for poleposition-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 38a71dc6cb6324fa631f1c9d1bed536e4852a0eb832ad6f78a62ccb02d43ffde
MD5 6fd160b891653fdbf51851ce8ff030bc
BLAKE2b-256 7e9017bd9997250eaa98a0ae268b2ad72fc4a11c6d97061b6797cfc47a0a6531

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