fastapi-spawn 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. fastapi_spawn-0.1.0/.gitignore +53 -0
  2. fastapi_spawn-0.1.0/CHANGELOG.md +36 -0
  3. fastapi_spawn-0.1.0/LICENSE +21 -0
  4. fastapi_spawn-0.1.0/PKG-INFO +262 -0
  5. fastapi_spawn-0.1.0/README.md +221 -0
  6. fastapi_spawn-0.1.0/fastapi_spawn/__init__.py +6 -0
  7. fastapi_spawn-0.1.0/fastapi_spawn/cli.py +387 -0
  8. fastapi_spawn-0.1.0/fastapi_spawn/config.py +162 -0
  9. fastapi_spawn-0.1.0/fastapi_spawn/constants.py +133 -0
  10. fastapi_spawn-0.1.0/fastapi_spawn/generator.py +294 -0
  11. fastapi_spawn-0.1.0/fastapi_spawn/interactive.py +192 -0
  12. fastapi_spawn-0.1.0/fastapi_spawn/templates/alembic/alembic.ini.j2 +39 -0
  13. fastapi_spawn-0.1.0/fastapi_spawn/templates/alembic/env.py.j2 +64 -0
  14. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/__init__.py.j2 +1 -0
  15. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/api/deps.py.j2 +39 -0
  16. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/api/v1/auth.py.j2 +59 -0
  17. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/api/v1/health.py.j2 +40 -0
  18. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/core/ai.py.j2 +76 -0
  19. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/core/config.py.j2 +177 -0
  20. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/core/exceptions.py.j2 +43 -0
  21. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/core/logging.py.j2 +70 -0
  22. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/core/security.py.j2 +42 -0
  23. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/core/storage.py.j2 +73 -0
  24. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/db/session.py.j2 +84 -0
  25. fastapi_spawn-0.1.0/fastapi_spawn/templates/app/main.py.j2 +71 -0
  26. fastapi_spawn-0.1.0/fastapi_spawn/templates/base/Makefile.j2 +45 -0
  27. fastapi_spawn-0.1.0/fastapi_spawn/templates/base/README.md.j2 +74 -0
  28. fastapi_spawn-0.1.0/fastapi_spawn/templates/base/env.j2 +82 -0
  29. fastapi_spawn-0.1.0/fastapi_spawn/templates/base/env_example.j2 +85 -0
  30. fastapi_spawn-0.1.0/fastapi_spawn/templates/base/gitignore.j2 +38 -0
  31. fastapi_spawn-0.1.0/fastapi_spawn/templates/base/pre_commit.j2 +17 -0
  32. fastapi_spawn-0.1.0/fastapi_spawn/templates/base/pyproject.toml.j2 +129 -0
  33. fastapi_spawn-0.1.0/fastapi_spawn/templates/ci/github/publish.yml.j2 +32 -0
  34. fastapi_spawn-0.1.0/fastapi_spawn/templates/ci/github/tests.yml.j2 +39 -0
  35. fastapi_spawn-0.1.0/fastapi_spawn/templates/ci/gitlab/gitlab-ci.yml.j2 +29 -0
  36. fastapi_spawn-0.1.0/fastapi_spawn/templates/docker/Dockerfile.j2 +17 -0
  37. fastapi_spawn-0.1.0/fastapi_spawn/templates/docker/docker-compose.yml.j2 +97 -0
  38. fastapi_spawn-0.1.0/fastapi_spawn/templates/docker/dockerignore.j2 +13 -0
  39. fastapi_spawn-0.1.0/fastapi_spawn/templates/infra/docker/docker-compose.prod.yml.j2 +43 -0
  40. fastapi_spawn-0.1.0/fastapi_spawn/templates/infra/helm/Chart.yaml.j2 +6 -0
  41. fastapi_spawn-0.1.0/fastapi_spawn/templates/infra/helm/values.yaml.j2 +26 -0
  42. fastapi_spawn-0.1.0/fastapi_spawn/templates/infra/terraform/main.tf.j2 +26 -0
  43. fastapi_spawn-0.1.0/fastapi_spawn/templates/infra/terraform/variables.tf.j2 +17 -0
  44. fastapi_spawn-0.1.0/fastapi_spawn/templates/root/main.py.j2 +16 -0
  45. fastapi_spawn-0.1.0/fastapi_spawn/templates/tasks/celery_app.py.j2 +37 -0
  46. fastapi_spawn-0.1.0/fastapi_spawn/templates/tasks/sample_tasks.py.j2 +27 -0
  47. fastapi_spawn-0.1.0/fastapi_spawn/templates/tests/conftest.py.j2 +22 -0
  48. fastapi_spawn-0.1.0/fastapi_spawn/templates/tests/test_health.py.j2 +30 -0
  49. fastapi_spawn-0.1.0/fastapi_spawn/utils.py +58 -0
  50. fastapi_spawn-0.1.0/fastapi_spawn/validators.py +67 -0
  51. fastapi_spawn-0.1.0/pyproject.toml +91 -0
@@ -0,0 +1,53 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.pyd
7
+ .Python
8
+
9
+ # Virtual environments
10
+ .venv/
11
+ venv/
12
+ env/
13
+ ENV/
14
+
15
+ # Distribution / packaging
16
+ dist/
17
+ build/
18
+ *.egg-info/
19
+ *.egg
20
+ .eggs/
21
+ MANIFEST
22
+
23
+ # Secrets & environment variables
24
+ .env
25
+ .env.*
26
+ !.env.example
27
+
28
+ # Testing
29
+ .pytest_cache/
30
+ .coverage
31
+ coverage.xml
32
+ htmlcov/
33
+ .tox/
34
+
35
+ # Type checking
36
+ .mypy_cache/
37
+ .dmypy.json
38
+
39
+ # Ruff / linting
40
+ .ruff_cache/
41
+
42
+ # IDE
43
+ .vscode/
44
+ .idea/
45
+ *.swp
46
+ *.swo
47
+
48
+ # OS
49
+ .DS_Store
50
+ Thumbs.db
51
+
52
+ # Hatch / build backends
53
+ .hatch/
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to `fastapi-spawn` will be documented here.
4
+
5
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
+ Versioning follows [Semantic Versioning](https://semver.org/).
7
+
8
+ ---
9
+
10
+ ## [0.1.0] — 2026-05-10
11
+
12
+ ### Added
13
+ - Interactive TUI with questionary + Rich styling
14
+ - Database support: PostgreSQL, MySQL, MongoDB, SQLite
15
+ - ORM support: SQLAlchemy 2.x (async), Tortoise ORM, Beanie
16
+ - Migration support: Alembic (async-compatible), Aerich
17
+ - Auth: JWT, OAuth2, API Key
18
+ - Message brokers: Redis (Celery), RabbitMQ (Celery), Kafka (aiokafka)
19
+ - Cache layer: Redis, Memcached
20
+ - File storage: AWS S3 (boto3) with presigned URLs
21
+ - AI integration: OpenAI (chat + embeddings, custom base URL), Anthropic Claude
22
+ - Root-level `main.py` entry point (`uv run main.py`)
23
+ - Root-level `tasks/` directory for Celery workers
24
+ - Individual env fields per service with `@property` URL assembly
25
+ - `OPENAI_BASE_URL` support for Azure, LM Studio, local endpoints
26
+ - `--dry-run` flag with rich tree preview
27
+ - `--force` flag to overwrite existing projects
28
+ - Stack options: minimal, standard, full (Helm + Terraform)
29
+ - CI/CD: GitHub Actions, GitLab CI
30
+ - Logging: loguru, structlog, standard library
31
+ - Docker: multi-service compose with health checks
32
+ - infra/: docker/, helm/, terraform/ structure
33
+ - `uv`-compatible `pyproject.toml` with `[tool.uv]`
34
+ - `list-templates` and `validate` subcommands
35
+ - `ENVIRONMENT=dev` style env naming
36
+ - Professional README, CHANGELOG, CONTRIBUTING
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bishwajit Garai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastapi-spawn
3
+ Version: 0.1.0
4
+ Summary: A powerful CLI tool to scaffold production-ready FastAPI projects with flexible database, auth, broker, and deployment options.
5
+ Project-URL: Homepage, https://github.com/Bishwajitgarai/fastapi-spawn
6
+ Project-URL: Documentation, https://github.com/Bishwajitgarai/fastapi-spawn#readme
7
+ Project-URL: Repository, https://github.com/Bishwajitgarai/fastapi-spawn
8
+ Project-URL: Bug Tracker, https://github.com/Bishwajitgarai/fastapi-spawn/issues
9
+ Project-URL: Changelog, https://github.com/Bishwajitgarai/fastapi-spawn/blob/main/CHANGELOG.md
10
+ Author-email: Bishwajit Garai <bishwajitgarai@gmail.com>
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: boilerplate,cli,devtools,docker,fastapi,generator,jwt,project-generator,python,scaffold,sqlalchemy,template
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Code Generators
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Topic :: Utilities
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: click>=8.1.0
29
+ Requires-Dist: jinja2>=3.1.4
30
+ Requires-Dist: questionary>=2.0.1
31
+ Requires-Dist: rich>=13.7.0
32
+ Requires-Dist: tomli>=2.0.1; python_version < '3.11'
33
+ Requires-Dist: typer>=0.12.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
36
+ Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
37
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
38
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
39
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
40
+ Description-Content-Type: text/markdown
41
+
42
+ <div align="center">
43
+
44
+ # ⚡ fastapi-spawn
45
+
46
+ **The most complete FastAPI project scaffolding CLI — built for modern Python development.**
47
+
48
+ [![PyPI version](https://img.shields.io/pypi/v/fastapi-spawn.svg?color=cyan&style=flat-square)](https://pypi.org/project/fastapi-spawn/)
49
+ [![Python](https://img.shields.io/pypi/pyversions/fastapi-spawn.svg?style=flat-square)](https://pypi.org/project/fastapi-spawn/)
50
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=flat-square)](LICENSE)
51
+ [![CI](https://img.shields.io/github/actions/workflow/status/Bishwajitgarai/fastapi-spawn/tests.yml?label=tests&style=flat-square)](https://github.com/Bishwajitgarai/fastapi-spawn/actions)
52
+
53
+ </div>
54
+
55
+ ---
56
+
57
+ ## Why fastapi-spawn?
58
+
59
+ `fastapi-spawn` generates **production-ready** FastAPI projects in seconds. No boilerplate, no guesswork — just run one command and get a fully structured, configured project with the exact stack you need.
60
+
61
+ | Feature | scaffold-fastapi | **fastapi-spawn** |
62
+ |---|---|---|
63
+ | Interactive TUI | Basic prompts | ✅ Rich questionary TUI |
64
+ | Databases | PostgreSQL, MongoDB, SQLite | ✅ + MySQL |
65
+ | ORM | None | ✅ SQLAlchemy 2.x, Tortoise, Beanie |
66
+ | Migrations | ❌ | ✅ Alembic (async), Aerich |
67
+ | Auth | ❌ | ✅ JWT, OAuth2, API Key |
68
+ | Message brokers | Redis, RabbitMQ | ✅ + Kafka |
69
+ | File storage | ❌ | ✅ AWS S3 (boto3) |
70
+ | AI integration | ❌ | ✅ OpenAI, Anthropic |
71
+ | Config style | Single URL | ✅ Individual fields + `@property` URL |
72
+ | Entry point | app/main.py | ✅ Root `main.py` (`uv run main.py`) |
73
+ | CI/CD | GitHub Actions | ✅ GitHub Actions + GitLab CI |
74
+ | Observability | ❌ | ✅ /health /readiness /liveness |
75
+ | Logging | None | ✅ loguru / structlog / standard |
76
+ | Package manager | uv | ✅ uv (with `[tool.uv]` config) |
77
+ | Dry-run mode | ❌ | ✅ Preview tree before generating |
78
+
79
+ ---
80
+
81
+ ## Installation
82
+
83
+ ```bash
84
+ pip install fastapi-spawn
85
+ # or
86
+ uv pip install fastapi-spawn
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Quick Start
92
+
93
+ ```bash
94
+ # Fully interactive — guided TUI
95
+ fastapi-spawn new my-api
96
+
97
+ # One-liner (all flags)
98
+ fastapi-spawn new my-api \
99
+ --db postgresql \
100
+ --orm sqlalchemy \
101
+ --migration alembic \
102
+ --auth jwt \
103
+ --broker redis \
104
+ --storage s3 \
105
+ --ai openai \
106
+ --stack full \
107
+ --ci github \
108
+ --log-lib loguru
109
+
110
+ # Preview without writing files
111
+ fastapi-spawn new my-api --dry-run
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Generated Project Structure
117
+
118
+ ```
119
+ my-api/
120
+ ├── app/
121
+ │ ├── api/
122
+ │ │ └── v1/
123
+ │ │ ├── health.py # /health /readiness /liveness
124
+ │ │ └── auth.py # JWT login + refresh
125
+ │ ├── core/
126
+ │ │ ├── config.py # Pydantic Settings v2 (individual env fields)
127
+ │ │ ├── logging.py # loguru / structlog / standard
128
+ │ │ ├── exceptions.py # Custom exception hierarchy
129
+ │ │ ├── security.py # JWT + bcrypt (when auth enabled)
130
+ │ │ ├── storage.py # AWS S3 utils (when s3 chosen)
131
+ │ │ └── ai.py # OpenAI / Anthropic client (when AI chosen)
132
+ │ ├── db/
133
+ │ │ └── session.py # Async SQLAlchemy / Tortoise / Beanie
134
+ │ ├── models/ # ORM models
135
+ │ ├── schemas/ # Pydantic schemas
136
+ │ ├── services/ # Business logic layer
137
+ │ └── repositories/ # Data access layer
138
+ ├── tasks/ # Celery workers (root-level)
139
+ │ ├── celery_app.py
140
+ │ └── sample_tasks.py
141
+ ├── migrations/ # Alembic migrations
142
+ │ ├── env.py # Async-compatible env
143
+ │ └── versions/
144
+ ├── infra/
145
+ │ ├── docker/
146
+ │ ├── helm/
147
+ │ └── terraform/
148
+ ├── tests/
149
+ │ ├── conftest.py
150
+ │ └── test_health.py
151
+ ├── main.py # uv run main.py entry point
152
+ ├── alembic.ini
153
+ ├── Dockerfile # Uses uv for fast builds
154
+ ├── docker-compose.yml # All services pre-configured
155
+ ├── .env # gitignored
156
+ ├── .env.example
157
+ ├── .gitignore
158
+ ├── .pre-commit-config.yaml
159
+ ├── Makefile
160
+ └── pyproject.toml # uv-compatible
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Environment Variables
166
+
167
+ `fastapi-spawn` generates **individual env fields** (not URL strings) for every service, assembled into URLs via `@property`:
168
+
169
+ ```env
170
+ # PostgreSQL — assembled into DATABASE_URL by settings
171
+ POSTGRES_USER=postgres
172
+ POSTGRES_PASSWORD=postgres
173
+ POSTGRES_HOST=localhost
174
+ POSTGRES_PORT=5432
175
+ POSTGRES_DB=my_api_db
176
+
177
+ # OpenAI — supports custom base URL for Azure / LM Studio
178
+ OPENAI_API_KEY=sk-placeholder
179
+ OPENAI_MODEL=gpt-4o
180
+ OPENAI_BASE_URL= # blank = api.openai.com
181
+
182
+ # Redis
183
+ REDIS_HOST=localhost
184
+ REDIS_PORT=6379
185
+ REDIS_PASSWORD=
186
+ REDIS_DB=0
187
+ ```
188
+
189
+ ---
190
+
191
+ ## All Options
192
+
193
+ ```
194
+ fastapi-spawn new [OPTIONS] PROJECT_NAME
195
+
196
+ --db postgresql | mysql | mongodb | sqlite | none
197
+ --orm sqlalchemy | tortoise | beanie | none
198
+ --migration alembic | aerich | none
199
+ --auth jwt | oauth2 | api-key | none
200
+ --broker redis | rabbitmq | kafka | none
201
+ --cache redis | memcached | none
202
+ --storage s3 | local | none
203
+ --ai openai | anthropic | none
204
+ --stack minimal | standard | full
205
+ --ci github | gitlab | both | none
206
+ --log-lib loguru | structlog | standard
207
+ --no-docker Skip Docker files
208
+ --no-tests Skip test suite
209
+ --dry-run Preview file tree only
210
+ --force / -f Overwrite existing directory
211
+ --output / -o Output directory (default: .)
212
+ ```
213
+
214
+ ### Subcommands
215
+
216
+ ```bash
217
+ fastapi-spawn list-templates # Show all options + ORM/DB compatibility
218
+ fastapi-spawn validate FILE # Validate a .fastapi-spawn.toml
219
+ ```
220
+
221
+ ---
222
+
223
+ ## After Scaffolding
224
+
225
+ ```bash
226
+ cd my-api
227
+ uv sync # Install all dependencies
228
+ uv run alembic upgrade head # Run DB migrations (if alembic)
229
+ docker compose up --build # Start all services
230
+ # or
231
+ uv run main.py # Run locally
232
+ ```
233
+
234
+ ---
235
+
236
+ ## ORM ↔ Database Compatibility
237
+
238
+ | ORM | Compatible Databases |
239
+ |---|---|
240
+ | `sqlalchemy` | postgresql, mysql, sqlite |
241
+ | `tortoise` | postgresql, mysql, sqlite |
242
+ | `beanie` | mongodb |
243
+ | `none` | any |
244
+
245
+ ---
246
+
247
+ ## Contributing
248
+
249
+ ```bash
250
+ git clone https://github.com/Bishwajitgarai/fastapi-spawn
251
+ cd fastapi-spawn
252
+ uv sync --all-extras
253
+ uv run pytest
254
+ ```
255
+
256
+ PRs are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
257
+
258
+ ---
259
+
260
+ ## License
261
+
262
+ MIT © [Bishwajit Garai](https://github.com/Bishwajitgarai)
@@ -0,0 +1,221 @@
1
+ <div align="center">
2
+
3
+ # ⚡ fastapi-spawn
4
+
5
+ **The most complete FastAPI project scaffolding CLI — built for modern Python development.**
6
+
7
+ [![PyPI version](https://img.shields.io/pypi/v/fastapi-spawn.svg?color=cyan&style=flat-square)](https://pypi.org/project/fastapi-spawn/)
8
+ [![Python](https://img.shields.io/pypi/pyversions/fastapi-spawn.svg?style=flat-square)](https://pypi.org/project/fastapi-spawn/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=flat-square)](LICENSE)
10
+ [![CI](https://img.shields.io/github/actions/workflow/status/Bishwajitgarai/fastapi-spawn/tests.yml?label=tests&style=flat-square)](https://github.com/Bishwajitgarai/fastapi-spawn/actions)
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ ## Why fastapi-spawn?
17
+
18
+ `fastapi-spawn` generates **production-ready** FastAPI projects in seconds. No boilerplate, no guesswork — just run one command and get a fully structured, configured project with the exact stack you need.
19
+
20
+ | Feature | scaffold-fastapi | **fastapi-spawn** |
21
+ |---|---|---|
22
+ | Interactive TUI | Basic prompts | ✅ Rich questionary TUI |
23
+ | Databases | PostgreSQL, MongoDB, SQLite | ✅ + MySQL |
24
+ | ORM | None | ✅ SQLAlchemy 2.x, Tortoise, Beanie |
25
+ | Migrations | ❌ | ✅ Alembic (async), Aerich |
26
+ | Auth | ❌ | ✅ JWT, OAuth2, API Key |
27
+ | Message brokers | Redis, RabbitMQ | ✅ + Kafka |
28
+ | File storage | ❌ | ✅ AWS S3 (boto3) |
29
+ | AI integration | ❌ | ✅ OpenAI, Anthropic |
30
+ | Config style | Single URL | ✅ Individual fields + `@property` URL |
31
+ | Entry point | app/main.py | ✅ Root `main.py` (`uv run main.py`) |
32
+ | CI/CD | GitHub Actions | ✅ GitHub Actions + GitLab CI |
33
+ | Observability | ❌ | ✅ /health /readiness /liveness |
34
+ | Logging | None | ✅ loguru / structlog / standard |
35
+ | Package manager | uv | ✅ uv (with `[tool.uv]` config) |
36
+ | Dry-run mode | ❌ | ✅ Preview tree before generating |
37
+
38
+ ---
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install fastapi-spawn
44
+ # or
45
+ uv pip install fastapi-spawn
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Quick Start
51
+
52
+ ```bash
53
+ # Fully interactive — guided TUI
54
+ fastapi-spawn new my-api
55
+
56
+ # One-liner (all flags)
57
+ fastapi-spawn new my-api \
58
+ --db postgresql \
59
+ --orm sqlalchemy \
60
+ --migration alembic \
61
+ --auth jwt \
62
+ --broker redis \
63
+ --storage s3 \
64
+ --ai openai \
65
+ --stack full \
66
+ --ci github \
67
+ --log-lib loguru
68
+
69
+ # Preview without writing files
70
+ fastapi-spawn new my-api --dry-run
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Generated Project Structure
76
+
77
+ ```
78
+ my-api/
79
+ ├── app/
80
+ │ ├── api/
81
+ │ │ └── v1/
82
+ │ │ ├── health.py # /health /readiness /liveness
83
+ │ │ └── auth.py # JWT login + refresh
84
+ │ ├── core/
85
+ │ │ ├── config.py # Pydantic Settings v2 (individual env fields)
86
+ │ │ ├── logging.py # loguru / structlog / standard
87
+ │ │ ├── exceptions.py # Custom exception hierarchy
88
+ │ │ ├── security.py # JWT + bcrypt (when auth enabled)
89
+ │ │ ├── storage.py # AWS S3 utils (when s3 chosen)
90
+ │ │ └── ai.py # OpenAI / Anthropic client (when AI chosen)
91
+ │ ├── db/
92
+ │ │ └── session.py # Async SQLAlchemy / Tortoise / Beanie
93
+ │ ├── models/ # ORM models
94
+ │ ├── schemas/ # Pydantic schemas
95
+ │ ├── services/ # Business logic layer
96
+ │ └── repositories/ # Data access layer
97
+ ├── tasks/ # Celery workers (root-level)
98
+ │ ├── celery_app.py
99
+ │ └── sample_tasks.py
100
+ ├── migrations/ # Alembic migrations
101
+ │ ├── env.py # Async-compatible env
102
+ │ └── versions/
103
+ ├── infra/
104
+ │ ├── docker/
105
+ │ ├── helm/
106
+ │ └── terraform/
107
+ ├── tests/
108
+ │ ├── conftest.py
109
+ │ └── test_health.py
110
+ ├── main.py # uv run main.py entry point
111
+ ├── alembic.ini
112
+ ├── Dockerfile # Uses uv for fast builds
113
+ ├── docker-compose.yml # All services pre-configured
114
+ ├── .env # gitignored
115
+ ├── .env.example
116
+ ├── .gitignore
117
+ ├── .pre-commit-config.yaml
118
+ ├── Makefile
119
+ └── pyproject.toml # uv-compatible
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Environment Variables
125
+
126
+ `fastapi-spawn` generates **individual env fields** (not URL strings) for every service, assembled into URLs via `@property`:
127
+
128
+ ```env
129
+ # PostgreSQL — assembled into DATABASE_URL by settings
130
+ POSTGRES_USER=postgres
131
+ POSTGRES_PASSWORD=postgres
132
+ POSTGRES_HOST=localhost
133
+ POSTGRES_PORT=5432
134
+ POSTGRES_DB=my_api_db
135
+
136
+ # OpenAI — supports custom base URL for Azure / LM Studio
137
+ OPENAI_API_KEY=sk-placeholder
138
+ OPENAI_MODEL=gpt-4o
139
+ OPENAI_BASE_URL= # blank = api.openai.com
140
+
141
+ # Redis
142
+ REDIS_HOST=localhost
143
+ REDIS_PORT=6379
144
+ REDIS_PASSWORD=
145
+ REDIS_DB=0
146
+ ```
147
+
148
+ ---
149
+
150
+ ## All Options
151
+
152
+ ```
153
+ fastapi-spawn new [OPTIONS] PROJECT_NAME
154
+
155
+ --db postgresql | mysql | mongodb | sqlite | none
156
+ --orm sqlalchemy | tortoise | beanie | none
157
+ --migration alembic | aerich | none
158
+ --auth jwt | oauth2 | api-key | none
159
+ --broker redis | rabbitmq | kafka | none
160
+ --cache redis | memcached | none
161
+ --storage s3 | local | none
162
+ --ai openai | anthropic | none
163
+ --stack minimal | standard | full
164
+ --ci github | gitlab | both | none
165
+ --log-lib loguru | structlog | standard
166
+ --no-docker Skip Docker files
167
+ --no-tests Skip test suite
168
+ --dry-run Preview file tree only
169
+ --force / -f Overwrite existing directory
170
+ --output / -o Output directory (default: .)
171
+ ```
172
+
173
+ ### Subcommands
174
+
175
+ ```bash
176
+ fastapi-spawn list-templates # Show all options + ORM/DB compatibility
177
+ fastapi-spawn validate FILE # Validate a .fastapi-spawn.toml
178
+ ```
179
+
180
+ ---
181
+
182
+ ## After Scaffolding
183
+
184
+ ```bash
185
+ cd my-api
186
+ uv sync # Install all dependencies
187
+ uv run alembic upgrade head # Run DB migrations (if alembic)
188
+ docker compose up --build # Start all services
189
+ # or
190
+ uv run main.py # Run locally
191
+ ```
192
+
193
+ ---
194
+
195
+ ## ORM ↔ Database Compatibility
196
+
197
+ | ORM | Compatible Databases |
198
+ |---|---|
199
+ | `sqlalchemy` | postgresql, mysql, sqlite |
200
+ | `tortoise` | postgresql, mysql, sqlite |
201
+ | `beanie` | mongodb |
202
+ | `none` | any |
203
+
204
+ ---
205
+
206
+ ## Contributing
207
+
208
+ ```bash
209
+ git clone https://github.com/Bishwajitgarai/fastapi-spawn
210
+ cd fastapi-spawn
211
+ uv sync --all-extras
212
+ uv run pytest
213
+ ```
214
+
215
+ PRs are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
216
+
217
+ ---
218
+
219
+ ## License
220
+
221
+ MIT © [Bishwajit Garai](https://github.com/Bishwajitgarai)
@@ -0,0 +1,6 @@
1
+ """fastapi-spawn — Production-ready FastAPI project scaffolding CLI."""
2
+
3
+ __version__ = "0.1.0"
4
+ __author__ = "Bishwajit Garai"
5
+ __email__ = "bishwajitgarai@gmail.com"
6
+ __license__ = "MIT"