Coder Social home page Coder Social logo

vichannnnn / fastapi-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 106 KB

FastAPI boilerplate with batteries to quickly get started on your backend project!

Makefile 2.30% Dockerfile 0.93% Python 95.34% Mako 1.06% Shell 0.36%
fastapi fastapi-boilerplate fastapi-sqlalchemy fastapi-template python3 boilerplate jwt jwt-authentication

fastapi-boilerplate's Introduction

FastAPI Boilerplate

codecov Python Docker CI

FastAPI Boilerplate is a backend boilerplate to help you get quickly started for projects of any scale without having to set up all the nitty-gritty details.

The boilerplate contains the following:

  • JWT Authentication with basic authentication endpoints included with session dependencies.
  • Pytest to run unit tests for your endpoints and business logic.
  • SQLAlchemy ORM for your CRUD operations with Pydantic validation models.
  • Alembic for your ORM migrations and database version control.
  • Makefile with all the necessary deployment and set-up commands built in to quickly help you set up without having to type them all in.
  • Docker and Docker Compose for ease of deployment and containerization.
  • Postgres for the backend database running in a container.
  • Celery Task Runner running in a container for your tasks and pings.
  • Mypy and Pylint for your code quality check and type checks.
  • Caddy for your reverse proxy to handle routing between containers and your DNS.

Set up and Deployment

  • Run your Python on the shell and type in this, copy the result and paste into the .env_example for your SECRET_KEY.
import secrets
secret_key = secrets.token_hex(32)
  • Run the following command
cp .env.example .env
# Copy the content from .env.example into .env and edit based on your own needs.

make runbackend
make migrations name="init"
make migrate

Usage

Go to http://localhost:8000/api/v1/docs to access the endpoints from the Swagger UI

You can also run make runserver to access the same application connected to the same database in port 9000, this is purely for debugging purpose.

You can run make check to run your code through mypy, pylint and pytest as a pre-hook commit for your own projects.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

fastapi-boilerplate's People

Contributors

vichannnnn avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.