Building Real-time Web Applications with PynneX and FastAPI #19
nexconnectio
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've created three examples demonstrating how to build real-time web applications with FastAPI, using Python worker threads and event-driven patterns. Rather than fully replacing established solutions like Celery or Redis, this approach aims to offer a lighter alternative for scenarios where distributed task queues may be overkill. No locks, no manual concurrency headaches — just emitters in the worker and listeners on the main thread or other workers.
Why PynneX?
While there are several solutions for handling concurrent tasks in Python, each comes with its own trade-offs:
PynneX takes the proven emitter-listener pattern and makes it seamlessly work with asyncio for general Python applications:
For simpler scenarios where you just need clean thread communication without distributed task queues, PynneX provides a lightweight alternative.
🍓 1. Berry Checker (Basic)
A minimal example showing the core concepts:
Demo | View Code
📱 2. QR Code Generator (Intermediate)
Building on the basic concepts and adding:
Thread safety comes for free: the worker generates QR codes and emits them, the main thread listens and updates the UI. No manual synchronization needed.
Demo | View Code
📈 3. Stock Monitor (Advanced)
A full-featured example showcasing:
Demo | View Code
Quick Start
Clone repository
git clone https://github.com/nexconnectio/pynnex.git cd pynnex
Install dependencies
Run any example
Then open http://localhost:8000 in your browser.
Key Features
Technical Details
PynneX provides a lightweight layer for:
Built with:
Learn More
The examples above demonstrate how to build real-time web applications with clean thread communication patterns, without the complexity of traditional task queue systems.
Beta Was this translation helpful? Give feedback.
All reactions