Skip to content

KSIUJ/fastapi-simple-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastApi Template

This is a template for FastAPI applications, providing a basic structure and examples for building APIs with FastAPI.

Important notes

Some important notes related to specific functionalities are in few directories:

  • app/README.md: This file contains examples and patterns for implementing routers, repositories, and models. You can follow them but it is not mandatory.
  • db/000-info.sql: This file contains informations about working with postgres database and how to initalize it in some way.
  • scripts/connect-db.sh: This script is used to connect to the database. It can be useful for debugging or manual database operations. It uses psql.

Features

This template has these set up for you:

  • static files serving
  • CORS middleware
  • Database in container
  • Database connection
  • Dockerfile
  • Docker Compose
  • jinja2 templates
  • some health check example route

Development

To run the application you can use docker-compose:

docker compose up --build -d

It will run the database and the FastAPI application. You can access the application at http://localhost:8080. When you make any changes the application will automatically reload.

IMPORTANT: If you change the requirements.txt file, you need to rebuild the Docker image:

docker compose up --build -d

or if you want to be more specific:

docker compose up --build -d fastapi-template-app

No docker :c

If you don't want to use Docker, you can run the application locally. You can search in FastAPI documentation how to do it, or look at the 'app/Dockerfile' it is a some kind of recipe for running the application locally.

About

Simple and easy to use fast api setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published