Skip to main content

Distributed Chat Backend with Redundancy

Python Version PyPI version License

This project is a Python-based backend designed to handle message storage in a database and ensure high availability and redundancy through communication between multiple backend instances using message queues (RabbitMQ).

⚙️ Key Features

  • 💬 Stores incoming chat messages in a relational database.
  • 🔁 Redundancy and synchronization across multiple backend instances.
  • 🕸️ Inter-process communication using RabbitMQ.
  • 🔐 Horizontally scalable architecture.
  • 🚀 Ready for deployment in Docker/Kubernetes environments.

🧱 High-Level Architecture

+-----------+       +-------------+       +-----------+
| Frontend  | <---> |  Backend A  | <---> |  Backend B |
+-----------+       +-------------+       +-----------+
                        ↑   ↓                  ↑   ↓
                      [RabbitMQ] <----------> [RabbitMQ]
                        ↑   ↓                  ↑   ↓
                      [Database]            [Database]

All backend instances are synchronized via message queues, allowing for load distribution and consistency.


🚀 Installation

  1. Clone the repository:

    git clone https://github.com/AbelGRubio/backend-chat.git
    cd backend-chat
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Create a .env file with the required variables (RabbitMQ, DB, etc.)


▶️ Running the App

python src

Or with FastAPI and Uvicorn:

uvicorn src.back_chat:app --host 0.0.0.0 --port 8000

🛠 Required Environment Variables

RABBITMQ_URL=amqp://user:password@rabbitmq:5672/
DATABASE_URL=postgresql://user:password@localhost:5432/chat
INSTANCE_ID=backend-a

✅ Requirements

  • Python 3.12+
  • RabbitMQ
  • PostgreSQL (or equivalent)
  • Docker (optional but recommended)

Docker

Backend Chat


🧪 Tests

Pending integration of automatic tests using pytest.


🤝 Contributing

Contributions, suggestions, and issues are welcome! Feel free to open a PR or issue.


🪪 License

This project is licensed under the MIT License.


✨ Author

Abel G. Rubio
GitHub: @AbelGRubio

Metadata

Release files for back-chat 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for back-chat 1.1.5
File Size Uploaded Provenance
back_chat-1.1.5.tar.gz 20.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for back-chat 1.1.5
File Interpreter ABI Platform
back_chat-1.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 43.9 kB

Release files / back_chat-1.1.5.tar.gz

Download URL back_chat-1.1.5.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e3abb7a49c0b60af26b6b7fa7733c5187c37ac6d64f1e5e7759be3a7f29107ee
BLAKE2b-256 checksum
How to use checksums
d0629b35b8293bed0e388f0b46cc65de7979d5d3f3b72e926d0b525acb3f9951
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Release files / back_chat-1.1.5-py3-none-any.whl

Download URL back_chat-1.1.5-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c9a452e01d51dce0b16c13d46e261ca38058a6c5277c434789904e8f49bf5a5
BLAKE2b-256 checksum
How to use checksums
a3adb9375589879c808a1e2bb52299ba6abd0744a6b45343c27acf9fb26f4066
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.11

Security for back-chat 1.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page