A reusable library for microservices
Project description
🧩 Microservice Chassis Grupo 2
Repository link: https://github.com/Grupo-MACC/Chassis
Functionalities
This repository provides a shared chassis for microservices, containing configuration, database management, authentication, messaging, and helper utilities.
It allows microservices to reuse common functionalities such as database connections, JWT validation, RabbitMQ communication, and standardized base models.
Below is a detailed list of the available functionalities:
| Module | Functionality | Description |
|---|---|---|
core/config.py |
Settings Management | Centralized configuration for the chassis. Defines constants like the encryption algorithm (RS256), RabbitMQ connection parameters (RABBITMQ_HOST), and exchange name (broker). |
core/security.py |
Token Decoding and Verification | Handles JWT decoding using a public RSA key. Validates tokens and raises appropriate HTTP errors if invalid or missing. |
core/dependencies.py |
Database Session & Authentication Dependency | Provides FastAPI dependencies to manage asynchronous database sessions (get_db) and current user retrieval (get_current_user) from a JWT token. |
core/rabbitmq.py |
RabbitMQ Channel & Exchange Management | Creates asynchronous connections to RabbitMQ using aio_pika. Declares durable topic exchanges for inter-service communication. |
core/utils.py |
Helper Functions and Service URLs | Defines service URLs (order, machine, delivery, payment, auth) and provides error handling utilities with standardized logging (raise_and_log_error). |
sql/database.py |
Database Engine & Session Configuration | Configures SQLAlchemy’s asynchronous engine and sessionmaker. Supports SQLALCHEMY_DATABASE_URL via environment variable (defaults to SQLite). |
sql/base_class.py |
Base Model for ORM Classes | Provides a reusable abstract base class (BaseModel) for all database models, including timestamp columns (creation_date, update_date) and helper methods for converting models to dictionaries. |
Functionalities per Microservice
| Microservice | Used Functionalities |
|---|---|
payment |
core/config, core/security, core/dependencies, core/rabbitmq, core/utils, sql/database, sql/base_class |
Summary
This chassis allows the payment microservice (and potentially others in the future) to operate with consistent patterns for:
- Secure token validation.
- Standardized database access and sessions.
- Centralized configuration.
- RabbitMQ-based inter-service communication.
- Common helper utilities and error management.
- Unified base ORM models.
It provides a robust foundation for building scalable and maintainable microservices within the system.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microservice_chassis_grupo2_cc_prod-0.1.2.tar.gz.
File metadata
- Download URL: microservice_chassis_grupo2_cc_prod-0.1.2.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f24ca7dff2a213011833601aca9e99f326462fac0d33d905bf6d97b702cff47
|
|
| MD5 |
94b736fae5c83030e5a236ddba6c2eb6
|
|
| BLAKE2b-256 |
9e4cb3427be16c1176e969c25cd1e9502f5c2c67452f9ecdf44a998030da4918
|
File details
Details for the file microservice_chassis_grupo2_cc_prod-0.1.2-py3-none-any.whl.
File metadata
- Download URL: microservice_chassis_grupo2_cc_prod-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2914d79d7de6e9c12802830a58b4ea563c718ba11fd4ac11812230e0f048f0f
|
|
| MD5 |
68eadd5b88d0415921adeed2bcd1f4b0
|
|
| BLAKE2b-256 |
f55b621cd1fb1ba0487c7d657e60be38fd5d6fa2b18f17cc5566f76bbffff2e5
|