saveinmed/backend
2026-01-01 15:43:33 -03:00
..
cmd feat(web): redesign login page, fix search bug and enhance seeder 2025-12-23 18:34:46 -03:00
docs feat(phase2): implement Trust, Safety & Financials 2025-12-27 01:56:32 -03:00
internal Add config helper tests 2026-01-01 15:43:33 -03:00
.env test: add automated tests for admin login 2025-12-22 00:31:26 -03:00
.env.example feat(backend): switch auth to username and cleanup db config 2025-12-21 23:04:47 -03:00
.gitignore chore: refactor backend config, unignore .env, update config loading 2025-12-20 10:10:55 -03:00
api feat(backend): switch auth to username and cleanup db config 2025-12-21 23:04:47 -03:00
BACKEND.md docs: add b2b gaps roadmap and test matrix 2026-01-01 15:20:48 -03:00
Dockerfile docs: add DEVOPS guide and optimize Dockerfiles 2025-12-29 17:00:42 -03:00
go.mod fix(backoffice): repair build errors, update prisma schema and services 2025-12-29 19:07:31 -03:00
go.sum fix(backend): properly load .env file manually in config.go 2025-12-22 09:47:17 -03:00
main feat(phase2): implement Trust, Safety & Financials 2025-12-27 01:56:32 -03:00
README.md docs: add b2b gaps roadmap and test matrix 2026-01-01 15:20:48 -03:00

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

🧪 Tests

go test ./... -cover

Para matriz completa (com/sem banco e Playwright), veja: docs/TESTES.md