{"id":47994740,"url":"https://github.com/remarkablemark/python-microservice-template","last_synced_at":"2026-04-04T11:53:12.842Z","repository":{"id":337541982,"uuid":"1154100777","full_name":"remarkablemark/python-microservice-template","owner":"remarkablemark","description":"🐍 Python microservice template","archived":false,"fork":false,"pushed_at":"2026-04-03T02:08:55.000Z","size":1970,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-03T11:46:03.491Z","etag":null,"topics":["api","fastapi","microservice","python","python3","template","uvicorn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remarkablemark.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":["remarkablemark"],"patreon":"remarkablemark","open_collective":null,"ko_fi":"remarkablemark","tidelift":null,"community_bridge":null,"liberapay":"remarkablemark","issuehunt":null,"otechie":null,"buy_me_a_coffee":"remarkablemark","thanks_dev":"u/gh/remarkablemark","custom":["https://b.remarkabl.org/teespring"]}},"created_at":"2026-02-10T02:31:44.000Z","updated_at":"2026-04-03T02:08:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/remarkablemark/python-microservice-template","commit_stats":null,"previous_names":["remarkablemark/python-microservice-template"],"tags_count":0,"template":true,"template_full_name":"remarkablemark/fastapi-template","purl":"pkg:github/remarkablemark/python-microservice-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fpython-microservice-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fpython-microservice-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fpython-microservice-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fpython-microservice-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remarkablemark","download_url":"https://codeload.github.com/remarkablemark/python-microservice-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkablemark%2Fpython-microservice-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31398770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","fastapi","microservice","python","python3","template","uvicorn"],"created_at":"2026-04-04T11:53:12.305Z","updated_at":"2026-04-04T11:53:12.835Z","avatar_url":"https://github.com/remarkablemark.png","language":"Python","funding_links":["https://github.com/sponsors/remarkablemark","https://patreon.com/remarkablemark","https://ko-fi.com/remarkablemark","https://liberapay.com/remarkablemark","https://buymeacoffee.com/remarkablemark","https://thanks.dev/u/gh/remarkablemark","https://b.remarkabl.org/teespring"],"categories":[],"sub_categories":[],"readme":"# python-microservice-template\n\n[![codecov](https://codecov.io/gh/remarkablemark/python-microservice-template/graph/badge.svg?token=RBdotUNGnY)](https://codecov.io/gh/remarkablemark/python-microservice-template)\n[![test](https://github.com/remarkablemark/python-microservice-template/actions/workflows/test.yml/badge.svg)](https://github.com/remarkablemark/python-microservice-template/actions/workflows/test.yml)\n[![lint](https://github.com/remarkablemark/python-microservice-template/actions/workflows/lint.yml/badge.svg)](https://github.com/remarkablemark/python-microservice-template/actions/workflows/lint.yml)\n\n🐍 Python microservice template built with:\n\n- [FastAPI](https://fastapi.tiangolo.com/)\n- [Uvicorn](https://uvicorn.dev/)\n- [SQLAlchemy](https://www.sqlalchemy.org/)\n- [Alembic](https://alembic.sqlalchemy.org/)\n- [OpenTelemetry](https://opentelemetry.io/)\n\n## Prerequisites\n\n[uv](https://docs.astral.sh/uv/#installation):\n\n```sh\nbrew install uv\n```\n\n## Install\n\nClone the repository:\n\n```sh\ngit clone https://github.com/remarkablemark/python-microservice-template.git\ncd python-microservice-template\n```\n\nInstall the dependencies:\n\n```sh\nuv sync\n```\n\n## Authentication\n\nThe microservice supports optional bearer token authentication.\n\n### Environment Variables\n\nCopy the example environment file:\n\n```sh\ncp .env.example .env\n```\n\nEdit `.env` and set your bearer tokens:\n\n```sh\n# Single token\nAPI_KEYS=your-secret-key-here\n\n# Multiple tokens (comma-separated)\nAPI_KEYS=key-1,key-2,key-3\n```\n\n### Protected Endpoints\n\nProtected endpoints require an `Authorization` header with a bearer token:\n\n```sh\ncurl -H \"Authorization: Bearer your-secret-key-here\" \\\n  http://127.0.0.1:8000/protected/\n```\n\nWhen authentication is enabled, the `/protected` endpoints will be available at:\n- `GET /protected/` - Basic protected endpoint\n- `GET /protected/data` - Protected endpoint with data\n\n## Database\n\nThe microservice supports optional database integration using SQLModel and Alembic.\n\n### Environment Variables\n\nCopy the example environment file and configure your database:\n\n```sh\ncp .env.example .env\n```\n\nEdit `.env` and set your database URL:\n\n```sh\n# For SQLite (Development)\nDATABASE_URL=sqlite:///./app.db\n\n# For PostgreSQL (Production)\n# DATABASE_URL=postgresql://user:password@localhost:5432/dbname\n```\n\n### Migrations\n\nCreate a new migration after modifying models:\n\n```sh\nuv run alembic revision --autogenerate -m \"description\"\n```\n\nApply migrations:\n\n```sh\nuv run alembic upgrade head\n```\n\nRollback migration:\n\n```sh\nuv run alembic downgrade -1\n```\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `uv run pre-commit install`\n\nInstalls the pre-commit script.\n\n### `uv run fastapi dev`\n\nRuns the app in development mode:\n\n- Server: http://127.0.0.1:8000\n- Documentation: http://127.0.0.1:8000/docs\n- OpenAPI: http://127.0.0.1:8000/openapi.json\n\nThe server will reload if you make edits.\n\nAlternatively, run with uvicorn directly:\n\n```sh\nuv run uvicorn app.main:app --reload\n```\n\n### `uv run fastapi run`\n\nRuns the app in production mode.\n\nAlternatively, run with uvicorn directly:\n\n```sh\nuv run uvicorn app.main:app --host 0.0.0.0 --port 8000\n```\n\n### `uv run ruff format`\n\nFormats the code (replaces Black).\n\n### `uv run ruff check`\n\nLints the code and checks import sorting (replaces isort).\n\n### `uv run ruff check --fix`\n\nAuto-fixes linting issues and sorts imports.\n\n### `uv run coverage run -m pytest \u0026\u0026 uv run coverage report`\n\nRuns tests with coverage reporting (fails if coverage is below 100%).\n\n### `uv run alembic revision --autogenerate -m \"message\"`\n\nCreates a new database migration.\n\n### `uv run alembic upgrade head`\n\nApplies all pending database migrations.\n\n## License\n\n[MIT](https://github.com/remarkablemark/python-microservice-template/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkablemark%2Fpython-microservice-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremarkablemark%2Fpython-microservice-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkablemark%2Fpython-microservice-template/lists"}