Skip to content

Fintechain/gate-identity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gate-Identity

A comprehensive user management system for the FintechChain ecosystem that handles merchant management, authentication, authorization, and analytics. This service provides identity verification, API key management, role-based access control, and detailed payment behavior analytics for both platform and direct merchants.

Project Status

🚧 Under Active Development 🚧

This project is currently in the initial development phase. Core components are being implemented according to the project roadmap.

Architecture Overview

Gate-Identity is part of a service-based architecture that works alongside:

  1. fiat-onramp-core: Central orchestration service that manages user intents and orders
  2. payment-gateway: Handles payment processing and payment provider webhooks
  3. GateX: Frontend platform for merchant interactions and user interfaces

The Gate-Identity system follows Domain-Driven Design principles with a clean architecture that separates domain logic, application services, infrastructure, and interfaces.

Architecture Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  GateX           β”‚      β”‚  Gate-Identity  β”‚      β”‚  External       β”‚
β”‚  Frontend        │◀────▢│  Service        │─────▢│  Auth Services  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚                        
                                  β”‚                        
                                  β–Ό                        
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     
         β”‚                                          β”‚     
         β–Ό                                          β–Ό     
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Fiat-Onramp    β”‚                        β”‚  Payment        β”‚
β”‚  Core           β”‚                        β”‚  Gateway        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Features

  • Multi-Tiered Merchant Management: Support for both platform merchants (B2B2B) and direct merchants (B2B2C)
  • Authentication & Authorization: Secure login via email and Google OAuth with JWT tokens
  • API Key Management: Generation, validation, and rotation of API keys with fine-grained permissions
  • Role-Based Access Control: Flexible permission system for different user types
  • Rate Limiting & Pricing Plans: Configurable API usage limits and pricing tiers
  • Merchant Analytics: Detailed reporting on payment behaviors and API usage
  • Event-Driven Architecture: Real-time updates and processing via event streams
  • Secure Integration: Seamless connection with other FintechChain services

Getting Started

Prerequisites

  • Go 1.19 or later
  • Docker and Docker Compose
  • PostgreSQL 13 or later
  • Redis 6 or later
  • Kafka (for event processing)

Installation

  1. Clone the repository:

    git clone https://github.com/fintechain/gate-identity.git
    cd gate-identity
  2. Install dependencies:

    go mod download
  3. Build the services:

    make build
  4. Set up the environment:

    cp .env.example .env
    # Edit .env with your configuration
  5. Run the services:

    make run-api      # Run the API service
    make run-worker   # Run the background worker service

Development Setup

Local Development Environment

  1. Start the required infrastructure:

    make infra-up
  2. Run database migrations:

    make migrate-up
  3. Run tests:

    make test         # Run all tests
    make test-unit    # Run only unit tests
    make test-int     # Run integration tests
  4. Run linters:

    make lint

Development Workflow

  1. Create a feature branch from main
  2. Implement your changes following the project structure
  3. Add tests for your changes
  4. Run linters and tests locally
  5. Submit a pull request

Project Structure

The project follows Domain-Driven Design (DDD) principles with a clean architecture approach:

gate-identity/
β”œβ”€β”€ cmd/                               # Application entry points
β”‚   β”œβ”€β”€ api/                           # API service
β”‚   β”œβ”€β”€ worker/                        # Background worker service
β”‚   └── migrate/                       # Database migration tool
β”œβ”€β”€ configs/                           # Configuration files
β”œβ”€β”€ internal/                          # Private application code
β”‚   β”œβ”€β”€ domain/                        # Domain models and business logic
β”‚   β”‚   β”œβ”€β”€ identity/                  # Identity domain (users, roles, auth)
β”‚   β”‚   β”œβ”€β”€ merchant/                  # Merchant domain (config, API keys)
β”‚   β”‚   └── analytics/                 # Analytics domain (metrics, reports)
β”‚   β”œβ”€β”€ application/                   # Application services
β”‚   β”‚   β”œβ”€β”€ identity/                  # Identity services and DTOs
β”‚   β”‚   β”œβ”€β”€ merchant/                  # Merchant services and DTOs
β”‚   β”‚   └── analytics/                 # Analytics services and DTOs
β”‚   β”œβ”€β”€ infrastructure/                # Technical implementations
β”‚   β”‚   β”œβ”€β”€ persistence/               # Database repositories
β”‚   β”‚   β”œβ”€β”€ cache/                     # Caching implementation
β”‚   β”‚   β”œβ”€β”€ eventbus/                  # Event system implementation
β”‚   β”‚   └── external/                  # External service integrations
β”‚   └── interfaces/                    # External interfaces
β”‚       β”œβ”€β”€ api/                       # REST API implementation
β”‚       └── worker/                    # Worker processes
β”œβ”€β”€ pkg/                               # Public packages
β”‚   β”œβ”€β”€ validator/                     # Validation utilities
β”‚   β”œβ”€β”€ auth/                          # Authentication utilities
β”‚   └── env/                           # Environment configuration
β”œβ”€β”€ api/                               # API definitions
β”‚   └── rest/                          # REST API specs
β”œβ”€β”€ migrations/                        # Database migrations
β”œβ”€β”€ deployments/                       # Deployment configurations
β”œβ”€β”€ test/                              # Test helpers and fixtures
└── docs/                              # Documentation

Core Domains

The system is organized around three core domains:

Identity Domain

Manages users, authentication, sessions, roles, and permissions.

Merchant Domain

Handles merchant registration, configuration, API keys, rate limits, and pricing plans.

Analytics Domain

Processes transaction data, user activities, metrics calculations, and report generation.

API Documentation

API documentation is available in OpenAPI format at api/rest/openapi.yaml.

When the API service is running, you can access the Swagger UI at:

http://localhost:8080/swagger/

API Example

Registering a new merchant:

curl -X POST http://localhost:8080/api/v1/merchants \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "name": "Example Merchant",
    "email": "contact@example.com",
    "website": "https://example.com",
    "type": "DIRECT",
    "businessType": "ECOMMERCE",
    "contactPerson": {
      "name": "John Doe",
      "email": "john@example.com",
      "phone": "+1234567890"
    }
  }'

Integration with Other Services

Gate-Identity integrates with other FintechChain services:

  1. GateX Frontend: Provides authentication and merchant management APIs for the frontend
  2. Fiat-Onramp Core: Shares merchant information and validates API access
  3. Payment Gateway: Supplies transaction data for analytics processing

Deployment

Docker Deployment

Build and run with Docker Compose:

docker-compose up -d

Kubernetes Deployment

Deploy to Kubernetes:

kubectl apply -f deployments/kubernetes/

Detailed deployment documentation can be found in the docs/deployment/ directory.

Contributing

Contributions are welcome! Please read our Contributing Guidelines first.

Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages