{"id":34674656,"url":"https://github.com/matheusvnm/fastpubsub","last_synced_at":"2026-05-05T00:05:38.137Z","repository":{"id":315446233,"uuid":"1029007380","full_name":"matheusvnm/fastpubsub","owner":"matheusvnm","description":"  FastPubSub is a FastAPI-based, high-performance, and easy-to-use Python framework for building asynchronous event stream consumers on Google PubSub.","archived":false,"fork":false,"pushed_at":"2026-01-12T19:24:08.000Z","size":940,"stargazers_count":4,"open_issues_count":8,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2026-01-13T00:43:10.331Z","etag":null,"topics":["async","distributed-systems","fastapi","framework","gcp","json-schema","openapi","pubsub","pydantic","python","rest","uvicorn","web"],"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/matheusvnm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-07-30T11:38:10.000Z","updated_at":"2026-01-12T19:19:57.000Z","dependencies_parsed_at":"2025-10-18T04:39:46.625Z","dependency_job_id":null,"html_url":"https://github.com/matheusvnm/fastpubsub","commit_stats":null,"previous_names":["matheusvnm/fastpubsub"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/matheusvnm/fastpubsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvnm%2Ffastpubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvnm%2Ffastpubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvnm%2Ffastpubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvnm%2Ffastpubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matheusvnm","download_url":"https://codeload.github.com/matheusvnm/fastpubsub/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvnm%2Ffastpubsub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28476938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T03:02:43.018Z","status":"ssl_error","status_checked_at":"2026-01-16T03:01:27.857Z","response_time":107,"last_error":"SSL_read: 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":["async","distributed-systems","fastapi","framework","gcp","json-schema","openapi","pubsub","pydantic","python","rest","uvicorn","web"],"created_at":"2025-12-24T20:01:07.400Z","updated_at":"2026-02-08T19:04:26.853Z","avatar_url":"https://github.com/matheusvnm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docs.fastpubsub.dev\"\u003e\u003cimg src=\"https://docs.fastpubsub.dev/assets/images/logo.png\" alt=\"FastPubSub\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eA high-performance, asyncio-native framework for Google Cloud Pub/Sub applications.\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/matheusvnm/fastpubsub/actions/workflows/pr_tests.yaml?query=branch%3Adev\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/matheusvnm/fastpubsub/actions/workflows/pr_tests.yaml/badge.svg?query=branch%3Adev\" alt=\"Quality Checks\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pepy.tech/projects/fastpubsub\"\u003e\n    \u003cimg src=\"https://static.pepy.tech/personalized-badge/fastpubsub?period=monthly\u0026units=INTERNATIONAL_SYSTEM\u0026left_color=GREY\u0026right_color=BRIGHTGREEN\u0026left_text=Downloads\" alt=\"PyPI Downloads\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/fastpubsub\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/fastpubsub?color=%2334D058\u0026label=pypi%20package\" alt=\"PyPI\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/fastpubsub\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/fastpubsub.svg?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\n**Documentation**: \u003ca href=\"https://docs.fastpubsub.dev\" target=\"_blank\"\u003ehttps://docs.fastpubsub.dev\u003c/a\u003e\n\n**Source Code**: \u003ca href=\"https://github.com/matheusvnm/fastpubsub\" target=\"_blank\"\u003ehttps://github.com/matheusvnm/fastpubsub\u003c/a\u003e\n\n---\n\n## Features\n\n\nFastPubSub is a modern, high-performance framework for building modern applications that process event messages on Google PubSub. It combines the standard PubSub Python SDK with FastAPI, Pydantic and Uvicorn to provide an easy-to-use development experience.\n\nThe key features are:\n\n- **Fast:** FastPubSub is (unironically) fast. It's built on top of [**FastAPI**](https://fastapi.tiangolo.com/), [**uvicorn**](https://uvicorn.dev/) and [**Google PubSub Python SDK**](https://github.com/googleapis/python-pubsub) for maximum performance.\n- **Intuitive**: It is designed to be intuitive and easy to use, even for beginners.\n- **Typed**: Provides a great editor support and less time reading docs.\n- **Robust**: Get production-ready code with sensible default values helping you avoid common pitfalls.\n- **Asynchronous:** It is built on top of asyncio, which allows it to run on fully asynchronous code.\n- **Batteries Included**: Provides its own CLI and other widely used tools such as [**pydantic**](https://docs.pydantic.dev/) for data validation and log contextualization.\n\n\n\n## Quick Start\n\n### Installation\n\nFastPubSub works on Linux, macOS, Windows and most Unix-style operating systems. You can install it with pip as usual:\n\n```shell\npip install fastpubsub\n```\n\n### Writing your first application\n\n**FastPubSub** brokers provide convenient function decorators (`@broker.subscriber`) and methods (`broker.publisher`) to allow you to delegate the actual process of:\n\n- Creating Pub/Sub subscriptions to receive and process data from topics.\n- Publishing data to other topics downstream in your message processing pipeline.\n\nThese decorators make it easy to specify the processing logic for your consumers and producers, allowing you to focus on the core business logic of your application without worrying about the underlying integration.\n\nAlso, **Pydantic**’s [`BaseModel`](https://docs.pydantic.dev/usage/models/) class allows you to define messages using a declarative syntax for sending messages downstream, making it easy to specify the fields and types of your messages.\n\nHere is an example Python app using **FastPubSub** that consumes data from an incoming data stream and outputs two messages to another one:\n\n\n```python\n# basic.py\n\nfrom pydantic import BaseModel, Field\nfrom fastpubsub import FastPubSub, PubSubBroker, Message\nfrom fastpubsub.logger import logger\n\nclass Address(BaseModel):\n    street: str = Field(..., examples=[\"5th Avenue\"])\n    number: str = Field(..., examples=[\"1548\"])\n\n\nbroker = PubSubBroker(project_id=\"some-project-id\")\napp = FastPubSub(broker)\n\n@broker.subscriber(\n    alias=\"my_handler\",\n    topic_name=\"in_topic\",\n    subscription_name=\"sub_name\",\n)\nasync def handle_message(message: Message):\n   logger.info(f\"The message {message.id} is processed.\")\n   await broker.publish(topic_name=\"out_topic\", data=\"Hi!\")\n\n   address = Address(street=\"Av. Flores\", number=\"213\")\n   await broker.publish(topic_name=\"out_topic\", data=address)\n```\n\n\n\n### Running the application\n\nBefore running the command make sure to set one of the variables (mutually exclusive):\n\n1. **Running PubSub on Cloud**: The environment variable  `GOOGLE_APPLICATION_CREDENTIALS` with the path of the service-account on your system.\n2. **Running PubSub Emulator**: The environment variable `PUBSUB_EMULATOR_HOST` with `host:port` of your local PubSub emulator.\n\n\n---\n\nAfter that, the application can be started using built-in **FastPubSub** CLI which is a core part of the framework.\n\nTo run the service, use the **FastPubSub** embedded CLI. Just execute the command ``run`` and pass the module (in this case, the file where the app implementation is located) and the app symbol to the command.\n\n```bash\nfastpubsub run basic:app\n```\n\nAfter running the command, you should see the following output:\n\n\n``` shell\n2025-10-13 15:23:59,550 | INFO     | 97527:133552019097408 | runner:run:55 | FastPubSub app starting...\n2025-10-13 15:23:59,696 | INFO     | 97527:133552019097408 | tasks:start:74 | The handle_message handler is waiting for messages.\n```\n\nAlso, **FastPubSub** provides you with a great hot reload feature to improve your development experience\n\n``` shell\nfastpubsub run basic:app --reload\n```\n\nAnd multiprocessing horizontal scaling feature as well:\n\n``` shell\nfastpubsub run basic:app --workers 3\n```\n\nWe just scratched the surface, but you already get the idea of how a basic structure works. Everything developed into FastPubSub is though to improve software development experience and provide great productivity with high-performance garantees.\n\n## Contact\n\nFeel free to get in touch by:\n\nSending a email at sandro-matheus@hotmail.com.\n\nSending a message on my [linkedin](https://www.linkedin.com/in/matheusvnm).\n\n\n## License\nThis project is licensed under the terms of the Apache 2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusvnm%2Ffastpubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatheusvnm%2Ffastpubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusvnm%2Ffastpubsub/lists"}