{"id":23197123,"url":"https://github.com/capellax02/microbank","last_synced_at":"2025-10-25T13:31:45.098Z","repository":{"id":269873681,"uuid":"908701778","full_name":"CAPELLAX02/MicroBank","owner":"CAPELLAX02","description":"A banking project following microservices architecture built with Spring Boot; employing Docker, Spring Security, Spring Cloud, OpenFeign, RabbitMQ, Keycloak, Redis, PostgreSQL, MinIO, and more.","archived":false,"fork":false,"pushed_at":"2025-01-26T20:15:41.000Z","size":1113,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T21:20:37.730Z","etag":null,"topics":["docker","docker-compose","event-driven-architecture","keycloak","microservices-architecture","minio","openfeign","postgresql","rabbitmq","rbac","redis","smtp-server","spring-cloud","spring-security-oauth2"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CAPELLAX02.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-26T18:24:29.000Z","updated_at":"2025-01-26T20:15:44.000Z","dependencies_parsed_at":"2024-12-26T20:22:43.101Z","dependency_job_id":"7e6ed6c5-d6d1-439c-841d-7e447f020092","html_url":"https://github.com/CAPELLAX02/MicroBank","commit_stats":null,"previous_names":["capellax02/microbank"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAPELLAX02%2FMicroBank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAPELLAX02%2FMicroBank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAPELLAX02%2FMicroBank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CAPELLAX02%2FMicroBank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CAPELLAX02","download_url":"https://codeload.github.com/CAPELLAX02/MicroBank/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238152330,"owners_count":19425076,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","event-driven-architecture","keycloak","microservices-architecture","minio","openfeign","postgresql","rabbitmq","rbac","redis","smtp-server","spring-cloud","spring-security-oauth2"],"created_at":"2024-12-18T14:28:04.432Z","updated_at":"2025-10-25T13:31:44.617Z","avatar_url":"https://github.com/CAPELLAX02.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MicroBank\n\n## Introduction\n\n### Overview of MicroBank\nMicroBank is a modern, scalable, and secure banking backend system built using microservice architecture. It enables account management, financial transactions, document generation, and notification services while ensuring robust authentication and authorization mechanisms through Keycloak.\n\n### Why Microservices?\nMicroservices provide modularization, independent scalability, and better maintainability. Each service in MicroBank is responsible for a specific business capability, allowing independent development and deployment.\n\n### Project Architecture Diagram\n\u003cimg src=\"./diagrams/microbank-diagram.png\"\u003e\n\n### Key Features\n- **Microservice Architecture**: Independent services for authentication, account management, transactions, documents, and notifications.\n- **Event-Driven Communication**: RabbitMQ for asynchronous messaging between services.\n- **Secure Authentication \u0026 Authorization**: Keycloak OAuth2 integration.\n- **Scalable Storage Solutions**: PostgreSQL, Redis, and MinIO.\n- **Containerized Deployment**: Docker and Docker Compose for environment consistency.\n\n## Getting Started\n\n### Prerequisites\nBefore running MicroBank, ensure you have the following installed:\n- **Java 17** or higher\n- **Maven (latest version)**\n- **Docker \u0026 Docker Compose**\n- **Postman (optional, for API testing)**\n\n### Running the Project\nMicroBank services must be started in a specific order:\n\n1. **Start infrastructure services (databases, Keycloak, Redis, RabbitMQ, MinIO)**:\n   ```sh\n   docker-compose up -d\n   ```\n2. **Start Discovery Service first (to enable service registration)**:\n   ```sh\n   mvn spring-boot:run -f discovery/pom.xml\n   ```\n3. **Start remaining microservices (auth, account, transaction, document, notification, and API gateway)**\n   ```sh\n   mvn spring-boot:run -f auth/pom.xml\n   mvn spring-boot:run -f account/pom.xml\n   mvn spring-boot:run -f transaction/pom.xml\n   mvn spring-boot:run -f document/pom.xml\n   mvn spring-boot:run -f notification/pom.xml\n   mvn spring-boot:run -f apigateway/pom.xml\n   ```\n\n### Postman Collection\nA **Postman Collection** is provided in the `./postman` directory to facilitate API testing.\n1. Import `MicroBank API Collection.postman_collection.json` into Postman.\n2. Set environment variables like `baseURL = http://localhost:8123/api/v1`.\n3. Run API requests seamlessly.\n\n### Keycloak Configuration\nKeycloak authentication is pre-configured in the project with a realm export file (`./keycloak-config/realm-export.json`).\n- Access Keycloak Admin UI: [http://localhost:9098](http://localhost:9098)\n- Default admin credentials: `admin / admin`\n- **Important:** After Keycloak starts, manually reset `client-secret` values in **Clients → microbank-client \u0026 admin-cli** and update them in `./auth/src/main/resources/application.yml`.\n\n## Project Architecture\n\n### Microservices Overview\nThe backend consists of multiple independent microservices:\n\n- **API Gateway**: Routes all requests, handles authentication.\n- **Auth Service**: Manages user authentication and token handling.\n- **Account Service**: Manages bank accounts and balances.\n- **Transaction Service**: Handles money transfers between accounts.\n- **Document Service**: Generates and stores transaction receipts.\n- **Notification Service**: Sends email notifications for important events.\n- **Discovery Service**: Service registry using Eureka for dynamic service discovery.\n\n### Service Communication\n- **Synchronous Communication**: OpenFeign is used for inter-service REST API calls.\n- **Asynchronous Communication**: RabbitMQ queues for event-driven messaging.\n\n### Database \u0026 Storage Solutions\n- **PostgreSQL**: Persistent storage for Auth, Account, Transaction, and Document services.\n- **Redis**: Temporary storage for authentication-related data (password reset, activation codes).\n- **MinIO**: Object storage for transaction receipts.\n\n## Database Access\nTo access the PostgreSQL databases and perform administrative tasks, you can use the following commands:\n\n**Auth Database (auth_db)**\n```shell\npsql -U auth_db -d auth_db -h localhost -p 5431\n```\n(Default `auth_db` password: **auth_db**)\n\n**Account Database (account_db)**\n```shell\npsql -U account_db -d account_db -h localhost -p 5430\n```\n(Default `account_db` password: **account_db**)\n\n**Transaction Database (transaction_db)**\n```shell\npsql -U transaction_db -d transaction_db -h localhost -p 5433\n```\n(Default `transaction_db` password: **transaction_db**)\n\n**Document Database (document_db)**\n```shell\npsql -U document_db -d document_db -h localhost -p 5434\n```\n(Default `document_db` password: **document_db**)\n\n## Identity \u0026 Access Management\n\n### Keycloak Integration\n- **OAuth2 \u0026 OpenID Connect**: Secure authentication and token-based authorization.\n- **Role-Based Access Control (RBAC)**: User roles (`USER`, `ADMIN`) managed by Keycloak.\n\n### Authentication \u0026 Authorization Flow\n1. **User Registration \u0026 Activation**\n    - Users register via `/api/v1/auth/register`.\n    - Activation code is sent via email.\n    - User activates the account via `/api/v1/auth/activate`.\n2. **Login \u0026 Token Handling**\n    - Users log in via `/api/v1/auth/login`, obtaining an **access token** and **refresh token**.\n    - Token validation occurs at the **API Gateway**.\n3. **API Gateway (AuthN) \u0026 Microservices (AuthZ)**\n    - API Gateway validates tokens and forwards requests.\n    - Microservices enforce authorization using Spring Security.\n\n## Endpoint Examples\nAll API endpoints are structured under `http://localhost:8123/api/v1/`.\n\n| Service       | Endpoint Example | Description |\n|--------------|----------------|-------------|\n| **Auth** | `/auth/login` | User authentication |\n| **Auth** | `/auth/register` | User registration |\n| **Account** | `/accounts` | Get user accounts |\n| **Transaction** | `/transactions` | Create and list transactions |\n| **Document** | `/documents/{transactionId}` | Retrieve transaction documents |\n| **Notification** | Internal | Listens to RabbitMQ events |\n\n### Standardized API Response\nAll API responses follow a uniform structure:\n```json\n{\n  \"status\": 200,\n  \"message\": \"Success message\",\n  \"data\": {},\n  \"timestamp\": \"2025-02-01T12:00:00.000Z\",\n  \"errors\": null\n}\n```\n\n## Service Order \u0026 Dependencies\n1. **Start infrastructure** (databases, Keycloak, Redis, RabbitMQ, MinIO) **first**\n2. **Start Discovery Service**\n3. **Start Microservices**\n4. **Start API Gateway last**\n\n## Contributing\nContributions are welcome! To contribute:\n1. Fork the repository.\n2. Create a feature branch.\n3. Submit a pull request.\n\nFor any questions, open an issue or reach out to the project maintainers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapellax02%2Fmicrobank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapellax02%2Fmicrobank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapellax02%2Fmicrobank/lists"}