create-modern-fastapi 0.3.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.
- create_modern_fastapi-0.3.0/PKG-INFO +124 -0
- create_modern_fastapi-0.3.0/README.md +117 -0
- create_modern_fastapi-0.3.0/pyproject.toml +12 -0
- create_modern_fastapi-0.3.0/setup.cfg +4 -0
- create_modern_fastapi-0.3.0/src/create_modern_fastapi/__main__.py +11 -0
- create_modern_fastapi-0.3.0/src/create_modern_fastapi.egg-info/PKG-INFO +124 -0
- create_modern_fastapi-0.3.0/src/create_modern_fastapi.egg-info/SOURCES.txt +8 -0
- create_modern_fastapi-0.3.0/src/create_modern_fastapi.egg-info/dependency_links.txt +1 -0
- create_modern_fastapi-0.3.0/src/create_modern_fastapi.egg-info/entry_points.txt +2 -0
- create_modern_fastapi-0.3.0/src/create_modern_fastapi.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: create-modern-fastapi
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A CLI tool to create a FastAPI project.
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Clean Architecture Template for FastAPI Applications
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
[](https://github.com/copier-org/copier)
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
This template provides a clean and well-structured foundation for building FastAPI applications using Clean Architecture principles. It uses **SQLModel** as the ORM and **PostgreSQL** as the database. It clearly separates business logic, use cases, infrastructure, and the API layer to ensure maintainability, testability, and scalability. With an explicit project structure and built-in testing strategy, it serves as a solid starting point for developing professional and production-ready backends.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
- Python 3.10 or higher
|
|
19
|
+
- PostgreSQL
|
|
20
|
+
- [uv](https://docs.astral.sh/uv/getting-started/installation/) for managing virtual environments and dependencies
|
|
21
|
+
- [justfile](https://just.systems/man/en/packages.html) for command runner
|
|
22
|
+
|
|
23
|
+
## Todo
|
|
24
|
+
|
|
25
|
+
| Description | Status |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Setup project structure | ✅ |
|
|
28
|
+
| Create database models and implement database connection | ✅ |
|
|
29
|
+
| Test with real database (e.g., PostgreSQL, MySQL) | ✅ |
|
|
30
|
+
| Setup migration (alembic) | ✅ |
|
|
31
|
+
| Test on real project | ☕ |
|
|
32
|
+
| Implement end-to-end tests setup | ⛔ |
|
|
33
|
+
| Implement integration tests setup | ⛔ |
|
|
34
|
+
|
|
35
|
+
## Setup
|
|
36
|
+
|
|
37
|
+
1. Create project with
|
|
38
|
+
```bash
|
|
39
|
+
uvx create-clean-archi-fastapi
|
|
40
|
+
```
|
|
41
|
+
3. Navigate to the project directory:
|
|
42
|
+
4. Install dependencies:
|
|
43
|
+
```bash
|
|
44
|
+
uv sync
|
|
45
|
+
```
|
|
46
|
+
5. Run the application:
|
|
47
|
+
```bash
|
|
48
|
+
just start
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Flow
|
|
52
|
+
|
|
53
|
+
```mermaid
|
|
54
|
+
flowchart LR
|
|
55
|
+
ENTRY[Entry Point]
|
|
56
|
+
PRESENTATION[Presentation]
|
|
57
|
+
APPLICATION[Application]
|
|
58
|
+
INFRASTRUCTURE[Infrastructure]
|
|
59
|
+
DOMAIN[Domain]
|
|
60
|
+
|
|
61
|
+
ENTRY --> PRESENTATION
|
|
62
|
+
PRESENTATION --> APPLICATION
|
|
63
|
+
PRESENTATION --> INFRASTRUCTURE
|
|
64
|
+
PRESENTATION --> DOMAIN
|
|
65
|
+
APPLICATION --> DOMAIN
|
|
66
|
+
INFRASTRUCTURE --> DOMAIN
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Project Structure
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
.
|
|
73
|
+
├── justfile
|
|
74
|
+
├── main.py -------------- --- Entry point of the application
|
|
75
|
+
├── pyproject.toml ------- --- Project configuration and dependencies
|
|
76
|
+
├── README.md ------------ --- This file
|
|
77
|
+
├── src/
|
|
78
|
+
│ ├── application/
|
|
79
|
+
│ │ ├── interface/ ---- --- Contains interfaces for repositories, services, etc.
|
|
80
|
+
│ │ └── use_case/ ----- --- Contains application use cases (1 file per use case)
|
|
81
|
+
│ ├── config.py
|
|
82
|
+
│ ├── domain/
|
|
83
|
+
│ │ ├── entities/ ----- --- Contains domain entities
|
|
84
|
+
│ │ ├── exceptions/ --- --- Contains custom exceptions for the domain
|
|
85
|
+
│ │ └── value_objects/ --- Contains value objects for the domain
|
|
86
|
+
│ ├── infrastructure/ --- --- Contains implementations of interfaces defined in the application layer
|
|
87
|
+
│ │ └── database/ ----- --- Contains database connection and models
|
|
88
|
+
│ │ │ ├── database.py --- Contains database connection and session management
|
|
89
|
+
│ │ │ ├── interface.py -- Contains database interface definitions
|
|
90
|
+
│ │ │ ├── models/ --- --- Contains database models
|
|
91
|
+
│ │ │ └── seed/ ----- --- Contains database seeding scripts
|
|
92
|
+
│ └── presentation/ ----- --- Contains FastAPI application and API routes
|
|
93
|
+
│ ├── app.py -------- --- Contains FastAPI application setup
|
|
94
|
+
│ ├── core/ --------- --- Contains core components like error_handling, middleware, etc.
|
|
95
|
+
│ ├── deps/ --------- --- Contains dependency injection components
|
|
96
|
+
│ ├── routes/ ------- --- Contains API route definitions
|
|
97
|
+
│ └── schemas/ ------ --- Contains Pydantic schemas for request and response validation
|
|
98
|
+
├── tests/
|
|
99
|
+
│ ├── clean/ ------------ --- Contains tests for clean architecture dependency rules
|
|
100
|
+
│ ├── conftest.py ------- --- Contains fixtures for tests
|
|
101
|
+
│ ├── e2e/ -------------- --- Contains end-to-end tests (in progress)
|
|
102
|
+
│ ├── integration/ ------ --- Contains integration tests (in progress)
|
|
103
|
+
│ ├── unit/ ------------- --- Contains unit tests for application logic
|
|
104
|
+
│ └── utils.py ---------- --- Contains utility functions for tests
|
|
105
|
+
└── uv.lock
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Testing
|
|
110
|
+
|
|
111
|
+
To run tests, use the following command:
|
|
112
|
+
|
|
113
|
+
- Run unit tests:
|
|
114
|
+
```bash
|
|
115
|
+
just test-unit
|
|
116
|
+
```
|
|
117
|
+
- Run tests with coverage:
|
|
118
|
+
```bash
|
|
119
|
+
just test-coverage
|
|
120
|
+
```
|
|
121
|
+
- Run test for clean architecture dependency rules:
|
|
122
|
+
```bash
|
|
123
|
+
just test-clean
|
|
124
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
|
|
2
|
+
# Clean Architecture Template for FastAPI Applications
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
[](https://github.com/copier-org/copier)
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
This template provides a clean and well-structured foundation for building FastAPI applications using Clean Architecture principles. It uses **SQLModel** as the ORM and **PostgreSQL** as the database. It clearly separates business logic, use cases, infrastructure, and the API layer to ensure maintainability, testability, and scalability. With an explicit project structure and built-in testing strategy, it serves as a solid starting point for developing professional and production-ready backends.
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
- Python 3.10 or higher
|
|
12
|
+
- PostgreSQL
|
|
13
|
+
- [uv](https://docs.astral.sh/uv/getting-started/installation/) for managing virtual environments and dependencies
|
|
14
|
+
- [justfile](https://just.systems/man/en/packages.html) for command runner
|
|
15
|
+
|
|
16
|
+
## Todo
|
|
17
|
+
|
|
18
|
+
| Description | Status |
|
|
19
|
+
|---|---|
|
|
20
|
+
| Setup project structure | ✅ |
|
|
21
|
+
| Create database models and implement database connection | ✅ |
|
|
22
|
+
| Test with real database (e.g., PostgreSQL, MySQL) | ✅ |
|
|
23
|
+
| Setup migration (alembic) | ✅ |
|
|
24
|
+
| Test on real project | ☕ |
|
|
25
|
+
| Implement end-to-end tests setup | ⛔ |
|
|
26
|
+
| Implement integration tests setup | ⛔ |
|
|
27
|
+
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
1. Create project with
|
|
31
|
+
```bash
|
|
32
|
+
uvx create-clean-archi-fastapi
|
|
33
|
+
```
|
|
34
|
+
3. Navigate to the project directory:
|
|
35
|
+
4. Install dependencies:
|
|
36
|
+
```bash
|
|
37
|
+
uv sync
|
|
38
|
+
```
|
|
39
|
+
5. Run the application:
|
|
40
|
+
```bash
|
|
41
|
+
just start
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Flow
|
|
45
|
+
|
|
46
|
+
```mermaid
|
|
47
|
+
flowchart LR
|
|
48
|
+
ENTRY[Entry Point]
|
|
49
|
+
PRESENTATION[Presentation]
|
|
50
|
+
APPLICATION[Application]
|
|
51
|
+
INFRASTRUCTURE[Infrastructure]
|
|
52
|
+
DOMAIN[Domain]
|
|
53
|
+
|
|
54
|
+
ENTRY --> PRESENTATION
|
|
55
|
+
PRESENTATION --> APPLICATION
|
|
56
|
+
PRESENTATION --> INFRASTRUCTURE
|
|
57
|
+
PRESENTATION --> DOMAIN
|
|
58
|
+
APPLICATION --> DOMAIN
|
|
59
|
+
INFRASTRUCTURE --> DOMAIN
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Project Structure
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
.
|
|
66
|
+
├── justfile
|
|
67
|
+
├── main.py -------------- --- Entry point of the application
|
|
68
|
+
├── pyproject.toml ------- --- Project configuration and dependencies
|
|
69
|
+
├── README.md ------------ --- This file
|
|
70
|
+
├── src/
|
|
71
|
+
│ ├── application/
|
|
72
|
+
│ │ ├── interface/ ---- --- Contains interfaces for repositories, services, etc.
|
|
73
|
+
│ │ └── use_case/ ----- --- Contains application use cases (1 file per use case)
|
|
74
|
+
│ ├── config.py
|
|
75
|
+
│ ├── domain/
|
|
76
|
+
│ │ ├── entities/ ----- --- Contains domain entities
|
|
77
|
+
│ │ ├── exceptions/ --- --- Contains custom exceptions for the domain
|
|
78
|
+
│ │ └── value_objects/ --- Contains value objects for the domain
|
|
79
|
+
│ ├── infrastructure/ --- --- Contains implementations of interfaces defined in the application layer
|
|
80
|
+
│ │ └── database/ ----- --- Contains database connection and models
|
|
81
|
+
│ │ │ ├── database.py --- Contains database connection and session management
|
|
82
|
+
│ │ │ ├── interface.py -- Contains database interface definitions
|
|
83
|
+
│ │ │ ├── models/ --- --- Contains database models
|
|
84
|
+
│ │ │ └── seed/ ----- --- Contains database seeding scripts
|
|
85
|
+
│ └── presentation/ ----- --- Contains FastAPI application and API routes
|
|
86
|
+
│ ├── app.py -------- --- Contains FastAPI application setup
|
|
87
|
+
│ ├── core/ --------- --- Contains core components like error_handling, middleware, etc.
|
|
88
|
+
│ ├── deps/ --------- --- Contains dependency injection components
|
|
89
|
+
│ ├── routes/ ------- --- Contains API route definitions
|
|
90
|
+
│ └── schemas/ ------ --- Contains Pydantic schemas for request and response validation
|
|
91
|
+
├── tests/
|
|
92
|
+
│ ├── clean/ ------------ --- Contains tests for clean architecture dependency rules
|
|
93
|
+
│ ├── conftest.py ------- --- Contains fixtures for tests
|
|
94
|
+
│ ├── e2e/ -------------- --- Contains end-to-end tests (in progress)
|
|
95
|
+
│ ├── integration/ ------ --- Contains integration tests (in progress)
|
|
96
|
+
│ ├── unit/ ------------- --- Contains unit tests for application logic
|
|
97
|
+
│ └── utils.py ---------- --- Contains utility functions for tests
|
|
98
|
+
└── uv.lock
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Testing
|
|
103
|
+
|
|
104
|
+
To run tests, use the following command:
|
|
105
|
+
|
|
106
|
+
- Run unit tests:
|
|
107
|
+
```bash
|
|
108
|
+
just test-unit
|
|
109
|
+
```
|
|
110
|
+
- Run tests with coverage:
|
|
111
|
+
```bash
|
|
112
|
+
just test-coverage
|
|
113
|
+
```
|
|
114
|
+
- Run test for clean architecture dependency rules:
|
|
115
|
+
```bash
|
|
116
|
+
just test-clean
|
|
117
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "create-modern-fastapi"
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "A CLI tool to create a FastAPI project."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = []
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
[project.scripts]
|
|
11
|
+
|
|
12
|
+
create-modern-fastapi = "create_modern_fastapi.__main__:main"
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: create-modern-fastapi
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A CLI tool to create a FastAPI project.
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Clean Architecture Template for FastAPI Applications
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
[](https://github.com/copier-org/copier)
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
This template provides a clean and well-structured foundation for building FastAPI applications using Clean Architecture principles. It uses **SQLModel** as the ORM and **PostgreSQL** as the database. It clearly separates business logic, use cases, infrastructure, and the API layer to ensure maintainability, testability, and scalability. With an explicit project structure and built-in testing strategy, it serves as a solid starting point for developing professional and production-ready backends.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
- Python 3.10 or higher
|
|
19
|
+
- PostgreSQL
|
|
20
|
+
- [uv](https://docs.astral.sh/uv/getting-started/installation/) for managing virtual environments and dependencies
|
|
21
|
+
- [justfile](https://just.systems/man/en/packages.html) for command runner
|
|
22
|
+
|
|
23
|
+
## Todo
|
|
24
|
+
|
|
25
|
+
| Description | Status |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Setup project structure | ✅ |
|
|
28
|
+
| Create database models and implement database connection | ✅ |
|
|
29
|
+
| Test with real database (e.g., PostgreSQL, MySQL) | ✅ |
|
|
30
|
+
| Setup migration (alembic) | ✅ |
|
|
31
|
+
| Test on real project | ☕ |
|
|
32
|
+
| Implement end-to-end tests setup | ⛔ |
|
|
33
|
+
| Implement integration tests setup | ⛔ |
|
|
34
|
+
|
|
35
|
+
## Setup
|
|
36
|
+
|
|
37
|
+
1. Create project with
|
|
38
|
+
```bash
|
|
39
|
+
uvx create-clean-archi-fastapi
|
|
40
|
+
```
|
|
41
|
+
3. Navigate to the project directory:
|
|
42
|
+
4. Install dependencies:
|
|
43
|
+
```bash
|
|
44
|
+
uv sync
|
|
45
|
+
```
|
|
46
|
+
5. Run the application:
|
|
47
|
+
```bash
|
|
48
|
+
just start
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Flow
|
|
52
|
+
|
|
53
|
+
```mermaid
|
|
54
|
+
flowchart LR
|
|
55
|
+
ENTRY[Entry Point]
|
|
56
|
+
PRESENTATION[Presentation]
|
|
57
|
+
APPLICATION[Application]
|
|
58
|
+
INFRASTRUCTURE[Infrastructure]
|
|
59
|
+
DOMAIN[Domain]
|
|
60
|
+
|
|
61
|
+
ENTRY --> PRESENTATION
|
|
62
|
+
PRESENTATION --> APPLICATION
|
|
63
|
+
PRESENTATION --> INFRASTRUCTURE
|
|
64
|
+
PRESENTATION --> DOMAIN
|
|
65
|
+
APPLICATION --> DOMAIN
|
|
66
|
+
INFRASTRUCTURE --> DOMAIN
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Project Structure
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
.
|
|
73
|
+
├── justfile
|
|
74
|
+
├── main.py -------------- --- Entry point of the application
|
|
75
|
+
├── pyproject.toml ------- --- Project configuration and dependencies
|
|
76
|
+
├── README.md ------------ --- This file
|
|
77
|
+
├── src/
|
|
78
|
+
│ ├── application/
|
|
79
|
+
│ │ ├── interface/ ---- --- Contains interfaces for repositories, services, etc.
|
|
80
|
+
│ │ └── use_case/ ----- --- Contains application use cases (1 file per use case)
|
|
81
|
+
│ ├── config.py
|
|
82
|
+
│ ├── domain/
|
|
83
|
+
│ │ ├── entities/ ----- --- Contains domain entities
|
|
84
|
+
│ │ ├── exceptions/ --- --- Contains custom exceptions for the domain
|
|
85
|
+
│ │ └── value_objects/ --- Contains value objects for the domain
|
|
86
|
+
│ ├── infrastructure/ --- --- Contains implementations of interfaces defined in the application layer
|
|
87
|
+
│ │ └── database/ ----- --- Contains database connection and models
|
|
88
|
+
│ │ │ ├── database.py --- Contains database connection and session management
|
|
89
|
+
│ │ │ ├── interface.py -- Contains database interface definitions
|
|
90
|
+
│ │ │ ├── models/ --- --- Contains database models
|
|
91
|
+
│ │ │ └── seed/ ----- --- Contains database seeding scripts
|
|
92
|
+
│ └── presentation/ ----- --- Contains FastAPI application and API routes
|
|
93
|
+
│ ├── app.py -------- --- Contains FastAPI application setup
|
|
94
|
+
│ ├── core/ --------- --- Contains core components like error_handling, middleware, etc.
|
|
95
|
+
│ ├── deps/ --------- --- Contains dependency injection components
|
|
96
|
+
│ ├── routes/ ------- --- Contains API route definitions
|
|
97
|
+
│ └── schemas/ ------ --- Contains Pydantic schemas for request and response validation
|
|
98
|
+
├── tests/
|
|
99
|
+
│ ├── clean/ ------------ --- Contains tests for clean architecture dependency rules
|
|
100
|
+
│ ├── conftest.py ------- --- Contains fixtures for tests
|
|
101
|
+
│ ├── e2e/ -------------- --- Contains end-to-end tests (in progress)
|
|
102
|
+
│ ├── integration/ ------ --- Contains integration tests (in progress)
|
|
103
|
+
│ ├── unit/ ------------- --- Contains unit tests for application logic
|
|
104
|
+
│ └── utils.py ---------- --- Contains utility functions for tests
|
|
105
|
+
└── uv.lock
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Testing
|
|
110
|
+
|
|
111
|
+
To run tests, use the following command:
|
|
112
|
+
|
|
113
|
+
- Run unit tests:
|
|
114
|
+
```bash
|
|
115
|
+
just test-unit
|
|
116
|
+
```
|
|
117
|
+
- Run tests with coverage:
|
|
118
|
+
```bash
|
|
119
|
+
just test-coverage
|
|
120
|
+
```
|
|
121
|
+
- Run test for clean architecture dependency rules:
|
|
122
|
+
```bash
|
|
123
|
+
just test-clean
|
|
124
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/create_modern_fastapi/__main__.py
|
|
4
|
+
src/create_modern_fastapi.egg-info/PKG-INFO
|
|
5
|
+
src/create_modern_fastapi.egg-info/SOURCES.txt
|
|
6
|
+
src/create_modern_fastapi.egg-info/dependency_links.txt
|
|
7
|
+
src/create_modern_fastapi.egg-info/entry_points.txt
|
|
8
|
+
src/create_modern_fastapi.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
create_modern_fastapi
|