Giter VIP home page Giter VIP logo

fastapi-alembic-sqlmodel-async's Introduction

Async configuration for FastAPI and SQLModel

This is a project template which uses FastAPI, Alembic and async SQLModel as ORM. It shows a complete async CRUD template using authentication.

Set environment variables

Create an .env file on root folder and copy the content from .env.example. Feel free to change it according to your own configuration.

Run project using Docker compose

docker-compose up --build

Run Alembic migrations

docker-compose exec fastapi_server alembic revision --autogenerate
docker-compose exec fastapi_server alembic upgrade head

Setup database with initial data

This creates a sample user on databasse with username: [email protected] and pass: admin

docker-compose exec fastapi_server python app/initial_data.py

You can connect to the Database using PGAdmin4 and use the credentials from .env file. Database port on local machine has been configured to 5454 on docker-compose.yml file

ERD Database model

As this project uses traefik, you can access to the documentation with the following path http://fastapi.localhost/docs

Preview

Traefik Dashboard

You can access to Traefik Dashboard using the following link http://traefik.localhost/. You should use username: test and pass: test. If you want to change the password, you can find more information of how to do it here

Static files

All files on static folder will be server by nginx container as static files. You can check it with this link http://localhost/static/1.png

Inspiration and References

TODO List:

  • Add Custom Response model
  • Create sample one to many relationship
  • Create sample many to many relationship
  • Add JWT authentication
  • Add Pagination
  • Add User birthday field with timezone
  • Add reverse proxy (traefik) with docker compose
  • Add static server with nginx
  • Add jsonb field on table sample
  • Add Role - Permissions setup and logic
  • Add one to one relationship sample
  • Add Celery sample for tasks

PR are welcome ❤️

License

License

  • This project is licensed under the terms of the MIT license

fastapi-alembic-sqlmodel-async's People

Contributors

jonra1993 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.