Simple Securitiesis an imaginary and practical trading microservices system, built with Golang and advanced architecture styles such as Hexagonal Architecture, Domain Driven Design (DDD), CQRS, Event Sourcing, and Event Driven Architecture. It uses Kafka for messaging, gRPC + gRPC Gateway for service communication, and modern tooling for observability, configuration, and testing.
π‘ This project is designed as a reference implementation and technical playground, not a production-ready exchange.
π The application is in progress and evolves with new features and improvements.
- β Hexagonal Architecture (ports & adapters)
- β Domain Driven Design (DDD)
- β CQRS Pattern (Command Query Responsibility Segregation)
- β Event Sourcing (durable event store)
- β Event Driven Architecture with Kafka
- β Change Data Capture using Debezium + Kafka
- β gRPC for internal service communication
- β gRPC Gateway for HTTP/REST routing
- β Postgres & EventStoreDB for transactional writes (ACID)
- β MongoDB & ElasticSearch for read models (NoSQL, search)
- β Unit Testing with mocks using Mockery
- β Integration & End-to-End Testing with testcontainers-go
- β Zap structured logging
- β Viper configuration management
- β Docker & Docker Compose for local deployment
- π§ Kubernetes & Helm (future work)
- π core-service β manages users, wallets, and permissions
- π° crypto-service β handles crypto orders, real-time prices via websockets, margin, futures, and crypto portfolios
- π stock-service β manages stock orders, real-time stock prices, buy/sell operations, and stock portfolios
- π notification-service β push notifications, fetch by user or id
- π gateway-service β REST gateway using grpc-gateway for routing
- Language: Go 1.25.0
- Service Communication: gRPC + gRPC Gateway
- Messaging: Kafka
- CDC: Debezium β Kafka
- Databases:
- Postgres (write DB)
- EventStoreDB (event sourcing)
- MongoDB (read DB)
- ElasticSearch (search)
- Config: Viper
- Logging: Zap
- Testing: testify, mockery, testcontainers-go
- Deployment: Docker & Docker Compose
Hereβs a list of key libraries and tools used across services:
- gRPC β RPC communication between services
- grpc-gateway β REST β gRPC mapping
- protobuf β schema definitions
- Viper β configuration management
- Zap β structured logging
- Mockery β generating mocks for tests
- testify β unit testing assertions
- testcontainers-go β integration testing with real containers
- Postgres β relational DB for writes
- EventStoreDB β event sourcing store
- MongoDB β read DB (NoSQL)
- ElasticSearch β search engine
- Kafka β event streaming
- Debezium β change data capture
- Docker β containerization
- Docker Compose β local orchestration
- Air β live reload for Go
- Make β build automation
- Domain: aggregates, entities, domain events
- Application: commands, queries, handlers
- Adapters: persistence (Postgres, EventStoreDB), messaging (Kafka), transport (gRPC, HTTP)
- Commands mutate state, events are persisted in EventStoreDB
- Events are published to Kafka for other services
- Read models built asynchronously in MongoDB / ElasticSearch
- Debezium streams Postgres changes into Kafka
- Enables reliable read-model updates & audit logs
go test ./... -vMocks generated with mockery.
make test-integrationUses testcontainers-go to spin up real dependencies.
- Logging: Zap (structured, leveled)
- Tracing/Metrics: OpenTelemetry (Jaeger, Prometheus, Grafana)
- Dockerfiles per service (multi-stage builds)
docker-composefor local development- Future: Kubernetes + Helm
- Follow Conventional Commits
- Run
make format && make lintbefore commits - Add tests for new features
- Open issues for large changes
MIT License β see LICENSE
