saveinmed/backend/README.md

2 KiB

SaveInMed Backend API

This service handles the core business logic, data persistence, and external integrations for the SaveInMed B2B Marketplace.

🏗 Architecture

The backend follows a layered architecture to ensure separation of concerns and maintainability.

graph TD
    %% Clients
    Client([Client Application])
    
    %% Entry Point
    subgraph "API Layer"
        Router[Router / Middleware]
        AuthH[Auth Handler]
        UserH[User Handler]
        ProdH[Product Handler]
        CartH[Cart Handler]
        OrderH[Order Handler]
        PayH[Payment Handler]
        ShipH[Shipping Handler]
    end

    %% Business Logic
    subgraph "Service Layer"
        AuthS[Auth Service]
        UserS[User Service]
        ProdS[Catalog Service]
        OrderS[Order Service]
        PayS[Payment Service]
        ShipS[Shipping Service]
    end

    %% Data / Infra
    subgraph "Infrastructure Layer"
        DB[(PostgreSQL)]
        MP[Mercado Pago Adapter]
        Asaas[Asaas Adapter]
        Stripe[Stripe Adapter]
        Mapbox[Mapbox Service]
    end

    %% Flows
    Client --> Router
    Router --> AuthH
    Router --> UserH
    Router --> ProdH
    Router --> CartH
    Router --> OrderH
    Router --> PayH
    Router --> ShipH

    AuthH --> AuthS
    UserH --> UserS
    ProdH --> ProdS
    CartH --> OrderS
    OrderH --> OrderS
    PayH --> PayS
    ShipH --> ShipS

    AuthS --> DB
    UserS --> DB
    ProdS --> DB
    OrderS --> DB
    
    PayS --> MP
    PayS --> Asaas
    PayS --> Stripe
    
    ShipS --> Mapbox

    %% Styling
    style Client fill:#f9f,stroke:#333
    style Router fill:#ff9,stroke:#333
    style DB fill:#94a3b8,stroke:#333

🛠 Tech Stack

  • Language: Go 1.24+
  • Framework: Standard Library + Chi/Mux (inferred)
  • Database: PostgreSQL
  • Docs: Swagger/OpenAPI

🚀 Key Features

  • High-performance REST API
  • JWT Authentication
  • Role-Based Access Control
  • Payment Gateway Integration (Mercado Pago, Asaas, Stripe)
  • Real-time Inventory Management