You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
-
# Full featured FastAPI template, all boring and tedious things are covered
1
+
## Small FastAPI template, all boring and tedious things covered
2
+
3
+

2
4
3
5
- SQLAlchemy using new 2.0 API + async queries
4
6
- Postgresql database under `asyncpg`
@@ -10,10 +12,18 @@
10
12
-`pre-push.sh` script with poetry export, autoflake, black, isort and flake8
11
13
- Setup for tests, one big test for token flow and very extensible `conftest.py`
12
14
13
-
# Quickstart
15
+
## What this repo is
16
+
17
+
This is a minimal template for FastAPI backend + postgresql db as of 2021, `async` style for database sessions, endpoints and tests. It provides basic codebase that almost every application has, but nothing more.
18
+
19
+
## What this repo is not
20
+
21
+
It is not complex, full featured solutions for all human kind problems. It doesn't include any third party that isn't necessary for most of apps (dashboards, queues) or implementation differs so much in every project that it's pointless (complex user model, emails).
22
+
23
+
## Quickstart
14
24
15
25
```bash
16
-
# You can install it globally
26
+
# You can even install it globally
17
27
pip install cookiecutter
18
28
19
29
# And cookiecutter this project :)
@@ -38,8 +48,12 @@ pytest
38
48
# in official template
39
49
```
40
50
41
-
# About
51
+
##About
42
52
43
53
This project is heavily base on official template https://github.com/tiangolo/full-stack-fastapi-postgresql (and on my previous work: [link1](https://github.com/rafsaf/fastapi-plan), [link2](https://github.com/rafsaf/docker-fastapi-projects)), but as it is now not too much up-to-date, it is much easier to create new one than change official. I didn't like some of conventions over there also (`crud` and `db` folders for example).
44
54
45
-
`2.0` style SQLAlchemy API is good enough so there is no need to write everything in `crud` and waste our time... The `core` folder was also rewritten. There is great base for writting tests in `tests`, but I didn't want to write hundreds of them, I noticed that usually after changes in the structure of the project, auto tests are useless and you have to write them from scratch, hence less than more. Similarly with the `User` model, it is very modest, because it will be adapted to the project anyway (and there are no tests for these endpoints)
55
+
`2.0` style SQLAlchemy API is good enough so there is no need to write everything in `crud` and waste our time... The `core` folder was also rewritten. There is great base for writting tests in `tests`, but I didn't want to write hundreds of them, I noticed that usually after changes in the structure of the project, auto tests are useless and you have to write them from scratch anyway (delete old ones...), hence less than more. Similarly with the `User` model, it is very modest, because it will be adapted to the project anyway (and there are no tests for these endpoints, you would remove them probably).
56
+
57
+
## Learn by example
58
+
59
+
Let's imagine we need to create API for a website where users brag about their dogs... or whatever, they just can crud dogs in user panel for some reason. We will add dummy model Dog to our API, with relation to the default table User and crud auth endpoints, then test it shortly.
0 commit comments