Skip to content

Commit 10f5fa6

Browse files
authored
Update the README document (#214)
1 parent 5794cec commit 10f5fa6

File tree

2 files changed

+184
-75
lines changed

2 files changed

+184
-75
lines changed

README.md

Lines changed: 96 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
# FastAPI Best Architecture
22

3+
[![GitHub](https://img.shields.io/github/license/fastapi-practices/fastapi_best_architecture)](https://github.com/fastapi-practices/fastapi_best_architecture/blob/master/LICENSE)
4+
[![Static Badge](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/)
5+
36
English | [简体中文](./README.zh-CN.md)
47

5-
This is a base project for the FastAPI framework, using a pseudo three-tier architecture, **still in production**.
8+
FastAPI framework based on the front-end and back-end separation of the middle and back-end solutions, follow
9+
the [pseudo three-tier architecture](#pseudo-three-tier-architecture) design, support for **python3.10** and above
10+
versions
611

7-
It is intended to allow you to use it directly as your infrastructure to develop your project, this repository as a
8-
template library public, can be used directly
12+
Its purpose is to allow you to use it directly as the infrastructure of your new project, this repository as a template
13+
library open to any person or enterprise can be used for free!
914

10-
Support **python3.10** and above
15+
**Continuously updated and maintained**
1116

1217
## Pseudo three-tier architecture
1318

14-
In python web frameworks, the mvc architecture is the most common, but for restful users, the three-tier architecture is
15-
the way to go
19+
The mvc architecture is a common design pattern in python web, but the three-tier architecture is even more fascinating.
1620

17-
But in python development, there is no universal standard for the concept of a three-tier architecture, so here I call
18-
it a pseudo three-tier architecture
21+
In python web development, there is no common standard for the concept of three-tier architecture, so we'll call it a
22+
pseudo three-tier architecture here
1923

2024
| workflow | java | fastapi_best_architecture |
2125
|----------------|----------------|---------------------------|
@@ -25,23 +29,60 @@ it a pseudo three-tier architecture
2529
| data access | dao / mapper | crud |
2630
| model | model / entity | model |
2731

32+
## Online preview
33+
34+
Unfortunately, we don't have the funds to provide an online preview, you can deploy by checking
35+
out [local-development](#local-development), or directly using [Docker](#docker-deploy)
36+
to deploy, or at [fastapi_best_architecture_ui](https://github.com/fastapi-practices/fastapi_best_architecture_ui)
37+
See a preview of some of the screenshots
38+
2839
## Features
2940

30-
- [x] FastAPI new features
31-
- [x] Asynchronous design
32-
- [x] Restful API specification
33-
- [x] SQLAlchemy 2.0 syntax
34-
- [x] Pydantic data validation
35-
- [x] Casbin RBAC permission control
36-
- [x] APScheduler timed tasks
37-
- [x] JWT authentication
38-
- [x] Redis caching
39-
- [x] Docker deployment
40-
- [x] Pytest testing
41+
- [x] Design with FastAPI PEP 593 Annotated Parameters
42+
- [x] Global asynchronous design with async/await + asgiref
43+
- [x] Follows Restful API specification
44+
- [x] Global SQLAlchemy 2.0 syntax
45+
- [x] Casbin RBAC access control model
46+
- [x] APScheduler online timed tasks
47+
- [x] JWT middleware whitelist authentication
48+
- [x] Global customizable time zone time
49+
- [x] Docker / Docker-compose deployment
50+
- [x] Pytest Unit Testing
51+
52+
TODO:
53+
54+
1. [ ] Pydantic 2.0
55+
56+
## Built-in features
57+
58+
1. [x] User management: system user role management, permission assignment
59+
2. [x] Department Management: Configure the system organization (company, department, group...)
60+
3. [x] Menu Management: Configuration of system menus, user menus, button privilege identification
61+
4. [x] Role Management: Assign role menu privileges, assign role routing privileges
62+
5. [x] Dictionary Management: Maintain common fixed data or parameters within the system.
63+
6. [x] Operation Logs: logging and querying of normal and abnormal system operations.
64+
7. [x] Login Authentication: graphical authentication code background authentication login
65+
8. [x] Login Logs: Logging and querying of normal and abnormal user logins
66+
9. [x] Service Monitoring: server hardware device information and status
67+
10. [x] Timed Tasks: online task control (modify, delete, pause...)
68+
11. [x] Interface Documentation: Automatically generate online interactive API interface documentation.
69+
70+
TODO:
4171

42-
## Getting started:
72+
1. [ ] Dynamic Configuration: Dynamic configuration of the system environment (site title, logo, filing, footer...)
73+
2. [ ] code generation: according to the table structure, visualize the generation of additions, deletions,
74+
modifications and checks of the business code.
75+
3. [ ] File Upload: Docking cloud OSS and local backup.
76+
4. [ ] System Notification: proactively send timed task notifications, resource warnings, service anomaly warnings...
4377

44-
### 1: Legacy mode
78+
## Local development
79+
80+
* Python: 3.10+
81+
* Mysql: 8.0+
82+
* Redis: The latest stable version is recommended
83+
* Nodejs: 14.0+
84+
85+
### BackEnd
4586

4687
1. Install dependencies
4788
```shell
@@ -74,13 +115,17 @@ it a pseudo three-tier architecture
74115
# Execute the migration
75116
alembic upgrade head
76117
```
77-
78-
7. Execute the `backend/app/main.py` file to start the service
79-
8. Browser access: http://127.0.0.1:8000/api/v1/docs
118+
7. Modify the configuration file as needed
119+
8. Execute the `backend/app/main.py` file to start the service
120+
9. Browser access: http://127.0.0.1:8000/api/v1/docs
80121

81122
---
82123

83-
### 2: Docker
124+
### Front
125+
126+
Click [fastapi_best_architecture_ui](https://github.com/fastapi-practices/fastapi_best_architecture_ui) for details
127+
128+
### Docker deploy
84129

85130
1. Go to the directory where the ``docker-compose.yml`` file is located and create the environment variable
86131
file ``.env``
@@ -94,32 +139,39 @@ it a pseudo three-tier architecture
94139
cp .env.docker .env
95140
```
96141

97-
2. Execute the one-click boot command
142+
2. Modify the configuration file as needed
143+
3. Execute the one-click boot command
98144

99145
```shell
100146
docker-compose up -d -build
101147
```
102148

103-
3. Wait for the command to complete automatically
104-
4. Visit the browser: http://127.0.0.1:8000/api/v1/docs
149+
4. Wait for the command to complete automatically
150+
5. Visit the browser: http://127.0.0.1:8000/api/v1/docs
105151

106152
## Test data
107153

108154
Initialize the test data using the `backend/sql/init_test_data.sql` file
109155

110-
## Development
156+
## Development process
157+
158+
For reference only
111159

112-
Development process, for reference only
160+
### BackEnd
113161

114162
1. Define the database model (model) and remember to perform database migration for each change
115163
2. Define the data validation model (schema)
116164
3. Define routes (router) and views (api)
117165
4. Define the business logic (service)
118166
5. Write database operations (crud)
119167

168+
### Front
169+
170+
Click [fastapi_best_architecture_ui](https://github.com/fastapi-practices/fastapi_best_architecture_ui) for details
171+
120172
## Test
121173

122-
Execute tests via pytest
174+
Execute unittests via pytest
123175

124176
1. Create the test database `fba_test`, select utf8mb4 encoding
125177
2. Enter the app directory
@@ -141,30 +193,35 @@ Execute tests via pytest
141193
<span style="margin: 0 5px;" ><a href="https://github.com/wu-clan" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/52145145?v=4&h=60&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
142194
<span style="margin: 0 5px;" ><a href="https://github.com/downdawn" ><img src="https://images.weserv.nl/?url=avatars.githubusercontent.com/u/41266749?v=4&h=60&w=60&fit=cover&mask=circle&maxage=7d" /></a></span>
143195

144-
## Thanks
196+
## Special thanks
145197

146198
- [FastAPI](https://fastapi.tiangolo.com/)
147199
- [Pydantic](https://docs.pydantic.dev/latest/)
148200
- [SQLAlchemy](https://docs.sqlalchemy.org/en/20/)
149201
- [Casbin](https://casbin.org/zh/)
150202
- [Ruff](https://beta.ruff.rs/docs/)
151-
- ......
203+
- [Black](https://black.readthedocs.io/en/stable/index.html)
204+
- [RuoYi](http://ruoyi.vip/)
205+
- ...
152206

153-
## Sponsor
207+
## Sponsor us
154208

155-
> If this program has helped you, you can sponsor the author with some coffee beans :coffee:
209+
> If this program has helped you, you can sponsor us with some coffee beans :coffee:
156210

157211
<table>
158212
<tr>
159-
<td><img src="https://github.com/wu-clan/image/blob/master/pay/weixin.jpg?raw=true" width="180px"/>
160-
<td><img src="https://github.com/wu-clan/image/blob/master/pay/zfb.jpg?raw=true" width="180px"/>
213+
<td><img src="https://github.com/wu-clan/image/blob/master/pay/weixin.jpg?raw=true" width="180px" alt="WeChat"/>
214+
<td><img src="https://github.com/wu-clan/image/blob/master/pay/zfb.jpg?raw=true" width="180px" alt="Alipay"/>
215+
<td><img src="https://github.com/wu-clan/image/blob/master/pay/ERC20.jpg?raw=true" width="180px" alt="0x40D5e2304b452256afD9CE2d3d5531dc8d293138"/>
161216
</tr>
162217
<tr>
163-
<td align="center">Wechat Pay</td>
218+
<td align="center">WeChat Pay</td>
164219
<td align="center">Ali Pay</td>
220+
<td align="center">ERC20</td>
165221
</tr>
166222
</table>
167223

168224
## License
169225

170-
This project is licensed under the terms of the MIT license
226+
This project is licensed under the terms of
227+
the [MIT](https://github.com/fastapi-practices/fastapi_best_architecture/blob/master/LICENSE) license

0 commit comments

Comments
 (0)