Promptly-Technologies-LLC / fastapi-jinja2-postgres-webapp

A template webapp with a pure-Python FastAPI backend, frontend templating with Jinja2, and a Postgres database to power user auth
https://promptlytechnologies.com/fastapi-jinja2-postgres-webapp/
MIT License
0 stars 0 forks source link

FastAPI, Jinja2, PostgreSQL Webapp Template

Screenshot of homepage

Quickstart

This quickstart guide provides a high-level overview. See the full documentation for comprehensive information on features, installation, architecture, conventions, code style, and customization, deployment to cloud platforms, and contributing.

Features

This template combines three of the most lightweight and performant open-source web development frameworks into a customizable webapp template with:

The template also includes full-featured secure auth with:

Design Philosophy

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.

Tech Stack

Core frameworks:

Additional technologies:

Installation

For comprehensive installation instructions, see the installation page.

Python and Docker

PostgreSQL headers

For Ubuntu/Debian:

sudo apt update && sudo apt install -y python3-dev libpq-dev

For macOS:

brew install postgresql

For Windows:

Python dependencies

  1. Install Poetry
pipx install poetry
  1. Install project dependencies
poetry install
  1. Activate shell
poetry shell

(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.)

Set environment variables

Copy .env.example to .env with cp .env.example .env.

Generate a 256 bit secret key with openssl rand -base64 32 and paste it into the .env file.

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

To use password recovery, register a Resend account, verify a domain, get an API key, and paste the API key into the .env file.

Start development database

docker compose up -d

Run the development server

Make sure the development database is running and tables and default permissions/roles are created first.

uvicorn main:app --host 0.0.0.0 --port 8000 --reload

Navigate to http://localhost:8000/

Lint types with mypy

mypy .

Contributing

Your contributions are welcome! See the issues page for ideas. Fork the repository, create a new branch, make your changes, and submit a pull request.

License

This project is created and maintained by Promptly Technologies, LLC and licensed under the MIT License. See the LICENSE file for more details.