{"id":46457113,"url":"https://github.com/javidahmed64592/python-template-server","last_synced_at":"2026-04-12T02:01:42.097Z","repository":{"id":327305232,"uuid":"1106704154","full_name":"javidahmed64592/python-template-server","owner":"javidahmed64592","description":"A template FastAPI server with production-ready configuration.","archived":false,"fork":false,"pushed_at":"2026-04-12T00:57:46.000Z","size":526,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-12T01:20:19.113Z","etag":null,"topics":["bandit","docker","docker-compose","fastapi","mypy","pip-audit","pytest","python","ruff","sphinx","uv"],"latest_commit_sha":null,"homepage":"https://javidahmed64592.github.io/python-template-server/","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/javidahmed64592.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-29T19:20:31.000Z","updated_at":"2026-04-12T00:57:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/javidahmed64592/python-template-server","commit_stats":null,"previous_names":["javidahmed64592/python-template-server"],"tags_count":2,"template":true,"template_full_name":"javidahmed64592/template-python","purl":"pkg:github/javidahmed64592/python-template-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javidahmed64592%2Fpython-template-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javidahmed64592%2Fpython-template-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javidahmed64592%2Fpython-template-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javidahmed64592%2Fpython-template-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javidahmed64592","download_url":"https://codeload.github.com/javidahmed64592/python-template-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javidahmed64592%2Fpython-template-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31701641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"online","status_checked_at":"2026-04-12T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bandit","docker","docker-compose","fastapi","mypy","pip-audit","pytest","python","ruff","sphinx","uv"],"created_at":"2026-03-06T02:21:58.934Z","updated_at":"2026-04-12T02:01:42.073Z","avatar_url":"https://github.com/javidahmed64592.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Python](https://img.shields.io/badge/Python-3.13-3776AB.svg?style=flat\u0026logo=python\u0026logoColor=ffd343)](https://docs.python.org/3.13/)\n[![FastAPI](https://img.shields.io/badge/FastAPI-Latest-009688?style=flat\u0026logo=fastapi\u0026logoColor=white)](https://fastapi.tiangolo.com/)\n[![CI](https://img.shields.io/github/actions/workflow/status/javidahmed64592/python-template-server/ci.yml?branch=main\u0026style=flat-square\u0026label=CI\u0026logo=github)](https://github.com/javidahmed64592/python-template-server/actions/workflows/ci.yml)\n[![Build](https://img.shields.io/github/actions/workflow/status/javidahmed64592/python-template-server/build.yml?branch=main\u0026style=flat-square\u0026label=Build\u0026logo=github)](https://github.com/javidahmed64592/python-template-server/actions/workflows/build.yml)\n[![Docs](https://img.shields.io/github/actions/workflow/status/javidahmed64592/python-template-server/docs.yml?branch=main\u0026style=flat-square\u0026label=Docs\u0026logo=github)](https://github.com/javidahmed64592/python-template-server/actions/workflows/docs.yml)\n[![Docker](https://img.shields.io/github/actions/workflow/status/javidahmed64592/python-template-server/docker.yml?branch=main\u0026style=flat-square\u0026label=Docker\u0026logo=github)](https://github.com/javidahmed64592/python-template-server/actions/workflows/docker.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003c!-- omit from toc --\u003e\n# Python Template Server\n\nA production-ready FastAPI server template with built-in authentication, rate limiting and security headers.\nThis repository provides a solid foundation for building secure, observable FastAPI applications.\n\n\u003c!-- omit from toc --\u003e\n## Table of Contents\n- [Features](#features)\n- [Architecture](#architecture)\n- [Quick Start](#quick-start)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n  - [Managing the Container](#managing-the-container)\n- [Using as a Template](#using-as-a-template)\n- [License](#license)\n\n## Features\n\n- **TemplateServer Base Class**: Reusable foundation with middleware, auth, and rate limiting\n- **FastAPI Framework**: Modern, fast, async-ready web framework\n- **CORS Support**: Configurable cross-origin resource sharing for frontend integration\n- **Static File Serving**: FastAPI's StaticFiles mounting with custom 404.html support\n- **Docker Support**: Multi-stage builds with docker-compose orchestration\n- **Production Patterns**: Token generation, SSL certificate handling, health checks\n\n## Architecture\n\nThis project uses a **`TemplateServer` base class** that encapsulates cross-cutting concerns:\n\n- **Request Logging**: All requests/responses logged with client IP tracking\n- **Security Headers**: HSTS/CSP/X-Frame-Options automatically applied\n- **API Key Verification**: SHA-256 hashed tokens with secure validation\n- **Rate Limiting**: Configurable limits using `slowapi` (in-memory/Redis/Memcached)\n- **CORS Middleware**: Optional cross-origin support for frontend applications\n- **Static File Serving**: Serve SPAs or static assets using FastAPI's StaticFiles mounting\n\n**Application-specific servers** (like `ExampleServer` in `main.py`) extend `TemplateServer` to implement domain-specific endpoints and business logic.\nThe base class handles all infrastructure concerns, letting you focus on your API functionality.\n\n## Quick Start\n\n### Installation\n\nDownload the latest release from [GitHub Releases](https://github.com/javidahmed64592/python-template-server/releases).\n\n### Configuration\n\nRename `.env.example` to `.env` and edit it to configure the server.\n\n- `HOST`: Server host address (default: localhost)\n- `PORT`: Server port (default: 443)\n- `API_TOKEN_HASH`: Leave blank to auto-generate on first run, or provide your own token hash\n\n### Managing the Container\n\n```sh\n# Start the container\ndocker compose up -d\n\n# Stop the container\ndocker compose down\n\n# Update to the latest version\ndocker compose pull \u0026\u0026 docker compose up -d\n\n# View the logs\ndocker compose logs -f python-template-server\n```\n\n**Note:** You may need to add your user to the Docker group and log out/in for permission changes to take effect:\n```sh\nsudo usermod -aG docker ${USER}\n```\n\n## Using as a Template\n\nTo create your own server:\n\n1. **Create a subclass of `TemplateServer`** (see `python_template_server/main.py:ExampleServer` as reference)\n2. **Implement required methods**:\n   - `validate_config()`: Validate your config model\n   - `setup_routes()`: Define your API endpoints\n3. **Add custom routes** to the `setup_routes()` method\n4. **Configure** via `configuration/config.json`\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavidahmed64592%2Fpython-template-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavidahmed64592%2Fpython-template-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavidahmed64592%2Fpython-template-server/lists"}