Skip to content

Commit 4f58b2b

Browse files
authored
initial commit (#1)
* initial commit * update
1 parent 7d92f45 commit 4f58b2b

File tree

19 files changed

+5795
-0
lines changed

19 files changed

+5795
-0
lines changed

.github/workflows/docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
docs:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
version: 8
22+
run_install: true
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
cache: pnpm
29+
30+
- name: Build VuePress site
31+
run: pnpm build
32+
33+
- name: Deploy to GitHub Pages
34+
uses: crazy-max/ghaction-github-pages@v4
35+
with:
36+
target_branch: gh-pages
37+
build_dir: docs/.vuepress/dist
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea/
2+
node_modules/
3+
.temp/
4+
.cache/

docs/.vuepress/client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineClientConfig } from 'vuepress/client'
2+
import RepoCard from 'vuepress-theme-plume/features/RepoCard.vue'
3+
4+
export default defineClientConfig({
5+
enhance({ app }) {
6+
app.component('RepoCard', RepoCard)
7+
},
8+
})

docs/.vuepress/config.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import {defineUserConfig} from 'vuepress'
2+
import {viteBundler} from '@vuepress/bundler-vite'
3+
import {plumeTheme} from 'vuepress-theme-plume'
4+
import {myNavbar} from "./navbar";
5+
import {mySidebar} from "./sidebar";
6+
7+
export default defineUserConfig({
8+
lang: 'zh-CN',
9+
title: 'FastAPI Best Architecture',
10+
head: [
11+
['link', {rel: 'icon', href: 'https://fastapi.tiangolo.com/img/favicon.png'}]
12+
],
13+
theme: plumeTheme({
14+
blog: false,
15+
notes: false,
16+
autoFrontmatter: {
17+
permalink: false,
18+
title: false,
19+
},
20+
sidebar: mySidebar,
21+
navbar: myNavbar,
22+
logo: 'https://fastapi.tiangolo.com/img/favicon.png',
23+
docsRepo: 'https://github.com/fastapi-practices/fastapi_best_architecture_docs',
24+
docsBranch: 'master',
25+
docsDir: 'docs',
26+
social: [
27+
{ icon: 'github', link: 'https://github.com/fastapi-practices/fastapi_best_architecture' }
28+
],
29+
navbarSocialInclude: ['github'],
30+
editLinkText: '在 GitHub 上编辑此页面',
31+
footer: {
32+
message: 'MIT License',
33+
copyright: 'Copyright © 2024-present FastAPI Practices'
34+
},
35+
plugins: {
36+
watermark: true,
37+
markdownPower: {
38+
icons: true,
39+
},
40+
}
41+
}),
42+
bundler: viteBundler(),
43+
})

docs/.vuepress/navbar.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {defineNavbarConfig} from "vuepress-theme-plume";
2+
3+
export const myNavbar = defineNavbarConfig([
4+
{
5+
text: '演示',
6+
items: [
7+
{
8+
text: 'Arco Design Pro 版本',
9+
link: 'https://fba.xwboy.top/'
10+
}
11+
]
12+
},
13+
{
14+
text: 'Beta',
15+
items: [
16+
{
17+
text: '贡献',
18+
link: 'https://github.com/fastapi-practices/fastapi_best_architecture/tree/master/backend#readme'
19+
}
20+
]
21+
},
22+
{
23+
text: '技术支持',
24+
icon: 'fluent-emoji-high-contrast:unicorn',
25+
link: 'https://github.com/fastapi-practices/fastapi_best_architecture/issues'
26+
},
27+
{
28+
text: '赞助',
29+
icon: 'ci:coffee',
30+
link: 'https://wu-clan.github.io/sponsor/'
31+
},
32+
{
33+
text: '互动',
34+
icon: 'mage:we-chat',
35+
link: 'https://wu-clan.github.io/homepage/'
36+
},
37+
{
38+
text: '友情链接',
39+
icon: 'fa-solid:user-friends',
40+
link: '/friends'
41+
}
42+
])
Loading

