Skip to content

Commit 4619d13

Browse files
committed
[TEMPLATE] add fastapi-dockerized, fastapi-custom-response, fastapi-async-crud template, modified fastapi-default template
1 parent b5ca5dd commit 4619d13

File tree

111 files changed

+2084
-1190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2084
-1190
lines changed

src/fastapi_fastkit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.1.2"
1+
__version__ = "0.1.3"
22

33
import os
44

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SECRET_KEY=changethis

src/fastapi_fastkit/fastapi_project_template/fastapi-async-crud/.env.test-tpl

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 28 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,30 @@
1-
### venv template
2-
# Virtualenv
3-
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
4-
.Python
5-
[Bb]in
6-
[Ii]nclude
7-
[Ll]ib
8-
[Ll]ib64
9-
[Ll]ocal
10-
[Ss]cripts
11-
pyvenv.cfg
12-
.venv
13-
pip-selfcheck.json
14-
15-
### dotenv template
16-
.env
17-
18-
### VirtualEnv template
19-
# Virtualenv
20-
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
21-
.Python
22-
[Bb]in
23-
[Ii]nclude
24-
[Ll]ib
25-
[Ll]ib64
26-
[Ll]ocal
27-
pyvenv.cfg
28-
.venv
29-
pip-selfcheck.json
30-
31-
### Python template
32-
# Byte-compiled / optimized / DLL files
33-
__pycache__/
34-
*.py[cod]
35-
*$py.class
36-
37-
# C extensions
38-
*.so
39-
40-
# Distribution / packaging
41-
.Python
42-
build/
43-
develop-eggs/
44-
dist/
45-
downloads/
46-
eggs/
47-
.eggs/
48-
lib/
49-
lib64/
50-
parts/
51-
sdist/
52-
var/
53-
wheels/
54-
share/python-wheels/
55-
*.egg-info/
56-
.installed.cfg
57-
*.egg
58-
MANIFEST
59-
60-
# PyInstaller
61-
# Usually these files are written by a python script from a template
62-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
63-
*.manifest
64-
*.spec
65-
66-
# Installer logs
67-
pip-log.txt
68-
pip-delete-this-directory.txt
69-
70-
# Unit test / coverage reports
71-
htmlcov/
72-
.tox/
73-
.nox/
74-
.coverage
75-
.coverage.*
76-
.cache
77-
nosetests.xml
78-
coverage.xml
79-
*.cover
80-
*.py,cover
81-
.hypothesis/
82-
.pytest_cache/
83-
cover/
84-
85-
# Translations
86-
*.mo
87-
*.pot
88-
89-
# Django stuff:
90-
*.log
91-
local_settings.py
92-
db.sqlite3
93-
db.sqlite3-journal
94-
95-
# Flask stuff:
96-
instance/
97-
.webassets-cache
98-
99-
# Scrapy stuff:
100-
.scrapy
101-
102-
# Sphinx documentation
103-
docs/_build/
104-
105-
# PyBuilder
106-
.pybuilder/
107-
target/
108-
109-
# Jupyter Notebook
1+
.idea
1102
.ipynb_checkpoints
3+
.mypy_cache
4+
.vscode
5+
__pycache__
6+
.pytest_cache
7+
htmlcov
8+
dist
9+
site
10+
.coverage*
11+
coverage.xml
12+
.netlify
13+
test.db
14+
log.txt
15+
Pipfile.lock
16+
env3.*
17+
env
18+
docs_build
19+
site_build
20+
venv
21+
docs.zip
22+
archive.zip
23+
24+
# vim temporary files
25+
*~
26+
.*.sw?
27+
.cache
11128

112-
# IPython
113-
profile_default/
114-
ipython_config.py
115-
116-
# pyenv
117-
# For a library or package, you might want to ignore these files since the code is
118-
# intended to run in multiple environments; otherwise, check them in:
119-
# .python-version
120-
121-
# pipenv
122-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
123-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
124-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
125-
# install all needed dependencies.
126-
#Pipfile.lock
127-
128-
# poetry
129-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
130-
# This is especially recommended for binary packages to ensure reproducibility, and is more
131-
# commonly ignored for libraries.
132-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
133-
# poetry.lock
134-
135-
# pdm
136-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
137-
#pdm.lock
138-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
139-
# in version control.
140-
# https://pdm.fming.dev/#use-with-ide
141-
.pdm.toml
142-
143-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
144-
__pypackages__/
145-
146-
# Celery stuff
147-
celerybeat-schedule
148-
celerybeat.pid
149-
150-
# SageMath parsed files
151-
*.sage.py
152-
153-
# Environments
154-
.env
155-
.venv
156-
env/
157-
venv/
158-
ENV/
159-
env.bak/
160-
venv.bak/
161-
162-
# Spyder project settings
163-
.spyderproject
164-
.spyproject
165-
166-
# Rope project settings
167-
.ropeproject
168-
169-
# mkdocs documentation
170-
/site
171-
172-
# mypy
173-
.mypy_cache/
174-
.dmypy.json
175-
dmypy.json
176-
177-
# Pyre type checker
178-
.pyre/
179-
180-
# pytype static type analyzer
181-
.pytype/
182-
183-
# Cython debug symbols
184-
cython_debug/
185-
186-
# PyCharm
187-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189-
# and can be added to the global gitignore or merged into this file. For a more nuclear
190-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
191-
.idea/
29+
# macOS
30+
.DS_Store
Lines changed: 102 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,107 @@
1-
# Simple FastAPI Project
1+
# Async Item Management API Server
22

