Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microservice_chassis_grupo2-2.0.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microservice_chassis_grupo2-2.0.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file microservice_chassis_grupo2-2.0.0.tar.gz.

File metadata

File hashes

Hashes for microservice_chassis_grupo2-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1c5c411b366f78c06b8f3bc6473fde3a8825fb6aea5fb0a01f012de39f72a65f
MD5 70f357b6d56865fa615324df3f03d335
BLAKE2b-256 9de77515bc715144d2901b7a78f4b02cd6837d7c1ba3d82633caff973fd0824e

See more details on using hashes here.

File details

Details for the file microservice_chassis_grupo2-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for microservice_chassis_grupo2-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea5577f361271dc5a1fe6744cb91f43d9bcae35008aee56a516dbb0f8097f125
MD5 0679d2cc90ca3af3c704758767998168
BLAKE2b-256 27b057d21dfb687c6cb1b7820d6439341aac1703f2c7837b63316b0d0c8d56c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page