{"id":13705483,"url":"https://github.com/Tioit-Wang/sanic-rest-framework","last_synced_at":"2025-05-05T16:33:03.431Z","repository":{"id":38408011,"uuid":"486488822","full_name":"Tioit-Wang/sanic-rest-framework","owner":"Tioit-Wang","description":"API rapid development framework for SANIC, Inspired by Django REST Framework.","archived":false,"fork":false,"pushed_at":"2024-06-21T08:57:00.000Z","size":3445,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-13T13:38:16.276Z","etag":null,"topics":[],"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/Tioit-Wang.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":"2022-04-28T07:23:05.000Z","updated_at":"2024-08-28T15:49:23.000Z","dependencies_parsed_at":"2024-06-22T00:52:46.579Z","dependency_job_id":"1a869de5-934b-4dc0-af3f-85366f377b4d","html_url":"https://github.com/Tioit-Wang/sanic-rest-framework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tioit-Wang%2Fsanic-rest-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tioit-Wang%2Fsanic-rest-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tioit-Wang%2Fsanic-rest-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tioit-Wang%2Fsanic-rest-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tioit-Wang","download_url":"https://codeload.github.com/Tioit-Wang/sanic-rest-framework/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252534041,"owners_count":21763710,"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":[],"created_at":"2024-08-02T22:00:42.282Z","updated_at":"2025-05-05T16:33:02.224Z","avatar_url":"https://github.com/Tioit-Wang.png","language":"Python","funding_links":[],"categories":["Extensions"],"sub_categories":["API"],"readme":"# Sanic Rest Framework (SRF) \n\n[Chinese](https://github.com/Tioit-Wang/sanic-rest-framework/blob/main/README_CN.md)\n\nSRF is born to provide a highly unified framework for Sanic Web framework, similar to Django + DRF.\n\nIf you are troubled by the following issues, you should start using SRF immediately:\n- Writing repetitive code for each simple CRUD interface.\n- Repeatedly validating the input and output values of each interface to comply with specific rules.\n- Familiar with the Django ecosystem but puzzled by various Sanic plugins.\n- Still manually implementing various login authentication, permission control, API rate limiting, and API caching.\n- Frustrated by poor ORM plugin support.\n\n## Features\n- **Supports OpenAPI v3.0**: Offers a standalone SwaggerUi, supports customized API documentation, providing a pleasant experience with minimal code.\n- **ClassView-first interface design**: Supports 95% of CRUD needs, achieving login authentication, permission control, API rate limiting, and API caching through configuration.\n- **Rapid development tools**: Provides project-helper for rapid development and organizing project structure.\n- **Highly available serialization tools**: Similar to DRF's serializers and fields.\n- **Comprehensive support for Tortoise ORM**: Deeply integrated with Tortoise ORM.\n- **Complete documentation**: Project documentation is available in both Chinese and English [Chinese](https://tioit.cc/docs/SanicSRF/start) [English](https://tioit.cc/docs/SanicSRF/en/start)\n\n## Requirements\n- **Sanic**: Latest version 21.6\n- **Tortoise ORM**: Latest version\n- **orjson**: Latest version\n\nWe strongly recommend and officially support only the latest patch versions of the Sanic and Tortoise ORM series.\n\n## Installation\n\nInstall using `pip`:\n\n```bash\npip install sanic-rest-framework # Old\n\n# latest version\ngit clone https://github.com/Tioit-Wang/sanic-rest-framework.git\ncd sanic-rest-framework\npip install -e .\n```\n\nAdd `SRFRequest` when initializing your Sanic application:\n\n```python\nfrom sanic import Sanic\nfrom rest_framework.request import SRFRequest\n\napp = Sanic(name='your app name', request_class=SRFRequest)\n```\n\n## Simple Example\n\nYou can check out the [example on Github](https://github.com/Tioit-Wang/srf_simple_example) or open the example in [Web VSCode](https://vscode.dev/github/Tioit-Wang/srf_simple_example).\n\n```python\nfrom sanic import Sanic\nfrom sanic.response import json\nfrom rest_framework.views import APIView\nfrom rest_framework.request import SRFRequest\n\napp = Sanic(\"SampleApp\", request_class=SRFRequest)\n\nclass HelloWorldView(APIView):\n    def get(self, request):\n        return json({'hello': 'world'})\n\napp.add_route(HelloWorldView.as_view(), '/')\n\nif __name__ == \"__main__\":\n    app.run(host=\"0.0.0.0\", port=8000)\n```\n\n## Project Plan\n\n- ✅ Support for tortoise-orm\n- ✅ Serializer for any data source\n- ✅ Model serializer\n- ✅ Basic fields for serializers\n- ✅ Complex serializer fields\n- ✅ Field validators\n- ✅ Permission validation\n- ✅ Authentication\n- ✅ API views\n- ✅ Generic views\n- ✅ Model views\n- ✅ Throttling\n- ✅ Pagination\n- ✅ Unit tests\n- ❌ Low code intrusion\n- ❌ Support for GINO-orm\n- ❌ Cache views\n\n## Project Template\n\n......","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTioit-Wang%2Fsanic-rest-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTioit-Wang%2Fsanic-rest-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTioit-Wang%2Fsanic-rest-framework/lists"}