{"id":19167843,"url":"https://github.com/wmramadan/fastapi-boilerplate","last_synced_at":"2025-08-22T13:07:40.728Z","repository":{"id":64626350,"uuid":"575773654","full_name":"WMRamadan/fastapi-boilerplate","owner":"WMRamadan","description":"FastAPI REST API pre-configured with a database. This will get you up and running with CRUD operations quickly.","archived":false,"fork":false,"pushed_at":"2023-04-18T14:23:15.000Z","size":124,"stargazers_count":35,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T23:31:54.854Z","etag":null,"topics":["asyncio","boilerplate","celery","docker","docker-compose","fastapi","loguru","pydantic","pylint","pymongo","pytest","python","redis","rest-api","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WMRamadan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["wmramadan"]}},"created_at":"2022-12-08T09:10:31.000Z","updated_at":"2024-12-30T22:27:33.000Z","dependencies_parsed_at":"2024-11-13T09:01:00.756Z","dependency_job_id":null,"html_url":"https://github.com/WMRamadan/fastapi-boilerplate","commit_stats":null,"previous_names":[],"tags_count":24,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Ffastapi-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Ffastapi-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Ffastapi-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WMRamadan%2Ffastapi-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WMRamadan","download_url":"https://codeload.github.com/WMRamadan/fastapi-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252889367,"owners_count":21820173,"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":["asyncio","boilerplate","celery","docker","docker-compose","fastapi","loguru","pydantic","pylint","pymongo","pytest","python","redis","rest-api","sqlalchemy"],"created_at":"2024-11-09T09:39:36.794Z","updated_at":"2025-05-07T13:43:23.749Z","avatar_url":"https://github.com/WMRamadan.png","language":"Python","funding_links":["https://github.com/sponsors/wmramadan"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png\" alt=\"FastAPI image\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/WMRamadan/fastapi-boilerplate/actions/workflows/python-app.yml\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/wmramadan/fastapi-boilerplate/actions/workflows/python-app.yml/badge.svg\" alt=\"Test\"\u003e\n    \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/badge/platforms-Windows%20%7C%20Mac%20%7C%20Linux-orange\" alt=\"Supported Platforms\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue\" alt=\"Supported Python versions\"\u003e\n\u003c/p\u003e\n\n# FastAPI Boilerplate\nFastAPI REST API pre-configured with a database. This will get you up and running with CRUD operations quickly. Use this starter, boilerplate for all your new FastAPI projects.\n\n## Requirements\n- Python3\n- python3-virtualenv\n- python3-pip\n- Docker\n- Docker-compose\n\n## Features\n- SQLAlchemy\n- Pydantic\n- Docker\n- Logging\n- Celery\n- Tests\n- Config\n- SSE\n- PyMongo\n\n## ToDo\n- Version 1.0 [Roadmap](./docs/v1-roadmap.md)\n\n## File Structure\n```\n.\n├── api\n│   ├── __init__.py\n│   ├── collections.py\n│   ├── config.py\n│   ├── database.py\n│   ├── main.py\n|   ├── worker.py\n│   └── models\n│   │   ├── __init__.py\n│   │   ├── item_model.py\n│   │   └── task_model.py\n│   │   └── user_model.py\n│   └── schemas\n│   │   ├── __init__.py\n│   │   ├── items_schema.py\n│   │   ├── questions_schema.py\n│   │   └── tasks_schema.py\n│   │   └── users_schema.py\n│   └── routers\n│   │   ├── __init__.py\n│   │   ├── async_router.py\n│   │   ├── items.py\n│   │   ├── questions.py\n│   │   ├── stream.py\n│   │   ├── tasks.py\n│   │   └── users.py\n│   └── helpers\n│   │   ├── __init__.py\n│   │   ├── async_helper.py\n│   │   └── crud.py\n│   └── tests\n│   │   ├── __init__.py\n│   │   ├── db.py\n│   │   └── test_main.py\n├── docker\n│   └── Dockerfile\n```\n\n## Environment Variables\n- SQLALCHEMY_DATABASE_URL - Database URL used, can be either SQLite or PostgreSQL.\n- MONGODB_URL - Database URL for MongoDB server.\n- MONGODB_NAME - Name used for MongoDB Database.\n- CELERY_CONF_BROKER_URL - Celery redis broker URL.\n- CELERY_CONF_RESULT_BACKEND - Celery redis result backend.\n- ALLOWED_ORIGINS - A list of origins that should be permitted to make cross-origin requests.\n- ALLOW_CREDENTIALS - Allowed credentials `bool` for CORS middelware.\n- ALLOW_METHODS - Allowed methods ['GET','POST','PUT','PATCH','DELETE','OPTIONS'] for CORS middleware.\n- ALLOW_HEADERS - A list of HTTP request headers that should be supported for cross-origin requests.\n- APP_DEBUG - Set app debug mode `bool` value.\n\n## Updating Changelog\nYou can run `git-changelog.sh` bash script to update the [CHANGELOG](./CHANGELOG.md) file using the following command:\n```bash\nbash git-changelog.sh \u003e CHANGELOG.md\n```\n\n## Linting\nYou can run `pylint` with the following command inside the `fastapi-boilerplate` directory:\n```bash\npylint --recursive=y api\n```\n\n## Running Tests\nYou can run `pytest` with the following command inside the `fastapi-boilerplate` directory:\n```bash\npytest api/\n```\n\n## Quick Start (Local)\n1. Clone the repo:\n    ```bash\n    git clone https://github.com/WMRamadan/fastapi-boilerplate\n    cd fastapi-boilerplate\n    ```\n2. Initialize and activate a virtual environment:\n    ```bash\n    virtualenv env\n    source env/bin/activate\n    ```\n\n3. Install dependencies:\n    ```bash\n    pip3 install -r requirements.txt\n    ```\n\n4. Run `redis` service required for celery worker:\n    ```bash\n    docker-compose -f docker-compose-services.yml up -d\n    ```\n\n5. Run `celery` worker:\n    ```bash\n    celery --app=api.worker.celery worker --loglevel=info --logfile=celery.log\n    ```\n\n6. Run the development server:\n    ```bash\n    uvicorn api.main:app --reload\n    ```\n\n7. View the API docs:\n    ```bash\n    http://localhost:8000/docs\n    # OR\n    http://localhost:8000/redoc\n    ```\n\n## Quick Start (Docker)\n1. Clone the repo:\n    ```bash\n    git clone https://github.com/WMRamadan/fastapi-boilerplate\n    cd fastapi-boilerplate\n    ```\n2. Build:\n    ```bash\n    docker-compose build\n    ```\n\n3. Run the app:\n    ```bash\n    docker-compose up\n    ```\n\n4. View the API docs:\n    ```bash\n    http://localhost/docs\n    # OR\n    http://localhost/redoc\n    ```\n\n## Contribution\n\nPlease check our [Contributing Guide](./docs/CONTRIBUTING.md) on how you can contribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmramadan%2Ffastapi-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwmramadan%2Ffastapi-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmramadan%2Ffastapi-boilerplate/lists"}