Skip to main content

project-initializer

License: MIT Python 3.10+ CI

CLI tool to scaffold full-stack projects with FastAPI or NestJS, Angular, and Docker — with optional authentication via token, Supabase, or Microsoft Entra ID. Scaffold the full stack, or just the backend or frontend with --scope.

Installation

pip install project-initializer

Or install from source:

git clone https://github.com/silviobaratto/project-initializer.git
cd project-initializer
pip install -e .

Quick Start

project-initializer my-project
cd my-project
# .env is generated at the project root with working dev defaults — edit for real keys
docker compose up -d --build

Run project-initializer with no flags in a terminal and an interactive wizard (Typer + questionary) prompts for scope, framework, auth, and the async-DB option. Pass any of those as flags to skip its prompt; pass -y/--yes (or pipe stdin) to run fully non-interactive with defaults.

Framework Selection

Choose a backend framework with --fastapi (default) or --nestjs:

project-initializer my-app --fastapi    # FastAPI backend (default)
project-initializer my-app --nestjs     # NestJS backend
Feature FastAPI NestJS
Language Python 3.12 TypeScript (Node 20)
ORM SQLAlchemy + Alembic Prisma
AI/LLM BAML (Python) BAML (TypeScript)
API style REST with Pydantic REST with class-validator
Architecture Clean / hexagonal (domain/application/infrastructure/api) Modular (controllers/services/modules)

Authentication Modes

Add authentication with --auth token, --auth supabase, or --auth entra:

project-initializer my-app --auth token      # Simple bearer-token auth
project-initializer my-app --auth supabase    # Supabase JWT auth + RLS
project-initializer my-app --auth entra       # Microsoft Entra ID (Azure AD) OIDC
  • No auth (default) — No authentication middleware. Good for prototyping.
  • Token auth (--auth token) — Bearer-token middleware on the API. Frontend gets a login guard and an HTTP interceptor that attaches the token.
  • Supabase auth (--auth supabase) — Supabase JWT validation on the API. Frontend integrates @supabase/supabase-js for login/signup. Docker Compose omits the local db service since Supabase hosts the database.
  • Entra auth (--auth entra) — Microsoft Entra ID (formerly Azure AD) OIDC. Both backends validate Entra v2 JWT bearer tokens in-process via RS256 + JWKS. The Angular frontend uses MSAL for login. Requires two Entra app registrations (API + SPA).

Project Scope (full-stack / backend-only / frontend-only)

By default the CLI scaffolds both halves (api/ + frontend/). Use --scope to generate only one:

project-initializer my-app                      # fullstack (default): api + frontend
project-initializer my-app --scope api          # backend only — no frontend/, no frontend service
project-initializer my-app --scope frontend     # frontend only — Angular app, no api/
  • --scope api — emits api/ + docker-compose.yml (without the frontend service) + the root .env/.env.example. Combine with --fastapi/--nestjs/--auth as usual.
  • --scope frontend — emits just the Angular frontend/ (nginx /api/ proxy stripped). Cannot be combined with --fastapi/--nestjs/--auth (those are backend concerns).
  • --scope fullstack (default) — both halves, current behavior.

Async Database (opt-in)

FastAPI backends scaffold the sync SQLAlchemy path by default — sync def path operations run in Starlette's threadpool, so a blocking Session never stalls the event loop. This is the recommended default per the FastAPI tutorial.

Pass --async-db to additionally lay down the async SQLAlchemy overlay (async engine + AsyncSession + get_async_db dependency, asyncpg driver):

project-initializer my-app --async-db              # fullstack + async DB path
project-initializer my-app --scope api --async-db  # backend only + async DB path
  • FastAPI only — rejected with --nestjs and with --scope frontend.
  • Additive: the sync path stays the default; the async modules are an isolated overlay you wire in explicitly.
  • See the generated api/.claude/CLAUDE.md for the sync-vs-async convention (pick the keyword from the I/O, not by style).

All 8 Variants

Command Backend Auth
project-initializer app FastAPI None
project-initializer app --auth token FastAPI Token
project-initializer app --auth supabase FastAPI Supabase
project-initializer app --auth entra FastAPI Entra ID
project-initializer app --nestjs NestJS None
project-initializer app --nestjs --auth token NestJS Token
project-initializer app --nestjs --auth supabase NestJS Supabase
project-initializer app --nestjs --auth entra NestJS Entra ID

Additional flags:

