Skip to content

gathigai/dtb

Repository files navigation

Local Setup Instructions

This project consists of several microservices managed via Docker Compose. The main services are:

  • discovery-service (Eureka)
  • authorization-service
  • profile-service
  • store-value-service
  • payments-service
  • events-service
  • gateway-service
  • Supporting services: postgres, rabbitmq, redis

Prerequisites

  • Docker
  • Docker Compose
  • Java 17+ (for local development outside Docker)
  • Maven (for building services locally)

Running All Services with Docker Compose

  1. Clone the repository (if you haven't already):

    git clone <your-repo-url>
    cd DTB
  2. Build the services (optional, Docker Compose will build if not already built):

    docker-compose build
  3. Start all services:

    docker-compose up

    This will start all microservices, databases, and supporting infrastructure.

  4. Accessing Services:

    Each microservice is exposed on its respective port (see docker-compose.yml for details).

  5. Stopping Services:

    docker-compose down

Running a Single Service Locally

  1. Start dependencies with Docker Compose, but exclude the service you want to run locally:

    docker-compose up postgres rabbitmq redis discovery-service
  2. In a new terminal, navigate to the service directory and run:

    mvn spring-boot:run

    Make sure to set the appropriate Spring profile (e.g., local or compose).

Environment Variables

  • Database, Redis, RabbitMQ, and Eureka URLs are set in docker-compose.yml and application-compose.yml for each service.
  • For local development, check each service's application.yml for port and profile settings.

Troubleshooting

  • If ports are already in use, stop conflicting services or change the ports in docker-compose.yml.
  • For database issues, ensure Docker volumes are cleared if you want a fresh start.

Demo Users

Username Password Email Phone User Type Gender Public ID
system.administrator admin@gathigai.com 0721111111 SYSTEM_USER MALE 7070fe44-7efd-4384-8c5b-ff79422eb01e
tester1 tester1@gathigai.com 0721111112 CUSTOMER MALE (auto-generated or see DB)
tester2 tester2@gathigai.com 0721111113 CUSTOMER FEMALE (auto-generated or see DB)
tester3 tester3@gathigai.com 0721111114 CUSTOMER FEMALE (auto-generated or see DB)

Note: The public ID for system.administrator is explicitly set in the code as 7070fe44-7efd-4384-8c5b-ff79422eb01e. Other users have their public IDs generated automatically and can be found in the database after initialization.

Registration Endpoint (Authorization/Profile Service)

  • POST /users
    • Request Body: UserDto (see UserRestController)
    • Example:
      {
        "user": {
          "username": "tester1",
          "password": "yourpassword",
          "email": "tester1@gathigai.com"
        }
      }

Store Value Service Endpoints

  • Topup (Deposit funds):
    POST /accounts/{publicId}/topup
    Body: { "amount": ... }
  • Withdraw (Withdraw funds):
    POST /accounts/{publicId}/withdraw
    Body: { "amount": ... }
  • Check Balance:
    GET /accounts/{publicId}/balance
  • Search User Accounts:
    GET /accounts?user={userPublicId}

All endpoints require authentication (JWT token in the Authorization header).


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published