docs/.vuepress/sidebar.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {SidebarMulti} from "vuepress-theme-plume/lib/shared";
2+
3+
4+
export const mySidebar: SidebarMulti = {
5+
'/guide/': [
6+
{
7+
text: '简介',
8+
collapsed: false,
9+
prefix: '/guide/summary/',
10+
items: [
11+
{text: '为什么选择我们?', link: 'why'},
12+
{text: '快速开始', link: 'quick-start'},
13+
{text: '精简版', link: 'fsm'},
14+
]
15+
},
16+
{
17+
text: '参考',
18+
collapsed: false,
19+
prefix: '/guide/reference/',
20+
items: [
21+
{text: '登录', link: 'login'},
22+
{text: '权限', link: 'permission'},
23+
]
24+
},
25+
{
26+
text: '部署',
27+
collapsed: false,
28+
prefix: '/guide/deploy/',
29+
items: [
30+
{text: 'Docker', link: 'Docker'},
31+
{text: '传统', link: 'legacy'}
32+
]
33+
}
34+
],
35+
}

docs/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
home: true
3+
watermark: false
4+
config:
5+
-
6+
type: 'hero'
7+
full: true
8+
background: tint-plate
9+
hero:
10+
name: FastAPI Best Architecture
11+
tagline: 企业级中后台解决方案
12+
text: 基于 FastAPI 框架,前后端分离,遵循「伪三层架构」设计,支持 Python 3.10+ 版本
13+
actions:
14+
-
15+
theme: brand
16+
text: 快速开始 ->
17+
link: /guide/
18+
-
19+
theme: alt
20+
text: 在线预览
21+
link: https://fba.xwboy.top
22+
-
23+
type: features
24+
features:
25+
-
26+
title: 最新技术栈
27+
icon: 🚀
28+
details: 基于 FastAPI、SQLAlchemy 2.0、Pydantic-v2、Celery、等最新技术栈
29+
-
30+
title: 自研架构
31+
icon: 🧠
32+
details: 独特的「伪三层架构」,让所有开发者轻松驾驭
33+
-
34+
title: 全局异步
35+
icon: 🔄
36+
details: 基于 async/await + asgiref 实现全局异步处理,告别协程阻塞问题
37+
-
38+
title: 代码生成
39+
icon: ⚙️
40+
details: 提供后端代码自动生成,告别繁琐基础代码结构 cv
41+
-
42+
title: 权限管理
43+
icon: 🛠️
44+
details: 提供 Casbin、Role-Menu 两种 RBAC 权限方案。开关控制选择
45+
-
46+
title: JWT
47+
icon: 🔏
48+
details: 带有缓存和白名单的 JWT 中间件自动认证
49+
-
50+
title: Docker
51+
icon: 🐳
52+
details: 提供 Docker compose 一键部署方案
53+
-
54+
title: 时区时间
55+
icon:
56+
details: 通过配置一键应用全局时区时间,告别时间处理烦恼
57+
-
58+
title: 日志
59+
icon: 📝
60+
details: 内置十分强大的日志系统,全方位 Trace ID 助你一步锁定问题
61+
---

docs/friends.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
createTime: 2024/09/16 21:50:25
3+
pageLayout: friends
4+
title: 友情链接
5+
description: 如果您的网站与 FastAPI Best Architecture 相关,或者也属于开源项目(无知识星球付费内容,无授权相关内容),欢迎与我们联系
6+
groups:
7+
-
8+
title: FastAPI 相关
9+
list:
10+
-
11+
name: kinit-fast-task
12+
link: https://gitee.com/ktianc/kinit-fast-task
13+
avatar: https://k-typora.oss-cn-beijing.aliyuncs.com/kinit/logo.png
14+
desc: Kinit Fast Task 为 FastAPI 项目脚手架,高性能,高效率,易扩展,长期维护,积极更新!
15+
-
16+
title: 其他
17+
list:
18+
---

docs/guide/README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: FastAPI Best Architecture
3+
createTime: 2024/09/12 20:40:22
4+
---
5+
6+
> [!TIP]
7+
> 此仓库作为模板库公开,任何人或企业均可免费使用!
8+
9+
**🔥持续更新维护中🔥**
10+
11+
![Alt](https://repobeats.axiom.co/api/embed/b2174ef1abbebaea309091f1c998fc97d0c1536a.svg "Repo beats analytics image")
12+
13+
## 伪三层架构
14+
15+
mvc 架构作为常规设计模式,在 python web 中也很常见,但是三层架构更令人着迷
16+
17+
在 python web 开发中,三层架构的概念并没有通用标准,所以这里我们称之为伪三层架构
18+
19+
但请注意,我们并没有传统的多应用程序结构(django、springBoot...),如果您不喜欢这种模式,可以使用模板对其进行随意改造!
20+
21+
| 工作流程 | java | fastapi_best_architecture |
22+
|------|----------------|---------------------------|
23+
| 视图 | controller | api |
24+
| 数据传输 | dto | schema |
25+
| 业务逻辑 | service + impl | service |
26+
| 数据访问 | dao / mapper | crud |
27+
| 模型 | model / entity | model |
28+
29+
## 特征
30+
31+
- [x] 全局 FastAPI PEP 593 Annotated 参数风格
32+
- [x] async/await + asgiref 的全局异步设计
33+
- [x] 遵循 Restful API 规范
34+
- [x] 全局 SQLAlchemy 2.0 语法
35+
- [x] Pydantic v1 和 v2 (不同分支)
36+
- [x] Casbin RBAC 访问控制模型
37+
- [x] 角色菜单 RBAC 访问控制模型
38+
- [x] Celery 异步任务
39+
- [x] JWT 中间件白名单认证
40+
- [x] 全局自定义时区时间
41+
- [x] Docker / Docker-compose 部署
42+
- [x] Pytest 单元测试
43+
44+
## 内置功能
45+
46+
- [x] 用户管理:系统用户角色管理,权限分配
47+
- [x] 部门管理:配置系统组织机构(公司、部门、小组...)
48+
- [x] 菜单管理:配置系统菜单,用户菜单,按钮权限标识
49+
- [x] 角色管理:角色菜单权限分配,角色路由权限分配
50+
- [x] 字典管理:维护系统内部常用固定数据或参数
51+
- [x] 代码生成:后端代码自动生成,支持预览,写入及下载
52+
- [x] 操作日志:系统正常和异常操作的日志记录与查询
53+
- [x] 登录认证:图形验证码后台认证登录
54+
- [x] 登录日志:用户正常和异常登录的日志记录与查询
55+
- [x] 服务监控:服务器硬件设备信息与状态
56+
- [x] 定时任务:自动化任务,异步任务,支持函数调用
57+
- [x] 接口文档:自动生成在线交互式 API 接口文档
58+
59+
## 项目结构
60+
61+
::: file-tree
62+
- backend/ 后端
63+
- alembic/ 数据库迁移
64+
- app/ 应用
65+
- admin 系统后台
66+
- api/ 接口
67+
- crud/ CRUD
68+
- model/ 模型
69+
- schema/ 数据传输
70+
- service/ 服务
71+
- tests/ 测试
72+
- generator/ 代码生成
73+
- task/ 任务
74+
- common/ 公共资源
75+
- core/ 核心配置
76+
- database/ 数据库连接
77+
- log/ 日志
78+
- middleware/ 中间件
79+
- scripts/ 脚本
80+
- sql/ SQL文件
81+
- static/ 静态文件
82+
- templates/ 模版文件
83+
- utils/ 工具包
84+
- deploy/ 服务器部署
85+
- ...
86+
:::
87+
88+
## 贡献者
89+
90+
<a href="https://github.com/fastapi-practices/fastapi_best_architecture/graphs/contributors">
91+
<img src="https://contrib.rocks/image?repo=fastapi-practices/fastapi_best_architecture"/>
92+
</a>
93+
94+
## 许可证
95+
96+
本项目由 [MIT](https://github.com/fastapi-practices/fastapi_best_architecture/blob/master/LICENSE) 许可证的条款进行许可
97+
98+
[![Stargazers over time](https://starchart.cc/fastapi-practices/fastapi_best_architecture.svg?variant=adaptive)](https://starchart.cc/fastapi-practices/fastapi_best_architecture)
99+
100+
## 相关
101+
102+
<RepoCard repo="fastapi-practices/sqlalchemy-crud-plus" />
103+
104+
::: tip 特别鸣谢
105+
本文档由 [vuepress-theme-plume](https://github.com/pengzhanbo/vuepress-theme-plume)
106+
驱动,感谢 [pengzhanbo](https://github.com/pengzhanbo) 对此开源项目的杰出贡献
107+
:::

0 commit comments

Comments
 (0)