project-initializer my-project --scope api       # Backend only
project-initializer my-project --scope frontend  # Frontend only
project-initializer my-project --async-db        # FastAPI async SQLAlchemy path (opt-in)
project-initializer my-project --force           # Overwrite existing files
project-initializer my-project -y                # Non-interactive (defaults for unset options)
project-initializer my-project -V                # Verbose: list every file created
project-initializer .                            # Scaffold in current directory
project-initializer --version                    # Show version

Generated Project Structure

my-project/
├── api/                    # Backend (FastAPI or NestJS)
│   ├── app/ (FastAPI)      # domain / application / infrastructure / api (hexagonal)
│   ├── src/ (NestJS)       # modules / prisma / common / config (modular)
│   ├── Dockerfile
│   ├── README.md           # generated backend quick-start
│   └── .claude/CLAUDE.md   # generated deep architecture guide
├── frontend/               # Angular + Angular Material 3
│   ├── Dockerfile
│   ├── nginx.conf
│   ├── src/
│   ├── README.md           # generated Angular quick-start
│   └── .claude/CLAUDE.md   # generated Angular guidance
├── docker-compose.yml      # Full-stack orchestration
├── .env                    # Generated at the ROOT with working dev defaults
├── .env.example            # Committed reference (byte-identical to .env)
├── README.md               # generated per-flag
└── CLAUDE.md               # generated AI-assistant guidance

Docs (README.md + CLAUDE.md at the root, in api/, and in frontend/) are generated per-flag from a single source, not copied from static templates — so a NestJS project never mentions SQLAlchemy, a no-auth project never documents Entra, and the docs cannot drift from the code.

Docker Services

Service Port Description Supabase variants
db 5433:5432 PostgreSQL 16 Omitted (Supabase hosts DB)
adminer 8080:8080 DB management UI Omitted
api 8000:8000 Backend with hot reload Present
frontend 4200:80 Angular + nginx (proxies /api/ to backend) Present

Environment Configuration

The CLI generates a single .env (plus a byte-identical .env.example) at the project root — the one source of truth for both docker compose and the app. Docker Compose loads it via env_file; the FastAPI backend walks up to it (infrastructure/config.py) so cd api && uvicorn resolves it too, and NestJS points ConfigModule/Prisma at it. The placeholder values double as working dev defaults, so docker compose up runs with no edits. Host ports are parametrized (API_HOST_PORT, FRONTEND_HOST_PORT, DB_HOST_PORT) with the previous fixed ports as defaults.

For Supabase variants, configure these in the root .env:

SUPABASE_URL=https://your-project.supabase.co
SUPABASE_PUBLISHABLE_KEY=sb_publishable_...   # client-side (replaces legacy anon key)
SUPABASE_SECRET_KEY=sb_secret_...             # server-side, bypasses RLS (replaces service_role)

Development

FastAPI

cd api
pip install -r requirements.txt
uvicorn app.main:app --reload          # API on :8000
alembic upgrade head                   # Run migrations
pytest                                 # Run tests

NestJS

cd api
npm install
npm run start:dev                      # API on :8000
npx prisma migrate dev                 # Run migrations
npm run test                           # Run tests

Frontend (Angular)

cd frontend
npm install --legacy-peer-deps
ng serve                               # Dev server on :4200
ng build                               # Production build
ng test                                # Unit tests

Contributing

See CONTRIBUTING.md for development setup, template architecture, and PR guidelines.

License

MIT

Metadata

Release files for project-initializer 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for project-initializer 0.4.1
File Size Uploaded Provenance Actions
project_initializer-0.4.1.tar.gz 1.2 MB Without provenance Details for project_initializer-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for project-initializer 0.4.1
File Interpreter ABI Platform Actions
project_initializer-0.4.1-py3-none-any.whl Python 3 none any Details for project_initializer-0.4.1-py3-none-any.whl

Total release size: 2.4 MB

Release files / project_initializer-0.4.1.tar.gz

Download URL project_initializer-0.4.1.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
dac860d8e7f6a8ac2b57b734f420ef5dbe63c8322cc2c5e998276ff93863b427
BLAKE2b-256 checksum
How to use checksums
17dbd11784984da95fe5de072c3904ea1625091d6046e98e29bc71bb92a08795
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / project_initializer-0.4.1-py3-none-any.whl

Download URL project_initializer-0.4.1-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c0a47cd6adae8c33ed2250426c097cfd2e39a37695dc56bbaa210efc561e0c4e
BLAKE2b-256 checksum
How to use checksums
01d0faf2da02ee1b0a65c5ae107bfa42916e92e10e4af2b12ebc432380c74df9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for project-initializer 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page