DevInsider Backend Service is a microservices-based backend system built with Go and Fiber framework. It serves as the central API gateway for a developer marketplace platform connecting ISVs, investors, and partner programs.
┌─────────────────────────────────────────────────────────────────────────┐
│ External Clients │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐ │
│ │ Web App │ │ Mobile App │ │ Partner │ │ External │ │
│ │ (Frontend) │ │ │ │ Services │ │ Webhooks │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └──────┬──────┘ │
└─────────┼──────────────────┼──────────────────┼──────────────────┼───────┘
│ │ │ │
└──────────────────┴──────────────────┴──────────────────┘
│
HTTPS/REST API
│
┌────────────────────────────────────┼───────────────────────────────────┐
│ ▼ │
│ DevInsider Backend Service (Go/Fiber) │
│ │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ HTTP Layer (Fiber) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────────────┐ │ │
│ │ │ CORS │ │ Logger │ │ Recover │ │ Static Files │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └─────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼───────────────────────────────┐ │
│ │ Route Groups │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ │
│ │ │ Public │ │ Private │ │ Service │ │ Webhooks/Email │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼───────────────────────────────┐ │
│ │ Middleware Layer │ │
│ │ ┌────────────────────┐ ┌──────────────────────────────┐ │ │
│ │ │ Auth Middleware │ │ Page Access Middleware │ │ │
│ │ │ - JWT Validation │ │ - Company Page Access │ │ │
│ │ │ - Role Checks │ │ - Permission Verification │ │ │
│ │ │ - Keycloak Auth │ └──────────────────────────────┘ │ │
│ │ └────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼───────────────────────────────┐ │
│ │ Controller Layer │ │
│ │ ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌────────┐ ┌─────────┐ │ │
│ │ │ User │ │ Company │ │ Investor │ │Program │ │Matching │ │ │
│ │ └─────────┘ └─────────┘ └──────────┘ └────────┘ └─────────┘ │ │
│ │ ┌─────────┐ ┌─────────┐ ┌──────────┐ │ │
│ │ │ Billing │ │Webhooks │ │ Odoo │ │ │
│ │ └─────────┘ └─────────┘ └──────────┘ │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼───────────────────────────────┐ │
│ │ Service Layer │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌────────────┐ │ │
│ │ │ Domain │ │ External │ │ Message │ │ │
│ │ │ Services │ │ Service │ │ Queue │ │ │
│ │ │ │ │ Adapters │ │ Services │ │ │
│ │ │ - User │ │ - Keycloak │ │ - Email │ │ │
│ │ │ - Company │ │ - Payment │ │ - Matching │ │ │
│ │ │ - Investor │ │ - Matching │ │ - Odoo │ │ │
│ │ │ - Program │ │ │ │ - Billing │ │ │
│ │ │ - Matching │ │ │ │ │ │ │
│ │ │ - Billing │ │ │ │ │ │ │
│ │ │ - Criteria │ │ │ │ │ │ │
│ │ │ - Blacklist │ │ │ │ │ │ │
│ │ └─────────────┘ └─────────────┘ └────────────┘ │ │
│ │ │ │
│ │ ┌──────────────────┐ ┌──────────────────────────────────┐ │ │
│ │ │ Redis Service │ │ RabbitMQ Service │ │ │
│ │ │ - Caching │ │ - Publisher Management │ │ │
│ │ │ - Distributed │ │ - Queue/Exchange Setup │ │ │
│ │ │ Locking │ └──────────────────────────────────┘ │ │
│ │ └──────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼───────────────────────────────┐ │
│ │ Repository Layer (GORM) │ │
│ │ ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌────────┐ ┌─────────┐ │ │
│ │ │ User │ │ Company │ │ Investor │ │Program │ │Criteria │ │ │
│ │ │ Repo │ │ Repo │ │ Repo │ │ Repo │ │ Repo │ │ │
│ │ └─────────┘ └─────────┘ └──────────┘ └────────┘ └─────────┘ │ │
│ │ ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌────────┐ │ │
│ │ │Favorite │ │Blacklist│ │Invitation│ │Subscrip│ │ │
│ │ │ Repo │ │ Repo │ │ Repo │ │ Repo │ │ │
│ │ └─────────┘ └─────────┘ └──────────┘ └────────┘ │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ Dependency Injection (Google Wire) │ │
│ │ config/injector.go → config/wire_gen.go │ │
│ └─────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
│
┌────────────────────────────┼────────────────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ PostgreSQL │ │ Redis │ │ RabbitMQ │
│ │ │ │ │ │
│ - Users │ │ - Token Cache │ │ - Email Queue │
│ - Companies │ │ - Session Data │ │ - Matching Queue │
│ - Investors │ │ - Distributed │ │ - Odoo Queues │
│ - Programs │ │ Locks │ │ - Billing Queue │
│ - Matching │ │ │ │ - Unlock Events │
│ - Billing │ │ │ │ │
└───────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
└────────────────────────────┼────────────────────────────┘
│
▼
┌───────────────────────┐
│ External Services │
│ │
│ ┌─────────────────┐ │
│ │ Keycloak │ │
│ │ (Auth/Identity) │ │
│ └─────────────────┘ │
│ │
│ ┌─────────────────┐ │
│ │ Payment Service │ │
│ │ (via Kong GW) │ │
│ └─────────────────┘ │
│ │
│ ┌─────────────────┐ │
│ │Matching Service │ │
│ │ (via Kong GW) │ │
│ └─────────────────┘ │
│ │
│ ┌─────────────────┐ │
│ │ Odoo │ │
│ │ (CRM) │ │
│ └─────────────────┘ │
└───────────────────────┘
The application follows a clean architecture pattern with clear separation of concerns:
┌──────────────────────────────────────────────────────────┐
│ Presentation Layer │
│ (Controllers + Routes + Middleware) │
│ • HTTP request handling │
│ • Request validation │
│ • Response formatting │
│ • Authentication/Authorization │
└────────────────────┬─────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────┐
│ Business Layer │
│ (Services) │
│ • Business logic implementation │
│ • Orchestration of multiple repositories │
│ • External service integration │
│ • Message queue publishing │
│ • Caching strategies │
└────────────────────┬─────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────┐
│ Data Layer │
│ (Repositories) │
│ • Database operations (GORM) │
│ • Query construction │
│ • Transaction management │
│ • Data mapping │
└────────────────────┬─────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────┐
│ Persistence Layer │
│ (Database + Cache + Queue) │
│ • PostgreSQL (primary data store) │
│ • Redis (caching + distributed locks) │
│ • RabbitMQ (async messaging) │
└──────────────────────────────────────────────────────────┘
┌─────────┐
│ Client │
└────┬────┘
│ 1. HTTP Request (JWT in Header)
▼
┌─────────────────────────────────────────┐
│ Fiber HTTP Server │
│ • CORS Middleware │
│ • Logger Middleware │
│ • Recover Middleware │
└────┬────────────────────────────────────┘
│ 2. Route Matching
▼
┌─────────────────────────────────────────┐
│ Auth Middleware │
│ • Extract JWT Token │
│ • Validate Signature │
│ • Parse Claims (UserID, Roles, etc) │
│ • Store in Context │
└────┬────────────────────────────────────┘
│ 3. Authorization Check
▼
┌─────────────────────────────────────────┐
│ Role/Permission Middleware │
│ • Check User Roles │
│ • Verify Page Access (if needed) │
│ • Return 403 if unauthorized │
└────┬────────────────────────────────────┘
│ 4. Handle Request
▼
┌─────────────────────────────────────────┐
│ Controller │
│ • Parse Request Body/Params │
│ • Validate Input │
│ • Call Service Layer │
│ • Format Response │
└────┬────────────────────────────────────┘
│ 5. Execute Business Logic
▼
┌─────────────────────────────────────────┐
│ Service │
│ • Implement business rules │
│ • Call multiple repositories │
│ • Interact with external services │
│ • Publish to message queues │
│ • Handle caching │
└────┬────────────────────────────────────┘
│ 6. Data Operations
▼
┌─────────────────────────────────────────┐
│ Repository │
│ • Execute GORM queries │
│ • Handle transactions │
│ • Return domain models │
└────┬────────────────────────────────────┘
│ 7. Database Query
▼
┌─────────────────────────────────────────┐
│ PostgreSQL │
└────┬────────────────────────────────────┘
│ 8. Query Results
│
▼
(Return through layers)
│
▼
┌─────────┐
│ Client │ ◄── JSON Response
└─────────┘
┌──────────────────────────────────────────────────────────────┐
│ main.go │
│ │
│ 1. Load .env file │
│ 2. Initialize synchro_v2 │
│ 3. Call config.Init() ──────────────────┐ │
│ 4. Initialize route.Init(config) │ │
│ 5. Start cron jobs │ │
│ 6. Initialize RabbitMQ publisher │ │
│ 7. Start Fiber server │ │
└──────────────────────────────────────────┼───────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────┐
│ config/injector.go │
│ (Wire Definitions) │
│ │
│ Define Provider Sets: │
│ • Database Connection (ConnectToDB) │
│ • Redis Connection (ConnectToRedisDB) │
│ • All Repository Sets │
│ • All Service Sets │
│ • All Controller Sets │
│ • All Middleware Sets │
│ │
│ Wire.Build() composes all dependencies │
└──────────────────────────────────────────┼───────────────────┘
│
Generate at compile time
│
▼
┌──────────────────────────────────────────────────────────────┐
│ config/wire_gen.go │
│ (Auto-Generated by Wire) │
│ │
│ func Init() *Initialization { │
│ db := ConnectToDB() │
│ rdb := ConnectToRedisDB() │
│ userRepo := userRepository.Init(db) │
│ userService := userService.Init(userRepo, ...) │
│ userController := userController.Init(userService, ...) │
│ ... │
│ return &Initialization{...} │
│ } │
└──────────────────────────────────────────┼───────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────┐
│ config/init.go │
│ (Initialization Struct Definition) │
│ │
│ Holds all initialized components: │
│ • AuthMiddleware │
│ • PageAccessMiddleware │
│ • UserController │
│ • CompanyController │
│ • ProgramController │
│ • InvestorController │
│ • ... and more │
└──────────────────────────────────────────┼───────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────┐
│ app/route/route.go │
│ (Route Configuration) │
│ │
│ Uses initialized components to set up routes: │
│ • api.Group("/public") │
│ • api.Group("/private", auth.Middleware) │
│ • api.Group("/service", auth.Middleware, roleCheck) │
│ • webhooks.Group("/keycloak", webhookGuard) │
│ │
│ Returns configured Fiber app │
└──────────────────────────────────────────────────────────────┘
┌──────────────┐
│ Client │
└──────┬───────┘
│ Request ISV-Program Matching
▼
┌─────────────────────────────┐
│ IsvProgramMatchingController│
└──────┬──────────────────────┘
│
▼
┌─────────────────────────────┐
│ IsvProgramMatchingService │
│ • Fetch user criteria │
│ • Build matching request │
│ • Call external matching │
│ • Process results │
│ • Publish to RabbitMQ │
└──────┬──────────────────────┘
│
├─────────────┐
│ │
▼ ▼
┌─────────────┐ ┌──────────────────┐
│ Criteria │ │ Matching Service │
│ Repository │ │ (External) │
└─────────────┘ └────────┬─────────┘
│
▼
┌─────────────────┐
│ RabbitMQ │
│ Matching Queue │
└─────────────────┘
┌──────────────────┐
│ Domain Action │
│ (User/Company/ │
│ Program/etc) │
└────────┬─────────┘
│
▼
┌──────────────────────────────┐
│ Domain Service │
│ • Create/Update/Delete │
│ • Call Odoo RabbitMQ Svc │
└────────┬─────────────────────┘
│
▼
┌──────────────────────────────┐
│ Odoo RabbitMQ Service │
│ • Format Odoo payload │
│ • Publish to exchange │
└────────┬─────────────────────┘
│
▼
┌──────────────────────────────┐
│ RabbitMQ │
│ • odoo_user_queue │
│ • odoo_company_queue │
│ • odoo_program_queue │
│ • odoo_investor_queue │
│ • odoo_program_member_queue │
└────────┬─────────────────────┘
│
▼
┌──────────────────────────────┐
│ Odoo Consumer │
│ (External Service) │
│ • Process queue messages │
│ • Update Odoo CRM │
└──────────────────────────────┘
┌──────────────┐
│ Keycloak │ User Event (login, update, etc)
└──────┬───────┘
│ POST /webhooks/keycloak
│ X-Keycloak-Signature Header
▼
┌─────────────────────────────┐
│ Webhook Signature Guard │
│ • Validate signature │
│ • Check X_KEYCLOAK_SIGNATURE│
└──────┬──────────────────────┘
│
▼
┌─────────────────────────────┐
│ KeycloakWebhookController │
│ • Parse event payload │
│ • Route to handler │
└──────┬──────────────────────┘
│
▼
┌─────────────────────────────┐
│ KeycloakWebhookService │
│ • Process user events │
│ • Sync with local DB │
│ • Update user state │
└─────────────────────────────┘
┌──────────────────────────────────────────────────────────┐
│ Cache Layers │
│ │
│ ┌────────────────────────────────────────────────┐ │
│ │ Application Level (Service Layer) │ │
│ │ • User profile cache │ │
│ │ • Token validation cache │ │
│ │ • Frequently accessed data │ │
│ └─────────────────┬──────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────────────┐ │
│ │ Redis Service │ │
│ │ • Key-Value Store │ │
│ │ • TTL-based expiration │ │
│ │ • Pattern: "cache:<entity>:<id>" │ │
│ └────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────┐ │
│ │ Distributed Locking │ │
│ │ • Redis Lock Service │ │
│ │ • Prevents race conditions │ │
│ │ • Used for critical operations │ │
│ └────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────┐
│ RabbitMQ Message Flows │
│ │
│ Publishers (Backend Service) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Email │ │ Matching │ │ Odoo │ │
│ │ Service │ │ Service │ │ Services │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ RabbitMQ Exchanges │ │
│ │ • mail.exchange.direct │ │
│ │ • devinsider_matching.exchange.direct │ │
│ │ • user_updates_exchange │ │
│ │ • odoo_company.exchange.direct │ │
│ │ • odoo_program.exchange.direct │ │
│ │ • odoo_investor.exchange.direct │ │
│ │ • odoo_program_member.exchange.direct │ │
│ │ • odoo_verified_pro.exchange.direct │ │
│ │ • odoo_contact_support.exchange.direct │ │
│ │ • devinsider_billing.exchange.direct │ │
│ │ • unlock.exchange.fanout │ │
│ └─────────────────┬───────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ RabbitMQ Queues │ │
│ │ • mail_service_queue │ │
│ │ • devinsider_matching_queue │ │
│ │ • odoo_user_queue │ │
│ │ • odoo_company_queue │ │
│ │ • odoo_program_queue │ │
│ │ • odoo_investor_queue │ │
│ │ • odoo_program_member_queue │ │
│ │ • odoo_verified_pro_queue │ │
│ │ • odoo_contact_support_queue │ │
│ │ • devinsider_billing_queue │ │
│ └─────────────────┬───────────────────────────────┘ │
│ │ │
│ ▼ │
│ Consumers (External Services) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Mail Svc │ │ Matching Svc │ │ Odoo Sync │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└──────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ GitLab CI/CD Pipeline │
│ │
│ preprod branch ──► deploy-on-preprod │
│ │ │
│ ▼ │
│ ┌──────────────┐ │
│ │ Ansible │ │
│ │ Playbooks │ │
│ └──────┬───────┘ │
└──────────────────────────┼─────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Preprod Environment │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Docker Compose Stack │ │
│ │ │ │
│ │ ┌────────────────────┐ ┌──────────────────────┐ │ │
│ │ │ di-backend-service│ │ di-backend-db │ │ │
│ │ │ (Go Application) │ │ (PostgreSQL) │ │ │
│ │ │ Port: 8081:8080 │ │ Port: 5441:5432 │ │ │
│ │ └────────────────────┘ └──────────────────────┘ │ │
│ │ │ │ │ │
│ │ └────────┬───────────────┘ │ │
│ │ │ │ │
│ │ ┌─────────────────▼─────────────────────────────┐ │ │
│ │ │ microservice_network (external) │ │ │
│ │ │ • Connects to Redis (preprod_redis) │ │ │
│ │ │ • Connects to RabbitMQ (preprod_rabbitmq) │ │ │
│ │ │ • Connects to Kong Gateway (preprod_kong) │ │ │
│ │ └───────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ Volumes: │ │
│ │ • ./public/upload/ ──► Container uploads │ │
│ │ • ./static/ ──► Container static files │ │
│ │ • db-data ──► PostgreSQL persistence │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Security Layers │
│ │
│ Layer 1: Network Security │
│ ┌────────────────────────────────────────────────────┐ │
│ │ • CORS Configuration (whitelist origins) │ │
│ │ • HTTPS enforcement │ │
│ │ • API Gateway (Kong) for external services │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ Layer 2: Authentication │
│ ┌────────────────────────────────────────────────────┐ │
│ │ • JWT Token validation │ │
│ │ • Keycloak integration (SSO) │ │
│ │ • Token signature verification │ │
│ │ • Webhook signature validation │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ Layer 3: Authorization │
│ ┌────────────────────────────────────────────────────┐ │
│ │ • Role-based access control (RBAC) │ │
│ │ - RoleIsv │ │
│ │ - RoleInvestor │ │
│ │ - RoleService │ │
│ │ • Page-level access control │ │
│ │ • Resource ownership verification │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ Layer 4: Data Security │
│ ┌────────────────────────────────────────────────────┐ │
│ │ • Environment variable encryption │ │
│ │ • Database connection pooling │ │
│ │ • SQL injection prevention (GORM) │ │
│ │ • Input validation │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ Layer 5: Application Security │
│ ┌────────────────────────────────────────────────────┐ │
│ │ • Panic recovery middleware │ │
│ │ • Request size limits (100MB) │ │
│ │ • Request logging │ │
│ │ • Blacklist management │ │
│ └────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
| Layer | Technology |
|---|---|
| Web Framework | Go Fiber v2 |
| Database | PostgreSQL (GORM) |
| Cache | Redis |
| Message Queue | RabbitMQ |
| Auth/Identity | Keycloak |
| Dependency Injection | Google Wire |
| Scheduled Jobs | go-co-op/gocron |
| API Gateway | Kong |
| Deployment | Docker Compose + Ansible |
| CI/CD | GitLab CI |