{"id":34032094,"url":"https://github.com/bielgomes/fastipy","last_synced_at":"2026-03-10T18:02:52.836Z","repository":{"id":175676221,"uuid":"590539821","full_name":"Bielgomes/fastipy","owner":"Bielgomes","description":"⚡| Fastipy is a fast, very simple to use and understand open source python library for developing RESTful APIs","archived":false,"fork":false,"pushed_at":"2024-11-05T02:25:31.000Z","size":1118,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-15T09:17:54.466Z","etag":null,"topics":["api","python","restful","uvicorn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"luisviniciuslv/PyForgeAPI","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bielgomes.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}},"created_at":"2023-01-18T16:42:58.000Z","updated_at":"2025-08-25T21:04:25.000Z","dependencies_parsed_at":"2024-04-12T19:51:48.329Z","dependency_job_id":null,"html_url":"https://github.com/Bielgomes/fastipy","commit_stats":null,"previous_names":["bielgomes/pyforgeapi","bielgomes/fastipy"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Bielgomes/fastipy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bielgomes%2Ffastipy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bielgomes%2Ffastipy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bielgomes%2Ffastipy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bielgomes%2Ffastipy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bielgomes","download_url":"https://codeload.github.com/Bielgomes/fastipy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bielgomes%2Ffastipy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30346480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","python","restful","uvicorn"],"created_at":"2025-12-13T18:36:14.312Z","updated_at":"2026-03-10T18:02:52.817Z","avatar_url":"https://github.com/Bielgomes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fastipy\n\n\u003cdiv\u003e\n  \u003cimg src=\"https://i.imgur.com/KCi8IUS.png\"\u003e\n\u003c/div\u003e\n\n[![CI](https://github.com/Bielgomes/fastipy/actions/workflows/pipeline.yaml/badge.svg)](https://github.com/Bielgomes/fastipy/actions/workflows/pipeline.yaml)\n[![codecov](https://codecov.io/gh/Bielgomes/fastipy/graph/badge.svg?token=AF45LFYAP2)](https://codecov.io/gh/Bielgomes/fastipy)\n[![PyPI version](https://badge.fury.io/py/fastipy.svg)](https://badge.fury.io/py/fastipy)\n\n## What is it and what is it for\n\n[Fastipy](https://pypi.org/project/Fastipy/) is a fast and easy-to-use open source Python library for developing RESTful APIs.\n\nPowered by **[uvicorn](https://www.uvicorn.org/)**\n\n## Installation\n\n```bash\npip install fastipy\n```\n\n## Examples\n\n### Example for GET Route with Query Params\n\n```py\nfrom fastipy import Fastipy, Request, Reply\n\napp = Fastipy()\n\n# Routes can be async or sync functions, but reply send functions are async\n# The handler returns the default HTTP status code 200\n@app.get(\"/\")\ndef home(req: Request, _):\n  # Get query params age\n  age = req.query[\"age\"]\n  # Example: Recovery all persons from database with this age and print the html\n  print(\"\u003ch1\u003eRetrieving all persons\u003c/h1\u003e\u003cul\u003e\u003cli\u003eA Person\u003c/li\u003e\u003c/ul\u003e\")\n```\n\n### Example for GET Route with Params, CORS and multiple methods\n\n```py\nfrom fastipy import Fastipy, Request, Reply\n\napp = Fastipy().cors()\n\n@app.get(\"/user/:id\")\n@app.post(\"/user/:id\")\nasync def getUser(req: Request, reply: Reply):\n  # get users from database\n  for i in users:\n    if i[\"id\"] == req.params[\"id\"]:\n      # All response functions are asynchronous\n      return await reply.send(i)\n\n  await reply.send_code(404)\n```\n\n### Example for POST Route with Body\n\n```py\nfrom fastipy import Fastipy, Request, Reply\n\napp = Fastipy()\n\n@app.post(\"/user\")\nasync def createUser(req: Request, reply: Reply):\n  user = req.body.json\n  # Save user in database\n  await reply.code(201).send(\"Created\")\n```\n\n### Example for PUT Route with Body\n\n```py\nfrom fastipy import Fastipy, Request, Reply\n\napp = Fastipy()\n\n@app.put(\"/user\")\nasync def createUser(req: Request, reply: Reply):\n  user = req.body.json\n  # Update user in database\n  await reply.type(\"text/html\").code(201).send(\"\u003ch1\u003eCreated\u003c/h1\u003e\")\n```\n\n### Example for GET Route with file stream\n\n```py\nfrom fastipy import Fastipy, Request, Reply\n\napp = Fastipy()\n\n@app.get(\"/stream\")\nasync def streamFile(_, reply: Reply):\n  # It could be an asynchronous generator\n  def generator():\n    with open(\"file.txt\") as f:\n        for line in f:\n            yield line\n\n  await reply.send(generator())\n```\n\n### Adding custom serializer to Reply send\n\n```py\nfrom fastipy import Fastipy, Request, Reply\n\napp = Fastipy()\n\napp.add_serializer(\n    validation=lambda data: isinstance(data, str),\n    serializer=lambda data: (\"application/json\", json.dumps({\"error\": data})),\n)\n\n@app.get(\"/\")\nasync def customSerializer(_, reply: Reply):\n    await reply.code(404).send(\"Field not found\")\n```\n\n### Running\n\nRunning Fastipy application in development is easy\n\n```py\nimport uvicorn\n\nif __name__ == \"__main__\":\n  # main:app indicates the FILE:VARIABLE\n\n  # The file is the main file where Fastipy() is instantiated\n  # The variable is the name of the variable that contains the instance of Fastipy()\n\n  # You can find more configurations here https://www.uvicorn.org/\n\n  # set reload to True for automatic reloading!\n  uvicorn.run(\"main:app\", log_level=\"debug\", port=8000, reload=True, loop=\"asyncio\")\n```\n\n### See more examples in **[examples](https://github.com/Bielgomes/Fastipy/tree/main/examples)** folder\n\n## Creating plugins\n\n```py\n# chat.py\nfrom fastipy import FastipyInstance, Reply\n\n# Plugins can be asynchronous or synchronized functions\n# Plugins have access to the main instance, which means they can use all of Fastipy's functions\ndef chatRoutes(app: FastipyInstance, options: dict):\n  @app.get(\"/\")\n  async def index(_, reply: Reply):\n    await reply.send_code(200)\n\n  @app.get(\"/chat\")\n  async def test(_, reply: Reply):\n    await reply.send_code(200)\n```\n\n```py\n# message.py\nfrom fastipy import FastipyInstance, Reply\n\nasync def messageRoutes(app: FastipyInstance, options: dict):\n  @message.get(\"/\")\n  async def index(_, reply: Reply):\n    await reply.send_code(200)\n\n  @message.get(\"/message\")\n  async def test(_, reply: Reply):\n    await reply.send_code(200)\n\n  app.name(\"custom plugin name\")\n```\n\n```py\n# main.py\nfrom fastipy import Fastipy\n\nfrom message import messageRoutes\nfrom chat import chatRoutes\n\napp = Fastipy().cors()\n\napp.register(messageRoutes, {\"prefix\": \"/message\"})\napp.register(chatRoutes, {\"prefix\": \"/chat\"})\n```\n\n## Hooks\n\n```py\nfrom fastipy import Fastipy, Request, Reply\n\napp = Fastipy()\n\n# The preHandler hook is called before the request handler\n@app.hook(\"preHandler\")\ndef preHandler(req: Request, reply: Reply):\n  print(\"onRequest hook\")\n\n# The onRequest hook is called when the request is handled\n@app.hook(\"onRequest\")\ndef onRequest(req: Request, reply: Reply):\n  print(\"onRequest hook\")\n\n# The onResponse hook is called when the reply sends a response\n@app.hook(\"onResponse\")\ndef onResponse(req: Request, reply: Reply):\n  print(\"onResponse hook\")\n\n# The onError hook is called when an error occurs\n@app.hook(\"onError\")\ndef onError(error: Exception, req: Request, reply: Reply):\n  print(f\"onError hook exception: {error}\")\n\n# A hook will only be linked to a route if its declaration precedes the route\n# The order of hooks of the same type is important\n@app.get(\"/\")\nasync def index(_, reply: Reply):\n  await reply.send_code(200)\n```\n\n## End to End tests\n\n```py\n# See more in https://www.starlette.io/testclient/\nfrom fastipy import TestClient\nfrom main import app\n\nclient = TestClient(app)\n\nresponse = client.post(\"/\")\nassert response.status_code == 200\nassert response.text == \"Hello World\"\n```\n\n# Application Deploy\n\nFor production deployment, please refer to this **[uvicorn guide](https://www.uvicorn.org/deployment/)**.\n\n# Change Log\n\n## Version 1.5.4\n\n### Todo\n\n### Added\n\n- [X] CI with Github Actions.\n- [X] Code Coverage with Codecov.\n\n### Changed\n\n- [X] Change the routes handler to use the Raw Path instead of the Path (This Change allow the use of %20 %2F and other special characters in the path).\n- [X] Improve functionality to handle asynchronous functions in synchronous environments (This change probably fix Memory Leak in the Fastipy).\n\n### Fixed\n\n- [X] Fix the bug in the search route where special characters are not being URL-escaped.\n\n# Contributors\n\n\u003ca href=\"https://github.com/Bielgomes/Fastipy/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=Bielgomes/Fastipy\"/\u003e\n\u003c/a\u003e\n\n## How to Contributing\n\nOpen pull request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbielgomes%2Ffastipy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbielgomes%2Ffastipy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbielgomes%2Ffastipy/lists"}