{"id":34138630,"url":"https://github.com/bubaley/fastapi-ronin","last_synced_at":"2025-12-15T02:01:59.489Z","repository":{"id":304080952,"uuid":"1016658934","full_name":"bubaley/fastapi-ronin","owner":"bubaley","description":"FastAPI-Ronin is a library for building applications with a Django REST Framework architecture.","archived":false,"fork":false,"pushed_at":"2025-12-12T23:00:37.000Z","size":652,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-13T05:55:49.611Z","etag":null,"topics":["django","django-rest-framework","drf","fastapi","fastapi-crud","fastapi-router","tortoise","viewsets"],"latest_commit_sha":null,"homepage":"https://bubaley.github.io/fastapi-ronin/","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/bubaley.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-07-09T10:34:05.000Z","updated_at":"2025-12-12T23:00:40.000Z","dependencies_parsed_at":"2025-09-05T01:12:10.268Z","dependency_job_id":null,"html_url":"https://github.com/bubaley/fastapi-ronin","commit_stats":null,"previous_names":["bubaley/fastapi-mason","bubaley/fastapi-ronin"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bubaley/fastapi-ronin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubaley%2Ffastapi-ronin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubaley%2Ffastapi-ronin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubaley%2Ffastapi-ronin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubaley%2Ffastapi-ronin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bubaley","download_url":"https://codeload.github.com/bubaley/fastapi-ronin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bubaley%2Ffastapi-ronin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27742400,"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","status":"online","status_checked_at":"2025-12-15T02:00:09.782Z","response_time":96,"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":["django","django-rest-framework","drf","fastapi","fastapi-crud","fastapi-router","tortoise","viewsets"],"created_at":"2025-12-15T02:01:17.336Z","updated_at":"2025-12-15T02:01:59.476Z","avatar_url":"https://github.com/bubaley.png","language":"Python","readme":"# FastAPI Ronin\n\n\u003cp align=\"center\"\u003e\n  \u003cimg align=\"center\" src=\"docs/assets/logo.png\" alt=\"logo\" width=\"200\"/\u003e\n  \u003ch1 align=\"center\"\u003eFastAPI Ronin\u003c/h1\u003e\n\u003c/p\u003e\n\u003cp align=\"center\" markdown=1\u003e\n  \u003ci\u003eBuild REST APIs with Django REST Framework patterns in FastAPI\u003c/i\u003e\n\u003c/p\u003e\n\u003cp align=\"center\" markdown=1\u003e\n\u003ca href=\"https://pypi.org/project/fastapi-ronin/\"\u003e\n  \u003cimg src=\"https://img.shields.io/pypi/v/fastapi-ronin?color=%2334D058\u0026label=pypi%20package\" alt=\"PyPi Version\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/fastapi-ronin/\"\u003e\n  \u003cimg src=\"https://img.shields.io/pypi/pyversions/fastapi-ronin.svg?color=%2334D058\" alt=\"Supported Python Versions\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/bubaley/fastapi-ronin/blob/main/LICENSE\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"License\"/\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003chr\u003e\n\n**Transform your FastAPI development with familiar Django REST Framework patterns.**\n\nFastAPI Ronin brings the beloved patterns and conventions from Django REST Framework to FastAPI, providing a structured and efficient way to build REST APIs. With familiar concepts like ViewSets, permissions, pagination, and serialization, you can rapidly develop robust API applications.\n\nJust like skilled ronin who master their craft with precision and expertise, FastAPI Ronin helps you build reliable, well-structured APIs with time-tested patterns and best practices.\n\n\u003chr\u003e\n\u003cp\u003e\u003cb\u003eDocumentation\u003c/b\u003e: \u003ca class=\"link\" href=\"https://bubaley.github.io/fastapi-ronin\"\u003ebubaley.github.io/fastapi-ronin\u003c/a\u003e\u003c/p\u003e\n\u003chr\u003e\n\n\u003cdiv style=\"margin: 2rem 0;\"\u003e\n  \u003ca href=\"https://bubaley.github.io/fastapi-ronin/quick-start/\" class=\"get-started-btn\"\u003e\n    Get Started\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## 📦 Installation\n\nInstall FastAPI Ronin using UV:\n\n```bash\nuv add fastapi-ronin\n```\n\n## 🚀 Quick Example\n\nHere's a complete example showing how to build a REST API with FastAPI Ronin:\n\n```python\n# main.py - Complete FastAPI Ronin application\nfrom datetime import datetime\n\nfrom fastapi import APIRouter, FastAPI\nfrom tortoise import fields\nfrom tortoise.contrib.fastapi import register_tortoise\nfrom tortoise.contrib.pydantic import PydanticModel\nfrom tortoise.models import Model\n\nfrom fastapi_ronin.decorators import action, schema, viewset\nfrom fastapi_ronin.pagination import PageNumberPagination\nfrom fastapi_ronin.viewsets import ModelViewSet\nfrom fastapi_ronin.wrappers import PaginatedResponseDataWrapper, ResponseDataWrapper\n\n\n# Database setup\ndef register_database(app: FastAPI):\n    register_tortoise(\n        app,\n        db_url='sqlite://db.sqlite3',\n        modules={'models': ['main']},\n        generate_schemas=True,\n        add_exception_handlers=True,\n    )\n\n\n# Models\nclass Company(Model):\n    id = fields.IntField(primary_key=True)\n    name = fields.CharField(max_length=255)\n    full_name = fields.TextField(null=True)\n    created_at = fields.DatetimeField(auto_now_add=True)\n    updated_at = fields.DatetimeField(auto_now=True)\n\n\n# Schemas\n@schema(model=Company)\nclass CompanyCreateSchema(PydanticModel):\n    name: str\n    full_name: str\n\n\n@schema(model=Company)\nclass CompanyReadSchema(PydanticModel):\n    id: int\n    name: str\n    full_name: str\n    created_at: datetime\n    updated_at: datetime\n\n\n# Views\nrouter = APIRouter(prefix='/companies', tags=['companies'])\n\n\n@viewset(router)\nclass CompanyViewSet(ModelViewSet[Company]):\n    model = Company\n    read_schema = CompanyReadSchema\n    create_schema = CompanyCreateSchema\n\n    pagination = PageNumberPagination\n    list_wrapper = PaginatedResponseDataWrapper\n    single_wrapper = ResponseDataWrapper\n\n    # permission_classes = [IsAuthenticatedOrReadOnly]\n\n    @action(methods=['GET'], detail=False)\n    async def stats(self) -\u003e dict[str, int]:\n        return {'total': await Company.all().count()}\n\n\n# Application\napp = FastAPI(title='My API')\nregister_database(app)\napp.include_router(router)\n```\n\nStart server:\n\n```bash\nuvicorn main:app --reload\n```\n\n Try API Endpoints:\n\n```python\n\"\"\"\nThis creates the following endpoints:\n- GET /companies/ - List companies with pagination\n- POST /companies/ - Create new company\n- GET /companies/{item_id}/ - Get specific company\n- PUT /companies/{item_id}/ - Update company\n- DELETE /companies/{item_id}/ - Delete company\n- GET /companies/stats/ - Custom stats endpoint\n\nExample API Responses:\n\nGET /companies/ (with pagination wrapper):\n{\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": \"Acme Corp\",\n      \"full_name\": \"Acme Corporation Ltd.\",\n      \"created_at\": \"2023-01-01T10:00:00Z\",\n      \"updated_at\": \"2023-01-01T10:00:00Z\"\n    }\n  ],\n  \"pagination\": {\n    \"page\": 1,\n    \"page_size\": 10,\n    \"total_pages\": 5,\n    \"total_items\": 47\n  }\n}\n\nGET /companies/1/ (with single wrapper):\n{\n  \"data\": {\n    \"id\": 1,\n    \"name\": \"Acme Corp\",\n    \"full_name\": \"Acme Corporation Ltd.\",\n    \"created_at\": \"2023-01-01T10:00:00Z\",\n    \"updated_at\": \"2023-01-01T10:00:00Z\"\n  }\n}\n\nGET /companies/stats/ (custom action):\n{\n  \"total\": 123\n}\n\"\"\"\n```\n\n## ✨ Key Features\n\n\u003cdiv class=\"feature-card\"\u003e\n  \u003ch3\u003e🎯 ViewSets\u003c/h3\u003e\nDjango-like ViewSets with automatic CRUD operations and custom actions. Build complete REST APIs with minimal boilerplate code.\n\u003c/div\u003e\n\n\u003cdiv class=\"feature-card\"\u003e\n\u003ch3\u003e🔒 Permissions\u003c/h3\u003e\nBuilt-in permission system with customizable access control. Protect your endpoints with authentication and authorization rules.\n\u003c/div\u003e\n\n\u003cdiv class=\"feature-card\"\u003e\n\u003ch3\u003e📄 Pagination\u003c/h3\u003e\nMultiple pagination strategies out of the box: Limit/Offset and Page Number. You can easily customize or override pagination classes to suit your needs.\n\u003c/div\u003e\n\n\u003cdiv class=\"feature-card\"\u003e\n\u003ch3\u003e📋 Schema Generation\u003c/h3\u003e\nIntelligent schema generation with meta classes for fine-grained control over API serialization.\n\u003c/div\u003e\n\n\u003cdiv class=\"feature-card\"\u003e\n\u003ch3\u003e🔄 Response Wrappers\u003c/h3\u003e\nConsistent API response formatting with customizable wrapper classes.\n\u003c/div\u003e\n\n\u003cdiv class=\"feature-card\"\u003e\n\u003ch3\u003e⚡ State Management\u003c/h3\u003e\nRequest-scoped state management for sharing data across middleware and view components.\n\u003c/div\u003e\n\n## 🎯 Philosophy\n\nFastAPI Ronin is designed with these principles in mind:\n\n- **Familiar**: If you know Django REST Framework, you already know FastAPI Ronin\n- **Flexible**: Customize every aspect while maintaining sensible defaults\n- **Fast**: Built on FastAPI's high-performance foundation\n- **Modular**: Use only what you need, when you need it\n\n## 📚 Getting Started\n\nReady to build amazing APIs? Start with our [Quick Start guide](https://bubaley.github.io/fastapi-ronin/quick-start/) to get up and running in minutes.\n\nWant to dive deeper? Explore our comprehensive guides:\n\n- [ViewSets](https://bubaley.github.io/fastapi-ronin/viewsets/) - Learn about the core ViewSet concepts\n- [Schemas \u0026 Meta](https://bubaley.github.io/fastapi-ronin/schemas/) - Master schema generation and meta classes\n- [Permissions](https://bubaley.github.io/fastapi-ronin/permissions/) - Secure your APIs with permission classes\n- [Pagination](https://bubaley.github.io/fastapi-ronin/pagination/) - Implement efficient data pagination\n- [State Management](https://bubaley.github.io/fastapi-ronin/state/) - Manage request-scoped state\n- [Response Wrappers](https://bubaley.github.io/fastapi-ronin/wrappers/) - Format consistent API responses\n\n## 🤝 Community\n\nFastAPI Ronin is open source and welcomes contributions! Whether you're reporting bugs, suggesting features, or submitting pull requests, your involvement helps make the library better for everyone.\n\n- **GitHub**: [github.com/bubaley/fastapi-ronin](https://github.com/bubaley/fastapi-ronin)\n- **Issues**: Report bugs and request features\n- **Discussions**: Get help and share ideas\n\n## 📄 License\n\nFastAPI Ronin is released under the [MIT License](https://github.com/bubaley/fastapi-ronin/blob/main/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubaley%2Ffastapi-ronin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbubaley%2Ffastapi-ronin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbubaley%2Ffastapi-ronin/lists"}