{"id":28201079,"url":"https://github.com/umbertogriffo/fastapi-blueprint","last_synced_at":"2025-06-12T18:31:47.152Z","repository":{"id":288598212,"uuid":"955264240","full_name":"umbertogriffo/fastapi-blueprint","owner":"umbertogriffo","description":"A minimal FastAPI blueprint to start a project from scratch","archived":false,"fork":false,"pushed_at":"2025-04-25T10:50:07.000Z","size":79,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T22:15:12.353Z","etag":null,"topics":["api","api-rest","backend","backend-api","blueprint","docker","docker-compose","fastapi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/umbertogriffo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-26T11:20:54.000Z","updated_at":"2025-04-30T14:14:28.000Z","dependencies_parsed_at":"2025-04-20T11:16:40.972Z","dependency_job_id":null,"html_url":"https://github.com/umbertogriffo/fastapi-blueprint","commit_stats":null,"previous_names":["umbertogriffo/fastapi-blueprint"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/umbertogriffo/fastapi-blueprint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbertogriffo%2Ffastapi-blueprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbertogriffo%2Ffastapi-blueprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbertogriffo%2Ffastapi-blueprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbertogriffo%2Ffastapi-blueprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umbertogriffo","download_url":"https://codeload.github.com/umbertogriffo/fastapi-blueprint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbertogriffo%2Ffastapi-blueprint/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259519176,"owners_count":22870326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-rest","backend","backend-api","blueprint","docker","docker-compose","fastapi"],"created_at":"2025-05-16T22:15:35.617Z","updated_at":"2025-06-12T18:31:47.137Z","avatar_url":"https://github.com/umbertogriffo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI Blueprint\n\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![Code style: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\nA minimal FastAPI blueprint to start a project from scratch.\n\nApplication Features:\n - ⚙️ Configurable with BaseSettings of Pydantic\n - 📄 Structured Logging\n - 🔒 API endpoints secured with API key authentication\n - 🛡️ Centralized error handling with custom exceptions and detailed logging\n\nRepo Features:\n - 🛠️ configuration in a single file pyproject.toml\n - 📦 uv as package manager\n - 💅 ruff for linting and formatting\n - 🧪 pytest\n - 🧹 Makefile\n - 🐳 Optimized and secure Docker Image (~107MB)\n - 🚀 Docker compose configuration for local development\n\n## Table of contents\n\n- [FastAPI Blueprint](#fastapi-blueprint)\n  - [Prerequisites](#prerequisites)\n    - [Install uv](#install-uv)\n  - [Bootstrap Environment](#bootstrap-environment)\n    - [How to use the make file](#how-to-use-the-make-file)\n    - [Run the application](#run-the-application)\n  - [Docker](#docker)\n  - [Example of requests](#example-of-requests)\n  - [Resources](#resources)\n\n## Prerequisites\n\n* Python 3.10+\n* uv 0.6.10+\n\n### Install uv\n\nInstall `uv` with the official installer by following\nthis [link](https://docs.astral.sh/uv/getting-started/installation/).\n\n## Bootstrap Environment\n\nTo easily install the dependencies we created a make file.\n\n### How to use the make file\n\n\u003e [!IMPORTANT]\n\u003e Run `Setup` as your init command (or after `Clean`).\n\n* Check: ```make check```\n    * Use it to check that `which pip3` and `which python3` points to the right path.\n* Setup: ```make setup```\n    * Creates an environment and installs all dependencies.\n* Tidy up the code: ```make tidy```\n    * Run Ruff check and format.\n* Clean: ```make clean```\n    * Removes the environment and all cached files.\n* Test: ```make test```\n    * Runs all tests.\n    * Using [pytest](https://pypi.org/project/pytest/)\n\n### Environment\n\nCopy .𝐞𝐧𝐯.𝐞𝐱𝐚𝐦𝐩𝐥𝐞 → .𝐞𝐧𝐯 and fill it in.\n\n### Run the application\n\n```shell\npython app/main.py\n```\n\n## Docker\n\n\u003e [!NOTE]\n\u003e Dockerfile contains a multi-stage build that uses `--compile-bytecode` to compile the packages.\n\nBuild the Docker image with:\n```\ndocker build --no-cache -t fastapi-app:latest .\n```\n\nRun the Docker container locally with:\n```\ndocker run --rm -p 8080:8080 -v $(pwd)/.env:/usr/app/.env fastapi-app:latest\n```\n\nRun the service container by calling the following command from within the project folder:\n```commandline\ndocker compose up -d --build\n```\n\u003e [!NOTE]\n\u003e or for docker version \u003c 20.10.0:\n```commandline\ndocker-compose up -d --build\n```\n\nTo stop it:\n```commandline\ndocker compose down\n```\n\n## Example of requests\n\n```shell\ncurl -X GET \\\n  \"http://127.0.0.1:8080/health\"\n```\n\n```shell\ncurl -X GET \\\n  \"http://127.0.0.1:8080/users/\" \\\n  -H 'Authorization: your-secret-api-key-here' \\\n  | jq '.'\n```\n\n```shell\ncurl -X GET \\\n  \"http://127.0.0.1:8080/users/me\" \\\n  -H 'Authorization: your-secret-api-key-here' \\\n  | jq '.'\n```\n\n```shell\ncurl -X POST \\\n  \"http://127.0.0.1:8080/users/check\" \\\n  -H 'Authorization: your-secret-api-key-here' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"name\": \"admin\"}' \\\n  | jq '.'\n```\n\n## Resources\n- [Using uv with FastAPI](https://docs.astral.sh/uv/guides/integration/fastapi/#using-uv-with-fastapi)\n- [Deployments Concepts](https://fastapi.tiangolo.com/deployment/concepts/)\n- [How to secure APIs built with FastAPI: A complete guide](https://escape.tech/blog/how-to-secure-fastapi-api/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbertogriffo%2Ffastapi-blueprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumbertogriffo%2Ffastapi-blueprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbertogriffo%2Ffastapi-blueprint/lists"}