fastapi-struct 0.1.0__tar.gz → 0.1.1__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 (38) hide show
  1. fastapi_struct-0.1.1/PKG-INFO +267 -0
  2. fastapi_struct-0.1.1/README.md +254 -0
  3. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/pyproject.toml +4 -2
  4. fastapi_struct-0.1.1/src/create_fastapi_app/__init__.py +1 -0
  5. fastapi_struct-0.1.1/src/fastapi_struct.egg-info/PKG-INFO +267 -0
  6. fastapi_struct-0.1.0/PKG-INFO +0 -47
  7. fastapi_struct-0.1.0/README.md +0 -34
  8. fastapi_struct-0.1.0/src/create_fastapi_app/__init__.py +0 -1
  9. fastapi_struct-0.1.0/src/fastapi_struct.egg-info/PKG-INFO +0 -47
  10. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/MANIFEST.in +0 -0
  11. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/setup.cfg +0 -0
  12. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/cli.py +0 -0
  13. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/generator.py +0 -0
  14. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/.env.example +0 -0
  15. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/.gitignore +0 -0
  16. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/README.md +0 -0
  17. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/__init__.py +0 -0
  18. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/core/__init__.py +0 -0
  19. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/core/config.py +0 -0
  20. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/db/__init__.py +0 -0
  21. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/db/database.py +0 -0
  22. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/dependencies.py +0 -0
  23. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/main.py +0 -0
  24. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/models/__init__.py +0 -0
  25. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/routers/__init__.py +0 -0
  26. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/routers/health.py +0 -0
  27. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/routers/users.py +0 -0
  28. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/schemas/__init__.py +0 -0
  29. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/schemas/user.py +0 -0
  30. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/app/services/__init__.py +0 -0
  31. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/pyproject.toml +0 -0
  32. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/tests/__init__.py +0 -0
  33. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/create_fastapi_app/templates/basic/tests/test_main.py +0 -0
  34. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/fastapi_struct.egg-info/SOURCES.txt +0 -0
  35. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/fastapi_struct.egg-info/dependency_links.txt +0 -0
  36. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/fastapi_struct.egg-info/entry_points.txt +0 -0
  37. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/src/fastapi_struct.egg-info/top_level.txt +0 -0
  38. {fastapi_struct-0.1.0 → fastapi_struct-0.1.1}/tests/test_generator.py +0 -0
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastapi-struct
3
+ Version: 0.1.1
4
+ Summary: CLI tool to generate standard, production-ready folder structures for FastAPI applications.
5
+ License-Expression: MIT
6
+ Keywords: fastapi,project-structure,boilerplate,scaffold,cli,template,folder-structure,architecture,rest-api
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Framework :: FastAPI
9
+ Classifier: Topic :: Software Development :: Code Generators
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+
14
+ <p align="center">
15
+ <a href="https://pypi.org/project/fastapi-struct/"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" width="320" alt="fastapi-struct"></a>
16
+ </p>
17
+ <p align="center">
18
+ <em>CLI tool to generate standard, production-ready, modular folder structures for FastAPI applications in seconds.</em>
19
+ </p>
20
+ <p align="center">
21
+ <a href="https://pypi.org/project/fastapi-struct" target="_blank">
22
+ <img src="https://img.shields.io/pypi/v/fastapi-struct.svg?color=%2334D058" alt="Package version">
23
+ </a>
24
+ <a href="https://pypi.org/project/fastapi-struct" target="_blank">
25
+ <img src="https://img.shields.io/pypi/pyversions/fastapi-struct.svg?color=%2334D058" alt="Supported Python versions">
26
+ </a>
27
+ <a href="https://github.com/fastapi/fastapi" target="_blank">
28
+ <img src="https://img.shields.io/badge/FastAPI-0.115+-009688.svg?logo=fastapi&logoColor=white" alt="FastAPI">
29
+ </a>
30
+ <a href="https://github.com/pydantic/pydantic" target="_blank">
31
+ <img src="https://img.shields.io/badge/Pydantic-v2-E92063.svg?logo=pydantic&logoColor=white" alt="Pydantic v2">
32
+ </a>
33
+ <a href="https://opensource.org/licenses/MIT" target="_blank">
34
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT">
35
+ </a>
36
+ </p>
37
+
38
+ ---
39
+
40
+ **Source Code:** [https://github.com/fastapi/fastapi](https://github.com/fastapi/fastapi)
41
+ **FastAPI Documentation:** [https://fastapi.tiangolo.com](https://fastapi.tiangolo.com)
42
+ **PyPI Package:** [https://pypi.org/project/fastapi-struct/](https://pypi.org/project/fastapi-struct/)
43
+
44
+ ---
45
+
46
+ ## ⚡ What is `fastapi-struct`?
47
+
48
+ When starting a new FastAPI project, developers often spend hours configuring boilerplate: creating router files, structuring Pydantic schemas, setting up database sessions, writing `.env` configurations, and setting up `pytest`.
49
+
50
+ **`fastapi-struct`** gives you an instant, production-tested architectural foundation modeled after enterprise best practices—with a single command:
51
+
52
+ ```bash
53
+ fastapi-struct my-api
54
+ ```
55
+
56
+ Or scaffold directly inside your existing directory:
57
+
58
+ ```bash
59
+ fastapi-struct .
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 🎯 Key Features
65
+
66
+ - **⚡ Fast to Scaffold:** Spin up a complete, working FastAPI application in under 2 seconds.
67
+ - **🏛️ Enterprise Clean Architecture:** Separation of concerns dividing **Routers**, **Schemas**, **Database Models**, **Services**, and **Dependencies**.
68
+ - **🛡️ Pydantic v2 & Settings:** Preconfigured with `pydantic-settings` to safely read environment variables from `.env`.
69
+ - **🧪 Ready-to-Run Testing:** Complete with `pytest` and `httpx` integration tests verifying `/` and `/health`.
70
+ - **📖 Interactive API Documentation:** Instant Swagger UI (`/docs`) and ReDoc (`/redoc`) right out of the box.
71
+ - **🪶 Ultra Lightweight:** Zero heavy runtime overhead; purely generates standard Python code.
72
+ - **💻 Cross-Platform:** Works seamlessly on Windows PowerShell, CMD, macOS, and Linux.
73
+
74
+ ---
75
+
76
+ ## 📦 Installation & Quick Start
77
+
78
+ ### Option 1: Instant with `uvx` *(No installation required)*
79
+
80
+ Run it on-demand just like `npx create-react-app`:
81
+
82
+ ```bash
83
+ uvx fastapi-struct my-api
84
+ ```
85
+
86
+ Or in the current folder:
87
+
88
+ ```bash
89
+ uvx fastapi-struct .
90
+ ```
91
+
92
+ ---
93
+
94
+ ### Option 2: Standard install with `pip`
95
+
96
+ ```bash
97
+ pip install fastapi-struct
98
+ ```
99
+
100
+ Generate your project:
101
+
102
+ ```bash
103
+ fastapi-struct my-api
104
+ ```
105
+ *(Alias command `create-fastapi-app my-api` is also included!)*
106
+
107
+ ---
108
+
109
+ ## 📂 The Generated Architecture
110
+
111
+ Every generated application follows a clean, decoupled layout:
112
+
113
+ ```text
114
+ my-api/
115
+ │
116
+ ├── .env.example # Sample environment variables
117
+ ├── .gitignore # Production Python/venv gitignore rules
118
+ ├── pyproject.toml # Project dependencies and Pytest configuration
119
+ ├── README.md # Quickstart guide for your new API
120
+ │
121
+ ├── app/
122
+ │ ├── __init__.py
123
+ │ ├── main.py # Application factory & router registration
124
+ │ ├── dependencies.py # Shared dependencies (Auth, DB session, etc.)
125
+ │ │
126
+ │ ├── core/
127
+ │ │ ├── __init__.py
128
+ │ │ └── config.py # App configuration & BaseSettings (.env loader)
129
+ │ │
130
+ │ ├── routers/ # API endpoints organized by domain
131
+ │ │ ├── __init__.py
132
+ │ │ ├── health.py # System health check (/health)
133
+ │ │ └── users.py # Sample CRUD user endpoints
134
+ │ │
135
+ │ ├── schemas/ # Pydantic data validation & serialization
136
+ │ │ ├── __init__.py
137
+ │ │ └── user.py # UserCreate & UserResponse models
138
+ │ │
139
+ │ ├── models/ # ORM & Database models (SQLAlchemy / SQLModel)
140
+ │ │ └── __init__.py
141
+ │ │
142
+ │ ├── services/ # Pure business logic layer
143
+ │ │ └── __init__.py
144
+ │ │
145
+ │ └── db/ # Database engine & session management
146
+ │ ├── __init__.py
147
+ │ └── database.py
148
+ │
149
+ └── tests/ # Automated testing suite
150
+ ├── __init__.py
151
+ └── test_main.py # Pytest integration tests using TestClient
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 🚀 Running Your Generated Application
157
+
158
+ ### 1. Step into your project directory
159
+ ```bash
160
+ cd my-api
161
+ ```
162
+ *(Skip if generated with `fastapi-struct .`)*
163
+
164
+ ### 2. Create and activate a virtual environment
165
+
166
+ **On Windows (PowerShell):**
167
+ ```powershell
168
+ python -m venv .venv
169
+ .\.venv\Scripts\Activate.ps1
170
+ ```
171
+
172
+ **On Windows (Command Prompt):**
173
+ ```cmd
174
+ python -m venv .venv
175
+ call .venv\Scripts\activate.bat
176
+ ```
177
+
178
+ **On macOS & Linux:**
179
+ ```bash
180
+ python3 -m venv .venv
181
+ source .venv/bin/activate
182
+ ```
183
+
184
+ ### 3. Install dependencies in editable mode
185
+ ```bash
186
+ python -m pip install --upgrade pip
187
+ python -m pip install -e ".[dev]"
188
+ ```
189
+
190
+ ### 4. Start the development server
191
+ ```bash
192
+ python -m uvicorn app.main:app --reload
193
+ ```
194
+
195
+ ---
196
+
197
+ ## 🔍 Explore Your API
198
+
199
+ Once your server is running:
200
+
201
+ | Service | URL | Description |
202
+ | :--- | :--- | :--- |
203
+ | **Root Endpoint** | [http://127.0.0.1:8000/](http://127.0.0.1:8000/) | Welcome JSON response |
204
+ | **Health Check** | [http://127.0.0.1:8000/health](http://127.0.0.1:8000/health) | Uptime monitoring endpoint |
205
+ | **Interactive Docs (Swagger UI)** | [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) | Test endpoints directly in browser |
206
+ | **Alternative Docs (ReDoc)** | [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc) | Clean API reference docs |
207
+
208
+ ---
209
+
210
+ ## 🧪 Running Automated Tests
211
+
212
+ Run the included Pytest suite with:
213
+
214
+ ```bash
215
+ python -m pytest
216
+ ```
217
+
218
+ Output:
219
+ ```text
220
+ tests\test_main.py .. [100%]
221
+ ============================== 2 passed in 0.45s ==============================
222
+ ```
223
+
224
+ ---
225
+
226
+ ## 🧩 Adding a New Feature
227
+
228
+ Adding new capabilities to your generated app takes just 3 clean steps:
229
+
230
+ ### 1. Define your Pydantic Schema (`app/schemas/item.py`)
231
+ ```python
232
+ from pydantic import BaseModel, Field
233
+
234
+ class ItemCreate(BaseModel):
235
+ title: str = Field(min_length=1, max_length=100)
236
+ price: float = Field(gt=0)
237
+
238
+ class ItemResponse(ItemCreate):
239
+ id: int
240
+ ```
241
+
242
+ ### 2. Create your Router (`app/routers/items.py`)
243
+ ```python
244
+ from fastapi import APIRouter
245
+ from app.schemas.item import ItemCreate, ItemResponse
246
+
247
+ router = APIRouter(prefix="/items", tags=["Items"])
248
+
249
+ @router.post("/", response_model=ItemResponse)
250
+ async def create_item(item: ItemCreate):
251
+ return {"id": 1, **item.model_dump()}
252
+ ```
253
+
254
+ ### 3. Register in `app/main.py`
255
+ ```python
256
+ from app.routers.items import router as items_router
257
+
258
+ app.include_router(items_router)
259
+ ```
260
+
261
+ The server automatically reloads, and the new `/items` endpoint is instantly testable at `http://127.0.0.1:8000/docs`!
262
+
263
+ ---
264
+
265
+ ## 📜 License
266
+
267
+ This project is open-source software licensed under the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,254 @@
1
+ <p align="center">
2
+ <a href="https://pypi.org/project/fastapi-struct/"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" width="320" alt="fastapi-struct"></a>
3
+ </p>
4
+ <p align="center">
5
+ <em>CLI tool to generate standard, production-ready, modular folder structures for FastAPI applications in seconds.</em>
6
+ </p>
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/fastapi-struct" target="_blank">
9
+ <img src="https://img.shields.io/pypi/v/fastapi-struct.svg?color=%2334D058" alt="Package version">
10
+ </a>
11
+ <a href="https://pypi.org/project/fastapi-struct" target="_blank">
12
+ <img src="https://img.shields.io/pypi/pyversions/fastapi-struct.svg?color=%2334D058" alt="Supported Python versions">
13
+ </a>
14
+ <a href="https://github.com/fastapi/fastapi" target="_blank">
15
+ <img src="https://img.shields.io/badge/FastAPI-0.115+-009688.svg?logo=fastapi&logoColor=white" alt="FastAPI">
16
+ </a>
17
+ <a href="https://github.com/pydantic/pydantic" target="_blank">
18
+ <img src="https://img.shields.io/badge/Pydantic-v2-E92063.svg?logo=pydantic&logoColor=white" alt="Pydantic v2">
19
+ </a>
20
+ <a href="https://opensource.org/licenses/MIT" target="_blank">
21
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT">
22
+ </a>
23
+ </p>
24
+
25
+ ---
26
+
27
+ **Source Code:** [https://github.com/fastapi/fastapi](https://github.com/fastapi/fastapi)
28
+ **FastAPI Documentation:** [https://fastapi.tiangolo.com](https://fastapi.tiangolo.com)
29
+ **PyPI Package:** [https://pypi.org/project/fastapi-struct/](https://pypi.org/project/fastapi-struct/)
30
+
31
+ ---
32
+
33
+ ## ⚡ What is `fastapi-struct`?
34
+
35
+ When starting a new FastAPI project, developers often spend hours configuring boilerplate: creating router files, structuring Pydantic schemas, setting up database sessions, writing `.env` configurations, and setting up `pytest`.
36
+
37
+ **`fastapi-struct`** gives you an instant, production-tested architectural foundation modeled after enterprise best practices—with a single command:
38
+
39
+ ```bash
40
+ fastapi-struct my-api
41
+ ```
42
+
43
+ Or scaffold directly inside your existing directory:
44
+
45
+ ```bash
46
+ fastapi-struct .
47
+ ```
48
+
49
+ ---
50
+
51
+ ## 🎯 Key Features
52
+
53
+ - **⚡ Fast to Scaffold:** Spin up a complete, working FastAPI application in under 2 seconds.
54
+ - **🏛️ Enterprise Clean Architecture:** Separation of concerns dividing **Routers**, **Schemas**, **Database Models**, **Services**, and **Dependencies**.
55
+ - **🛡️ Pydantic v2 & Settings:** Preconfigured with `pydantic-settings` to safely read environment variables from `.env`.
56
+ - **🧪 Ready-to-Run Testing:** Complete with `pytest` and `httpx` integration tests verifying `/` and `/health`.
57
+ - **📖 Interactive API Documentation:** Instant Swagger UI (`/docs`) and ReDoc (`/redoc`) right out of the box.
58
+ - **🪶 Ultra Lightweight:** Zero heavy runtime overhead; purely generates standard Python code.
59
+ - **💻 Cross-Platform:** Works seamlessly on Windows PowerShell, CMD, macOS, and Linux.
60
+
61
+ ---
62
+
63
+ ## 📦 Installation & Quick Start
64
+
65
+ ### Option 1: Instant with `uvx` *(No installation required)*
66
+
67
+ Run it on-demand just like `npx create-react-app`:
68
+
69
+ ```bash
70
+ uvx fastapi-struct my-api
71
+ ```
72
+
73
+ Or in the current folder:
74
+
75
+ ```bash
76
+ uvx fastapi-struct .
77
+ ```
78
+
79
+ ---
80
+
81
+ ### Option 2: Standard install with `pip`
82
+
83
+ ```bash
84
+ pip install fastapi-struct
85
+ ```
86
+
87
+ Generate your project:
88
+
89
+ ```bash
90
+ fastapi-struct my-api
91
+ ```
92
+ *(Alias command `create-fastapi-app my-api` is also included!)*
93
+
94
+ ---
95
+
96
+ ## 📂 The Generated Architecture
97
+
98
+ Every generated application follows a clean, decoupled layout:
99
+
100
+ ```text
101
+ my-api/
102
+ │
103
+ ├── .env.example # Sample environment variables
104
+ ├── .gitignore # Production Python/venv gitignore rules
105
+ ├── pyproject.toml # Project dependencies and Pytest configuration
106
+ ├── README.md # Quickstart guide for your new API
107
+ │
108
+ ├── app/
109
+ │ ├── __init__.py
110
+ │ ├── main.py # Application factory & router registration
111
+ │ ├── dependencies.py # Shared dependencies (Auth, DB session, etc.)
112
+ │ │
113
+ │ ├── core/
114
+ │ │ ├── __init__.py
115
+ │ │ └── config.py # App configuration & BaseSettings (.env loader)
116
+ │ │
117
+ │ ├── routers/ # API endpoints organized by domain
118
+ │ │ ├── __init__.py
119
+ │ │ ├── health.py # System health check (/health)
120
+ │ │ └── users.py # Sample CRUD user endpoints
121
+ │ │
122
+ │ ├── schemas/ # Pydantic data validation & serialization
123
+ │ │ ├── __init__.py
124
+ │ │ └── user.py # UserCreate & UserResponse models
125
+ │ │
126
+ │ ├── models/ # ORM & Database models (SQLAlchemy / SQLModel)
127
+ │ │ └── __init__.py
128
+ │ │
129
+ │ ├── services/ # Pure business logic layer
130
+ │ │ └── __init__.py
131
+ │ │
132
+ │ └── db/ # Database engine & session management
133
+ │ ├── __init__.py
134
+ │ └── database.py
135
+ │
136
+ └── tests/ # Automated testing suite
137
+ ├── __init__.py
138
+ └── test_main.py # Pytest integration tests using TestClient
139
+ ```
140
+
141
+ ---
142
+
143
+ ## 🚀 Running Your Generated Application
144
+
145
+ ### 1. Step into your project directory
146
+ ```bash
147
+ cd my-api
148
+ ```
149
+ *(Skip if generated with `fastapi-struct .`)*
150
+
151
+ ### 2. Create and activate a virtual environment
152
+
153
+ **On Windows (PowerShell):**
154
+ ```powershell
155
+ python -m venv .venv
156
+ .\.venv\Scripts\Activate.ps1
157
+ ```
158
+
159
+ **On Windows (Command Prompt):**
160
+ ```cmd
161
+ python -m venv .venv
162
+ call .venv\Scripts\activate.bat
163
+ ```
164
+
165
+ **On macOS & Linux:**
166
+ ```bash
167
+ python3 -m venv .venv
168
+ source .venv/bin/activate
169
+ ```
170
+
171
+ ### 3. Install dependencies in editable mode
172
+ ```bash
173
+ python -m pip install --upgrade pip
174
+ python -m pip install -e ".[dev]"
175
+ ```
176
+
177
+ ### 4. Start the development server
178
+ ```bash
179
+ python -m uvicorn app.main:app --reload
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 🔍 Explore Your API
185
+
186
+ Once your server is running:
187
+
188
+ | Service | URL | Description |
189
+ | :--- | :--- | :--- |
190
+ | **Root Endpoint** | [http://127.0.0.1:8000/](http://127.0.0.1:8000/) | Welcome JSON response |
191
+ | **Health Check** | [http://127.0.0.1:8000/health](http://127.0.0.1:8000/health) | Uptime monitoring endpoint |
192
+ | **Interactive Docs (Swagger UI)** | [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) | Test endpoints directly in browser |
193
+ | **Alternative Docs (ReDoc)** | [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc) | Clean API reference docs |
194
+
195
+ ---
196
+
197
+ ## 🧪 Running Automated Tests
198
+
199
+ Run the included Pytest suite with:
200
+
201
+ ```bash
202
+ python -m pytest
203
+ ```
204
+
205
+ Output:
206
+ ```text
207
+ tests\test_main.py .. [100%]
208
+ ============================== 2 passed in 0.45s ==============================
209
+ ```
210
+
211
+ ---
212
+
213
+ ## 🧩 Adding a New Feature
214
+
215
+ Adding new capabilities to your generated app takes just 3 clean steps:
216
+
217
+ ### 1. Define your Pydantic Schema (`app/schemas/item.py`)
218
+ ```python
219
+ from pydantic import BaseModel, Field
220
+
221
+ class ItemCreate(BaseModel):
222
+ title: str = Field(min_length=1, max_length=100)
223
+ price: float = Field(gt=0)
224
+
225
+ class ItemResponse(ItemCreate):
226
+ id: int
227
+ ```
228
+
229
+ ### 2. Create your Router (`app/routers/items.py`)
230
+ ```python
231
+ from fastapi import APIRouter
232
+ from app.schemas.item import ItemCreate, ItemResponse
233
+
234
+ router = APIRouter(prefix="/items", tags=["Items"])
235
+
236
+ @router.post("/", response_model=ItemResponse)
237
+ async def create_item(item: ItemCreate):
238
+ return {"id": 1, **item.model_dump()}
239
+ ```
240
+
241
+ ### 3. Register in `app/main.py`
242
+ ```python
243
+ from app.routers.items import router as items_router
244
+
245
+ app.include_router(items_router)
246
+ ```
247
+
248
+ The server automatically reloads, and the new `/items` endpoint is instantly testable at `http://127.0.0.1:8000/docs`!
249
+
250
+ ---
251
+
252
+ ## 📜 License
253
+
254
+ This project is open-source software licensed under the [MIT License](https://opensource.org/licenses/MIT).
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fastapi-struct"
7
- version = "0.1.0"
8
- description = "CLI tool to generate standard folder structure for FastAPI applications."
7
+ version = "0.1.1"
8
+ description = "CLI tool to generate standard, production-ready folder structures for FastAPI applications."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  license = "MIT"
@@ -17,6 +17,8 @@ keywords = [
17
17
  "cli",
18
18
  "template",
19
19
  "folder-structure",
20
+ "architecture",
21
+ "rest-api",
20
22
  ]
21
23
  classifiers = [
22
24
  "Programming Language :: Python :: 3",
@@ -0,0 +1 @@
1
+ __version__ = "0.1.1"
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastapi-struct
3
+ Version: 0.1.1
4
+ Summary: CLI tool to generate standard, production-ready folder structures for FastAPI applications.
5
+ License-Expression: MIT
6
+ Keywords: fastapi,project-structure,boilerplate,scaffold,cli,template,folder-structure,architecture,rest-api
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Framework :: FastAPI
9
+ Classifier: Topic :: Software Development :: Code Generators
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+
14
+ <p align="center">
15
+ <a href="https://pypi.org/project/fastapi-struct/"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" width="320" alt="fastapi-struct"></a>
16
+ </p>
17
+ <p align="center">
18
+ <em>CLI tool to generate standard, production-ready, modular folder structures for FastAPI applications in seconds.</em>
19
+ </p>
20
+ <p align="center">
21
+ <a href="https://pypi.org/project/fastapi-struct" target="_blank">
22
+ <img src="https://img.shields.io/pypi/v/fastapi-struct.svg?color=%2334D058" alt="Package version">
23
+ </a>
24
+ <a href="https://pypi.org/project/fastapi-struct" target="_blank">
25
+ <img src="https://img.shields.io/pypi/pyversions/fastapi-struct.svg?color=%2334D058" alt="Supported Python versions">
26
+ </a>
27
+ <a href="https://github.com/fastapi/fastapi" target="_blank">
28
+ <img src="https://img.shields.io/badge/FastAPI-0.115+-009688.svg?logo=fastapi&logoColor=white" alt="FastAPI">
29
+ </a>
30
+ <a href="https://github.com/pydantic/pydantic" target="_blank">
31
+ <img src="https://img.shields.io/badge/Pydantic-v2-E92063.svg?logo=pydantic&logoColor=white" alt="Pydantic v2">
32
+ </a>
33
+ <a href="https://opensource.org/licenses/MIT" target="_blank">
34
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT">
35
+ </a>
36
+ </p>
37
+
38
+ ---
39
+
40
+ **Source Code:** [https://github.com/fastapi/fastapi](https://github.com/fastapi/fastapi)
41
+ **FastAPI Documentation:** [https://fastapi.tiangolo.com](https://fastapi.tiangolo.com)
42
+ **PyPI Package:** [https://pypi.org/project/fastapi-struct/](https://pypi.org/project/fastapi-struct/)
43
+
44
+ ---
45
+
46
+ ## ⚡ What is `fastapi-struct`?
47
+
48
+ When starting a new FastAPI project, developers often spend hours configuring boilerplate: creating router files, structuring Pydantic schemas, setting up database sessions, writing `.env` configurations, and setting up `pytest`.
49
+
50
+ **`fastapi-struct`** gives you an instant, production-tested architectural foundation modeled after enterprise best practices—with a single command:
51
+
52
+ ```bash
53
+ fastapi-struct my-api
54
+ ```
55
+
56
+ Or scaffold directly inside your existing directory:
57
+
58
+ ```bash
59
+ fastapi-struct .
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 🎯 Key Features
65
+
66
+ - **⚡ Fast to Scaffold:** Spin up a complete, working FastAPI application in under 2 seconds.
67
+ - **🏛️ Enterprise Clean Architecture:** Separation of concerns dividing **Routers**, **Schemas**, **Database Models**, **Services**, and **Dependencies**.
68
+ - **🛡️ Pydantic v2 & Settings:** Preconfigured with `pydantic-settings` to safely read environment variables from `.env`.
69
+ - **🧪 Ready-to-Run Testing:** Complete with `pytest` and `httpx` integration tests verifying `/` and `/health`.
70
+ - **📖 Interactive API Documentation:** Instant Swagger UI (`/docs`) and ReDoc (`/redoc`) right out of the box.
71
+ - **🪶 Ultra Lightweight:** Zero heavy runtime overhead; purely generates standard Python code.
72
+ - **💻 Cross-Platform:** Works seamlessly on Windows PowerShell, CMD, macOS, and Linux.
73
+
74
+ ---
75
+
76
+ ## 📦 Installation & Quick Start
77
+
78
+ ### Option 1: Instant with `uvx` *(No installation required)*
79
+
80
+ Run it on-demand just like `npx create-react-app`:
81
+
82
+ ```bash
83
+ uvx fastapi-struct my-api
84
+ ```
85
+
86
+ Or in the current folder:
87
+
88
+ ```bash
89
+ uvx fastapi-struct .
90
+ ```
91
+
92
+ ---
93
+
94
+ ### Option 2: Standard install with `pip`
95
+
96
+ ```bash
97
+ pip install fastapi-struct
98
+ ```
99
+
100
+ Generate your project:
101
+
102
+ ```bash
103
+ fastapi-struct my-api
104
+ ```
105
+ *(Alias command `create-fastapi-app my-api` is also included!)*
106
+
107
+ ---
108
+
109
+ ## 📂 The Generated Architecture
110
+
111
+ Every generated application follows a clean, decoupled layout:
112
+
113
+ ```text
114
+ my-api/
115
+ │
116
+ ├── .env.example # Sample environment variables
117
+ ├── .gitignore # Production Python/venv gitignore rules
118
+ ├── pyproject.toml # Project dependencies and Pytest configuration
119
+ ├── README.md # Quickstart guide for your new API
120
+ │
121
+ ├── app/
122
+ │ ├── __init__.py
123
+ │ ├── main.py # Application factory & router registration
124
+ │ ├── dependencies.py # Shared dependencies (Auth, DB session, etc.)
125
+ │ │
126
+ │ ├── core/
127
+ │ │ ├── __init__.py
128
+ │ │ └── config.py # App configuration & BaseSettings (.env loader)
129
+ │ │
130
+ │ ├── routers/ # API endpoints organized by domain
131
+ │ │ ├── __init__.py
132
+ │ │ ├── health.py # System health check (/health)
133
+ │ │ └── users.py # Sample CRUD user endpoints
134
+ │ │
135
+ │ ├── schemas/ # Pydantic data validation & serialization
136
+ │ │ ├── __init__.py
137
+ │ │ └── user.py # UserCreate & UserResponse models
138
+ │ │
139
+ │ ├── models/ # ORM & Database models (SQLAlchemy / SQLModel)
140
+ │ │ └── __init__.py
141
+ │ │
142
+ │ ├── services/ # Pure business logic layer
143
+ │ │ └── __init__.py
144
+ │ │
145
+ │ └── db/ # Database engine & session management
146
+ │ ├── __init__.py
147
+ │ └── database.py
148
+ │
149
+ └── tests/ # Automated testing suite
150
+ ├── __init__.py
151
+ └── test_main.py # Pytest integration tests using TestClient
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 🚀 Running Your Generated Application
157
+
158
+ ### 1. Step into your project directory
159
+ ```bash
160
+ cd my-api
161
+ ```
162
+ *(Skip if generated with `fastapi-struct .`)*
163
+
164
+ ### 2. Create and activate a virtual environment
165
+
166
+ **On Windows (PowerShell):**
167
+ ```powershell
168
+ python -m venv .venv
169
+ .\.venv\Scripts\Activate.ps1
170
+ ```
171
+
172
+ **On Windows (Command Prompt):**
173
+ ```cmd
174
+ python -m venv .venv
175
+ call .venv\Scripts\activate.bat
176
+ ```
177
+
178
+ **On macOS & Linux:**
179
+ ```bash
180
+ python3 -m venv .venv
181
+ source .venv/bin/activate
182
+ ```
183
+
184
+ ### 3. Install dependencies in editable mode
185
+ ```bash
186
+ python -m pip install --upgrade pip
187
+ python -m pip install -e ".[dev]"
188
+ ```
189
+
190
+ ### 4. Start the development server
191
+ ```bash
192
+ python -m uvicorn app.main:app --reload
193
+ ```
194
+
195
+ ---
196
+
197
+ ## 🔍 Explore Your API
198
+
199
+ Once your server is running:
200
+
201
+ | Service | URL | Description |
202
+ | :--- | :--- | :--- |
203
+ | **Root Endpoint** | [http://127.0.0.1:8000/](http://127.0.0.1:8000/) | Welcome JSON response |
204
+ | **Health Check** | [http://127.0.0.1:8000/health](http://127.0.0.1:8000/health) | Uptime monitoring endpoint |
205
+ | **Interactive Docs (Swagger UI)** | [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) | Test endpoints directly in browser |
206
+ | **Alternative Docs (ReDoc)** | [http://127.0.0.1:8000/redoc](http://127.0.0.1:8000/redoc) | Clean API reference docs |
207
+
208
+ ---
209
+
210
+ ## 🧪 Running Automated Tests
211
+
212
+ Run the included Pytest suite with:
213
+
214
+ ```bash
215
+ python -m pytest
216
+ ```
217
+
218
+ Output:
219
+ ```text
220
+ tests\test_main.py .. [100%]
221
+ ============================== 2 passed in 0.45s ==============================
222
+ ```
223
+
224
+ ---
225
+
226
+ ## 🧩 Adding a New Feature
227
+
228
+ Adding new capabilities to your generated app takes just 3 clean steps:
229
+
230
+ ### 1. Define your Pydantic Schema (`app/schemas/item.py`)
231
+ ```python
232
+ from pydantic import BaseModel, Field
233
+
234
+ class ItemCreate(BaseModel):
235
+ title: str = Field(min_length=1, max_length=100)
236
+ price: float = Field(gt=0)
237
+
238
+ class ItemResponse(ItemCreate):
239
+ id: int
240
+ ```
241
+
242
+ ### 2. Create your Router (`app/routers/items.py`)
243
+ ```python
244
+ from fastapi import APIRouter
245
+ from app.schemas.item import ItemCreate, ItemResponse
246
+
247
+ router = APIRouter(prefix="/items", tags=["Items"])
248
+
249
+ @router.post("/", response_model=ItemResponse)
250
+ async def create_item(item: ItemCreate):
251
+ return {"id": 1, **item.model_dump()}
252
+ ```
253
+
254
+ ### 3. Register in `app/main.py`
255
+ ```python
256
+ from app.routers.items import router as items_router
257
+
258
+ app.include_router(items_router)
259
+ ```
260
+
261
+ The server automatically reloads, and the new `/items` endpoint is instantly testable at `http://127.0.0.1:8000/docs`!
262
+
263
+ ---
264
+
265
+ ## 📜 License
266
+
267
+ This project is open-source software licensed under the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,47 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fastapi-struct
3
- Version: 0.1.0
4
- Summary: CLI tool to generate standard folder structure for FastAPI applications.
5
- License-Expression: MIT
6
- Keywords: fastapi,project-structure,boilerplate,scaffold,cli,template,folder-structure
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Framework :: FastAPI
9
- Classifier: Topic :: Software Development :: Code Generators
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.10
12
- Description-Content-Type: text/markdown
13
-
14
- # fastapi-struct
15
-
16
- CLI tool to generate standard, production-ready folder structures for FastAPI applications.
17
-
18
- ## Usage
19
-
20
- ### Instant with uvx (no installation needed)
21
- ```bash
22
- uvx fastapi-struct my-api
23
- ```
24
- Or in the current folder:
25
- ```bash
26
- uvx fastapi-struct .
27
- ```
28
-
29
- ### Or install via pip
30
- ```bash
31
- pip install fastapi-struct
32
- fastapi-struct my-api
33
- ```
34
- *(You can also use `create-fastapi-app my-api`)*
35
-
36
- ## Generated Project Next Steps
37
-
38
- ```powershell
39
- cd my-api
40
- python -m venv .venv
41
- .\.venv\Scripts\Activate.ps1
42
- python -m pip install -e ".[dev]"
43
- python -m uvicorn app.main:app --reload
44
- ```
45
-
46
- Interactive API documentation will be available at:
47
- http://127.0.0.1:8000/docs
@@ -1,34 +0,0 @@
1
- # fastapi-struct
2
-
3
- CLI tool to generate standard, production-ready folder structures for FastAPI applications.
4
-
5
- ## Usage
6
-
7
- ### Instant with uvx (no installation needed)
8
- ```bash
9
- uvx fastapi-struct my-api
10
- ```
11
- Or in the current folder:
12
- ```bash
13
- uvx fastapi-struct .
14
- ```
15
-
16
- ### Or install via pip
17
- ```bash
18
- pip install fastapi-struct
19
- fastapi-struct my-api
20
- ```
21
- *(You can also use `create-fastapi-app my-api`)*
22
-
23
- ## Generated Project Next Steps
24
-
25
- ```powershell
26
- cd my-api
27
- python -m venv .venv
28
- .\.venv\Scripts\Activate.ps1
29
- python -m pip install -e ".[dev]"
30
- python -m uvicorn app.main:app --reload
31
- ```
32
-
33
- Interactive API documentation will be available at:
34
- http://127.0.0.1:8000/docs
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"
@@ -1,47 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: fastapi-struct
3
- Version: 0.1.0
4
- Summary: CLI tool to generate standard folder structure for FastAPI applications.
5
- License-Expression: MIT
6
- Keywords: fastapi,project-structure,boilerplate,scaffold,cli,template,folder-structure
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Framework :: FastAPI
9
- Classifier: Topic :: Software Development :: Code Generators
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.10
12
- Description-Content-Type: text/markdown
13
-
14
- # fastapi-struct
15
-
16
- CLI tool to generate standard, production-ready folder structures for FastAPI applications.
17
-
18
- ## Usage
19
-
20
- ### Instant with uvx (no installation needed)
21
- ```bash
22
- uvx fastapi-struct my-api
23
- ```
24
- Or in the current folder:
25
- ```bash
26
- uvx fastapi-struct .
27
- ```
28
-
29
- ### Or install via pip
30
- ```bash
31
- pip install fastapi-struct
32
- fastapi-struct my-api
33
- ```
34
- *(You can also use `create-fastapi-app my-api`)*
35
-
36
- ## Generated Project Next Steps
37
-
38
- ```powershell
39
- cd my-api
40
- python -m venv .venv
41
- .\.venv\Scripts\Activate.ps1
42
- python -m pip install -e ".[dev]"
43
- python -m uvicorn app.main:app --reload
44
- ```
45
-
46
- Interactive API documentation will be available at:
47
- http://127.0.0.1:8000/docs
File without changes