Skip to content

[Template] FastAPI + SQLAlchemy(Async) + Alembic(Async) + Python Dependency Injector + MySQL 8.0 + Admin Pannel

Notifications You must be signed in to change notification settings

J-Hoplin/Hoplin-FastAPI-Starter

Repository files navigation

Hoplin FastAPI Starter

FastAPI base code with modern Python & FastAPI pattern and Dependency Injection pattern with following 3 Layer Architecture.

Leveraged techniques described below

Language & Frameworks

Data Persistent

About More

Already Implemented

  • JWT Base Authorization
  • SignIn/SignUp
  • User List/Retrieve (Only superuser or staff)

Create Superuser and commands

This base code grants special privileges only to users marked as superuser or staff, allowing them to access specific endpoints and manage the application (e.g., the admin page). To create a superuser, you can use the pre-built command included in this application, available through both make and the Python module run command.

# Use make

make create-superuser

# Python module run command

python -m apps.commands.create_superuser

Execution Example

img

Check out the README.md for more information on the pre-built commands in this application.

Admin Page

This base code provide model admin page with SQLAdmin. Admin page access requires a user account with superuser or staff privileges. Users without either of these cannot log in.

  • Endpoint: /admin

admin-pannel

Swagger & Swagger Protection

In this base code, Swagger is protected with authentication. Swagger page access requires a user account with superuser or staff privileges. Users without either of these cannot log in.

  • Endpoint: /docs/swagger

Relevant documents on concepts leveraged in this base code

Refer to ReadMe.md in apps.core

Start application without Docker (Recommended)

make run starts the application with Uvicorn, using uvloop as the event loop. This provides better performance compared to the default asyncio event loop.

Start Application with docker

Start the project with Docker using:

docker compose up -d

docker compose down

Others

  • Setup Local Environment including uv install

    make setup
    
  • Make migrations

     make migration m="(migration message required)"
    

About

[Template] FastAPI + SQLAlchemy(Async) + Alembic(Async) + Python Dependency Injector + MySQL 8.0 + Admin Pannel

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published