Skip to content

Repository files navigation

Wallet Core + Balances Service

Event-driven wallet platform built as a Full Cycle challenge. A Go microservice owns accounts and transactions and publishes domain events to Kafka; a Laravel consumer keeps a read model of balances and exposes a query API.

Architecture

Client → Wallet Core (Go :8080) → Kafka (BalanceUpdated)
                                      ↓
                              Balances Service (Laravel :3003)
                                      ↓
                                   MySQL
Service Role Stack
Wallet Core Commands: clients, accounts, transactions Go, Chi, MySQL, Kafka producer
Balances Service Queries: account balances (read model) Laravel, Kafka consumer, MySQL
Kafka + Zookeeper Async event bus Confluent images
Control Center Kafka UI Port 9021

Prerequisites

  • Docker & Docker Compose

Quick start

git clone https://github.com/fellipesg/fc-eda-wallet-core.git
cd fc-eda-wallet-core
docker compose up -d
docker compose ps

Services:

Service URL
Wallet Core http://localhost:8080
Balances API http://localhost:3003
Kafka Control Center http://localhost:9021

Laravel migrations/seeders run on container startup.

API overview

Wallet Core (:8080)

Method Path Description
POST /clients Create client
POST /accounts Create account
POST /transactions Transfer between accounts (emits event)

Balances Service (:3003)

Method Path Description
GET /api/balances/{account_id} Get current balance

Example flow

# 1) Create a client
curl -s -X POST http://localhost:8080/clients \
  -H "Content-Type: application/json" \
  -d '{"name":"Jane Doe","email":"jane@email.com"}'

# 2) Create accounts (use returned client/account IDs)
curl -s -X POST http://localhost:8080/accounts \
  -H "Content-Type: application/json" \
  -d '{"client_id":"<client-id>"}'

# 3) Transfer
curl -s -X POST http://localhost:8080/transactions \
  -H "Content-Type: application/json" \
  -d '{"account_id_from":"<from>","account_id_to":"<to>","amount":50}'

# 4) Query read model
curl -s http://localhost:3003/api/balances/<account-id>

HTTP client files: api/client.http and balances-service/api/client.http.

Seeded sample accounts (after bootstrap) include account-1 / account-2 with demo balances.

Project layout

├── cmd/                 # Go entrypoints
├── internal/            # Wallet Core domain & application
├── pkg/
├── api/                 # HTTP examples for Wallet Core
├── balances-service/    # Laravel balances API + Kafka consumer
├── docker-compose.yaml
└── Dockerfile

Troubleshooting

docker compose logs balances-app
docker compose logs balances-kafka-consumer
docker compose logs kafka

# Reset (destroys volumes)
docker compose down -v

What this demonstrates

  • Event-Driven Architecture (EDA) with Kafka
  • CQRS-style separation (write service vs balance read model)
  • Polyglot microservices (Go + PHP/Laravel)
  • Docker Compose orchestration for local demos

License

Educational project — Full Cycle course challenge.

About

Event-driven wallet: Go write service + Laravel balances read model over Kafka (Full Cycle)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages