Skip to content

Commit a32e5da

Browse files
Merge pull request #30 from Promptly-Technologies-LLC/16-extend-documentation
16 extend documentation
2 parents e76f5b9 + 4bd7688 commit a32e5da

18 files changed

+456
-275
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
.devcontainer
22
__pycache__
33
*.pyc
4-
.env
4+
.env
5+
/.quarto/
6+
_docs/
7+
.pytest_cache/
8+
.mypy_cache/

.nojekyll

Whitespace-only changes.

README.md

Lines changed: 41 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,55 @@
1-
# README
1+
# FastAPI, Jinja2, PostgreSQL Webapp Template
22

3+
![Screenshot of homepage](docs/static/Screenshot.png)
34

4-
## FastAPI, Jinja2, PostgreSQL Webapp
5+
## Documentation
56

6-
![Screenshot of homepage](static/Screenshot.png)
7+
This README provides a high-level overview. See the **[full documentation website](https://promptlytechnologies.com/fastapi-jinja2-postgres-webapp/docs/)** for more detailed information on installation, features, architecture, conventions and code style, customization, and deployment to cloud platforms.
78

8-
This project is still under development.
9+
## Features
910

10-
### Architecture
11+
*FastAPI, Jinja2, PostgreSQL Webapp Template* combines three of the most lightweight and performant open-source web development frameworks in existence into a customizable webapp template with:
1112

12-
This application uses a Post-Redirect-Get (PRG) pattern. The user
13-
submits a form, which sends a POST request to a FastAPI endpoint on the
14-
server. The database is updated, and the user is redirected to a GET
15-
endpoint, which fetches the updated data and re-renders the Jinja2 page
16-
template with the new data.
13+
- Pure Python backend
14+
- Low-Javascript frontend
15+
- Powerful, easy-to-manage database layer
1716

18-
![Webapp Flow](static/webapp_flow.png)
17+
The template also includes full-featured secure auth with:
1918

20-
The advantage of the PRG pattern is that it is very straightforward to
21-
implement and keeps most of the rendering logic on the server side. The
22-
disadvantage is that it requires an extra round trip to the database to
23-
fetch the updated data, and re-rendering the entire page template may be
24-
less efficient than a partial page update on the client side.
19+
- Token-based authentication
20+
- Password recovery flow
21+
- Role-based access control system
2522

26-
### Install development dependencies in a VSCode Dev Container
23+
The design philosophy of the template is to prefer low-level, best-in-class open-source frameworks that offer flexibility, scalability, and performance without vendor-lock-in. You'll find the template amazingly easy not only to understand and customize, but also to deploy to any major cloud hosting platform.
2724

28-
If you use VSCode with Docker to develop in a container, the following
29-
VSCode Dev Container configuration will install all dependencies:
25+
## Tech stack
3026

31-
``` json
32-
{
33-
"name": "Python 3",
34-
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
35-
"postCreateCommand": "sudo apt update && sudo apt install -y python3-dev libpq-dev graphviz && pipx install poetry && poetry install && poetry shell",
36-
"features": {
37-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
38-
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {}
39-
}
40-
}
41-
```
27+
**Core frameworks:**
28+
- [FastAPI](https://fastapi.tiangolo.com/): scalable, high-performance, type-annotated Python web backend framework
29+
- [PostgreSQL](https://www.postgresql.org/): the world's most advanced open-source database engine
30+
- [Jinja2](https://jinja.palletsprojects.com/en/3.1.x/): frontend HTML templating engine
31+
- [SQLModel](https://sqlmodel.tiangolo.com/): easy-to-use Python ORM
32+
33+
**Additional technologies:**
34+
- [Poetry](https://python-poetry.org/): Python dependency manager
35+
- [Pytest](https://docs.pytest.org/en/7.4.x/): testing framework
36+
- [Docker](https://www.docker.com/): development containerization
37+
- [Github Actions](https://docs.github.com/en/actions): CI/CD pipeline
38+
- [Quarto](https://quarto.org/docs/): simple documentation website renderer
39+
- [MyPy](https://mypy.readthedocs.io/en/stable/): static type checker for Python
40+
- [Bootstrap](https://getbootstrap.com/): HTML/CSS styler
41+
- [Resend](https://resend.com/): zero- or low-cost email service used for password recovery
4242

43-
Simply create a `.devcontainer` folder in the root of the project and
44-
add a `devcontainer.json` file in the folder with the above content.
45-
VSCode may prompt you to install the Dev Container extension if you
46-
haven’t already, and/or to open the project in a container. If not, you
47-
can manually select “Dev Containers: Reopen in Container” from View \>
48-
Command Palette.
43+
## Quickstart
4944

50-
### Install development dependencies manually
45+
For comprehensive installation instructions, see the [documentation website](https://promptlytechnologies.com/fastapi-jinja2-postgres-webapp/docs/).
5146

52-
#### Python and Docker
47+
### Python and Docker
5348

5449
- [Python 3.12 or higher](https://www.python.org/downloads/)
5550
- [Docker and Docker Compose](https://docs.docker.com/get-docker/)
5651

57-
#### PostgreSQL headers
52+
### PostgreSQL headers
5853

5954
For Ubuntu/Debian:
6055

@@ -72,28 +67,7 @@ For Windows:
7267

7368
- No installation required
7469

75-
#### Quarto CLI and Graphviz
76-
77-
- [Quarto CLI](https://quarto.org/docs/get-started/)
78-
79-
For macOS:
80-
81-
``` bash
82-
brew install graphviz
83-
```
84-
85-
For Ubuntu/Debian:
86-
87-
``` bash
88-
sudo apt update && sudo apt install -y graphviz
89-
```
90-
91-
For Windows:
92-
93-
- Download and install from
94-
[Graphviz.org](https://graphviz.org/download/#windows)
95-
96-
#### Python dependencies
70+
### Python dependencies
9771

9872
1. Install Poetry
9973

@@ -113,22 +87,17 @@ poetry install
11387
poetry shell
11488
```
11589

116-
(Note: You will need to activate the shell every time you open a new
117-
terminal session. Alternatively, you can use the `poetry run` prefix
118-
before other commands to run them without activating the shell.)
90+
(Note: You will need to activate the shell every time you open a new terminal session. Alternatively, you can use the `poetry run` prefix before other commands to run them without activating the shell.)
11991

12092
### Set environment variables
12193

12294
Copy .env.example to .env with `cp .env.example .env`.
12395

124-
Generate a 256 bit secret key with `openssl rand -base64 32` and paste
125-
it into the .env file.
96+
Generate a 256 bit secret key with `openssl rand -base64 32` and paste it into the .env file.
12697

12798
Set your desired database name, username, and password in the .env file.
12899

129-
To use password recovery, register a [Resend](https://resend.com/)
130-
account, verify a domain, get an API key, and paste the API key into the
131-
.env file.
100+
To use password recovery, register a [Resend](https://resend.com/) account, verify a domain, get an API key, and paste the API key into the .env file.
132101

133102
### Start development database
134103

@@ -138,8 +107,7 @@ docker compose up -d
138107

139108
### Run the development server
140109

141-
Make sure the development database is running and tables and default
142-
permissions/roles are created first.
110+
Make sure the development database is running and tables and default permissions/roles are created first.
143111

144112
``` bash
145113
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
@@ -153,22 +121,10 @@ Navigate to http://localhost:8000/
153121
mypy .
154122
```
155123

156-
### Render the README
157-
158-
When updating the documentation, remember to make changes in the
159-
README.qmd file, not the README.md file. Then run the following command
160-
to render the README.md file:
161-
162-
``` bash
163-
quarto render README.qmd
164-
```
165-
166124
### Contributing
167125

168-
Fork the repository, create a new branch, make your changes, and submit
169-
a pull request.
126+
Your contributions are welcome! See the [issues page](https://github.com/promptly-technologies-llc/fastapi-jinja2-postgres-webapp/issues) for ideas. Fork the repository, create a new branch, make your changes, and submit a pull request.
170127

171128
### License
172129

173-
This project is licensed under the MIT License. See the LICENSE file for
174-
more details.
130+
This project is licensed under the MIT License. See the LICENSE file for more details.

README.qmd

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

0 commit comments

Comments
 (0)