3-
This is a test project using FastAPI. It is a RESTful API server with user management functionality.
3+
A FastAPI-based item management API implemented with asynchronous processing.
44

5-
## Features
5+
## Tech Stack
66

7-
- User Creation, Read, Update, Delete (CRUD) functionality
8-
- Automatic OpenAPI documentation generation (Swagger UI, ReDoc)
9-
- Custom exception handling
10-
- Test environment with mock data
7+
- Python 3.12+
8+
- FastAPI + uvicorn
9+
- Pydantic 2 & pydantic-settings
10+
- pytest, pytest-asyncio
11+
- mypy + black + isort
12+
- aiofiles (async file handling)
1113

12-
## Stack
14+
## Project Structure
1315

14-
- Python 3.11+
15-
- FastAPI 0.111.1
16-
- Pydantic 2.8.2
17-
- pytest 8.2.2
16+
```
17+
.
18+
├── README.md
19+
├── requirements.txt
20+
├── setup.py
21+
├── scripts
22+
│   └── run-server.sh
23+
├── src
24+
│   ├── main.py
25+
│   ├── schemas
26+
│   │   └── items.py
27+
│   ├── mocks
28+
│   │   └── mock_items.json
29+
│   ├── crud
30+
│   │   └── items.py
31+
│   ├── core
32+
│   │   └── config.py
33+
│   └── api
34+
│   ├── api.py
35+
│   └── routes
36+
│   └── items.py
37+
└── tests
38+
├── __init__.py
39+
├── test_items.py
40+
└── conftest.py
41+
```
42+
43+
## How to Run
44+
45+
Run in virtual environment:
46+
47+
```bash
48+
# Install dependencies
49+
$ pip install -r requirements.txt
50+
51+
# Start development server (using script)
52+
$ bash scripts/run-server.sh
53+
54+
# Manual run
55+
$ uvicorn src.main:app --reload
56+
```
57+
58+
Access API documentation after server starts:
59+
60+
```bash
61+
<domain:port>/docs # Swagger format
62+
<domain:port>/redoc # ReDoc format
63+
64+
# example
65+
http://127.0.0.1:8000/docs
66+
```
67+
68+
## API Endpoints
69+
70+
| Method | Endpoint | Description |
71+
|--------|------------------|----------------------------|
72+
| GET | `/items/` | List all items |
73+
| GET | `/items/{id}` | Get single item |
74+
| POST | `/items/` | Create new item |
75+
| PUT | `/items/{id}` | Update existing item |
76+
| DELETE | `/items/{id}` | Delete item |
77+
78+
## Key Features
79+
80+
- Async file I/O operations using aiofiles
81+
- Mock data initialization
82+
- Pydantic model validation
83+
- CRUD operations implementation
84+
- Integrated test cases
85+
- In-memory JSON database for development
86+
87+
## Running Tests
88+
89+
```bash
90+
# Run all tests
91+
$ pytest tests/
92+
93+
# Run specific test file
94+
$ pytest tests/test_items.py -v
95+
```
96+
97+
For FastAPI documentation: <https://fastapi.tiangolo.com/>
98+
99+
## Project Origin
100+
101+
This project was created using the [FastAPI-fastkit](https://github.com/bnbong/FastAPI-fastkit) template.
102+
103+
FastAPI-fastkit is an open-source project that helps developers quickly set up FastAPI-based applications with proper structure and tooling.
104+
105+
### Template Information
106+
- Template author: [bnbong](mailto:[email protected])
107+
- Project maintainer: [bnbong](mailto:[email protected])

src/fastapi_fastkit/fastapi_project_template/fastapi-async-crud/main.py-tpl

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)