Skip to content

About

πŸ“š Repository dedicated to learning and practicing FastAPI concepts, backend architecture, and modern Python development.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

27 Commits

Folders and files

Repository files navigation

FastAPI Learning

Typing SVG


Python FastAPI Status License


πŸ“Œ About This Repository

This repository is dedicated to learning and practicing FastAPI concepts, backend architecture, and modern Python development. It serves as a hands-on playground for building APIs, working with databases, authentication, and deployment workflows.

The project focuses on:

  • Building REST APIs with FastAPI
  • Modeling and validating data with Pydantic
  • Working with SQLAlchemy and Alembic
  • Implementing authentication and authorization
  • Writing tests with pytest
  • Preparing applications for containerized deployment

"The best way to learn a framework is to build something real with it."


🧱 Project Structure

fastapi_learning/
  app.py
  database.py
  security.py
  settings.py
  models/
  routers/
  schemas/

tests/
  conftest.py
  test_app.py
  test_auth.py
  test_todos.py
  test_users.py

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/LyanKaleu/fastapi_learning.git
cd fastapi_learning

2. Create and activate the virtual environment

poetry install
poetry shell

3. Run the application

Before starting the app, make sure you have a .env file with the required environment variables, such as:

DATABASE_URL=...
SECRET_KEY=...
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30

If you prefer the development-style command, you can use:

poetry run fastapi dev fastapi_learning/app.py

4. Run the tests

pytest -q

5. Use Taskipy for common commands

If you prefer a shorter workflow, Taskipy is already configured in pyproject.toml.

task run

task test
task lint
task format
task migrate
task migration-create "Describe your change"

Here is what each task does:

  • task run β€” starts the FastAPI development server
  • task test β€” runs the test suite with pytest and coverage
  • task lint β€” checks the codebase with Ruff
  • task format β€” formats the code with Ruff
  • task migrate β€” applies the latest Alembic migrations
  • task migration-create "..." β€” creates a new Alembic migration with an autogenerated message
  • task migrate-down β€” reverts the last migration

πŸ—„οΈ Database and Migrations

This project uses Alembic for schema evolution.

poetry run alembic upgrade head
poetry run alembic revision --autogenerate -m "Describe your change"

πŸ§ͺ Testing

The test suite covers API behavior, authentication, database access, and core application flows.

pytest -q

🐳 Docker

You can also run the project in a container.

docker build -t fastapi-learning .
docker run -p 8000:8000 fastapi-learning

πŸš€ Deploy on Fly.io

The project is also prepared for deployment on Fly.io through the GitHub Actions workflow in .github/workflows/fly-deploy.yml.

Before deploying, make sure you have the Fly CLI installed. You can install it from: https://fly.io/docs/hands-on/install-flyctl/

Typical flow:

flyctl deploy

The application image uses the entrypoint defined in entrypoint.sh, so migrations are applied automatically when the container starts.


🌱 Why FastAPI?

FastAPI combines Python simplicity with modern API development practices:

  • Clean and expressive route definitions
  • Automatic request and response validation
  • Excellent editor support and type hints
  • Strong async support for scalable services
  • Great fit for learning backend architecture in practice

πŸ‘€ Author

Lyan Kaleu

GitHub Email


// Learning backend development one concept at a time.

About

πŸ“š Repository dedicated to learning and practicing FastAPI concepts, backend architecture, and modern Python development.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages