This is a minimal template for a FastAPI project with Supabase, SQLModel and Alembic.
- FastAPI for building APIs
- Supabase for authentication and database
- SQLModel for ORM
- Alembic for database versionning and migrations
- uv for dependency management
The project features a basic example of a bookmark application, supporting CRUD operations with Supabase authentication (including compatibility with Swagger's Auth).
-
Clone the repository:
git clone https://github.com/yourusername/aipocket.git cd aipocket
-
Install UV:
pip install uv
You don't have to do that in a virtual environment, as UV is a standalone tool. UV will later on install the dependencies for you in a virtual environnement.
-
Set up your environment variables for Supabase and database configuration or use an
.env
file based on the given example:cp .env.example .env
Update the
.env
file with your Supabase URL, Supabase key, database URL, and database URL for migrations. -
(Optional) In case you perform modifications to
models.py
(ie. modification to the DB scheme): Generate a new Alembic migration:uv run alembic revision --autogenerate -m "Your message here"
-
Run the database migrations:
uv run alembic upgrade head
-
Start the FastAPI server:
uv run uvicorn app.main:app --reload --reload-dir app
At the first run, UV will create a virtual environment and install the dependencies inside it.
-
Access the API documentation at
http://127.0.0.1:8000/docs
.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.