{"id":16544684,"url":"https://github.com/mahajanankur/fast-api-template","last_synced_at":"2026-05-01T04:34:46.830Z","repository":{"id":254093178,"uuid":"844451302","full_name":"mahajanankur/fast-api-template","owner":"mahajanankur","description":"Python FastAPI REST Web Service Template","archived":false,"fork":false,"pushed_at":"2024-08-21T13:02:58.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T11:17:37.690Z","etag":null,"topics":["fastapi","python","webservice"],"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/mahajanankur.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}},"created_at":"2024-08-19T09:34:50.000Z","updated_at":"2024-08-21T13:03:02.000Z","dependencies_parsed_at":"2025-01-14T11:17:42.699Z","dependency_job_id":"77c0e8c9-144d-49a9-ae9e-02cc54fb9e17","html_url":"https://github.com/mahajanankur/fast-api-template","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"d946cf53e130a8e99b202248d5ce03c553d58406"},"previous_names":["mahajanankur/fast-api-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahajanankur%2Ffast-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahajanankur%2Ffast-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahajanankur%2Ffast-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahajanankur%2Ffast-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahajanankur","download_url":"https://codeload.github.com/mahajanankur/fast-api-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241801255,"owners_count":20022390,"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":["fastapi","python","webservice"],"created_at":"2024-10-11T19:04:12.264Z","updated_at":"2026-05-01T04:34:46.773Z","avatar_url":"https://github.com/mahajanankur.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python FastAPI REST Web Service Template\n\nThis repository provides a comprehensive template for creating a Python-based FastAPI REST web service. It is designed to help both novice and experienced developers quickly set up a robust, production-ready web service.\n\n## Table of Contents\n1. [Getting Started](#getting-started)\n2. [Installation](#installation)\n3. [Running the Service](#running-the-service)\n   - [Locally with Python](#run-locally-with-python)\n   - [Using Docker](#run-using-docker)\n4. [Endpoints](#endpoints)\n5. [Logging Configuration](#logging-configuration)\n6. [Contributing](#contributing)\n7. [License](#license)\n\n## Getting Started\n\nClone the repository onto your local machine:\n```bash\ngit clone https://github.com/mahajanankur/fast-api-template.git\ncd fastapi-web-service-template\n```\n\n## Installation\n\n### Install Dependencies\n\nEnsure you have Python 3.8+ installed. Then, install the required Python packages:\n```bash\npip install -r requirements.txt\n```\n\n## Running the Service\n\n### Run Locally with Python\n\nTo run the FastAPI web service locally using Python:\n```bash\npython3 src/app.py\n```\n\nThis will start the FastAPI server on `http://localhost:8081`.\n\n### Run Using Docker\n\nTo run the FastAPI web service in a Docker container with production-level settings (using **[Gunicorn](https://gunicorn.org/#quickstart)** and Uvicorn):\n```bash\ndocker-compose up --build\n```\n\nThis will start the service in a Docker container, accessible on `http://localhost:8081`.\n\n## Endpoints\n\n### Health Check\n\n**GET /health**  \n- **Description**: Simple health check endpoint to verify that the service is running.\n- **Response**: `{\"status\": \"healthy\"}`\n\n### Products API\n\n**GET /api/products**  \n- **Description**: Returns a JSON array of all the products.\n- **Response**: A list of products in JSON format.\n\n### Custom Endpoints\n\nYou can add more endpoints to `src/resources` and define their corresponding logic in the service layers. Follow the existing structure for consistency.\n\n## Logging Configuration\n\nThis template uses a custom logging configuration designed for production environments. Logs are categorized into error logs and access logs, with flexibility for customization. The logging configuration is defined in the `uvicorn_log_config.py` file.\n\n### Dynamic Service Name in Logs\n\nThe log format dynamically includes the service name from your configuration:\n```python\nservice_name = config.get(\"service\", \"default-service\")\n```\n\nYou can modify the logging configuration in `uvicorn_log_config.py` to fit your needs.\n\n## Contributing\n\nWe welcome contributions to enhance this template. If you find a bug or have suggestions for improvements, please open an issue or submit a pull request. Contributions are greatly appreciated!\n\n### How to Contribute\n\n1. Fork the repository.\n2. Create a new feature branch (`git checkout -b feature/new-feature`).\n3. Commit your changes (`git commit -m 'Add new feature'`).\n4. Push to the branch (`git push origin feature/new-feature`).\n5. Open a pull request.\n\n## License\n\nThis project is licensed under the **Apache 2.0** License. See the `LICENSE` file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahajanankur%2Ffast-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahajanankur%2Ffast-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahajanankur%2Ffast-api-template/lists"}