Skip to content

ntdat104/simple-securities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

64 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Simple Securities Microservices

Simple Securities is 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.


✨ Features

  • βœ… 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)

πŸ—οΈ Services

  • πŸ”‘ 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

πŸ› οΈ Tech Stack

  • 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

πŸ“š Technologies & Libraries

Here’s a list of key libraries and tools used across services:

πŸ”Ή Core Libraries

  • 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

πŸ”Ή Databases & Messaging

πŸ”Ή Dev & Ops


πŸ“ Architecture

Hexagonal Architecture

πŸ”Ή Hexagonal Architecture

  • Domain: aggregates, entities, domain events
  • Application: commands, queries, handlers
  • Adapters: persistence (Postgres, EventStoreDB), messaging (Kafka), transport (gRPC, HTTP)

πŸ”Ή CQRS & Event Sourcing

  • Commands mutate state, events are persisted in EventStoreDB
  • Events are published to Kafka for other services
  • Read models built asynchronously in MongoDB / ElasticSearch

πŸ”Ή Change Data Capture (CDC)

  • Debezium streams Postgres changes into Kafka
  • Enables reliable read-model updates & audit logs

πŸ§ͺ Testing

Unit Tests

go test ./... -v

Mocks generated with mockery.

Integration & E2E Tests

make test-integration

Uses testcontainers-go to spin up real dependencies.


πŸ“Š Observability

  • Logging: Zap (structured, leveled)
  • Tracing/Metrics: OpenTelemetry (Jaeger, Prometheus, Grafana)

🐳 Deployment

  • Dockerfiles per service (multi-stage builds)
  • docker-compose for local development
  • Future: Kubernetes + Helm

🀝 Contributing

  1. Follow Conventional Commits
  2. Run make format && make lint before commits
  3. Add tests for new features
  4. Open issues for large changes

πŸ“œ License

MIT License β€” see LICENSE

About

🦎 Simple Securities is an imaginary and practical trading microservices system, built with Golang and advanced architecture. It uses Kafka for messaging, gRPC + gRPC Gateway for service communication, and modern tooling for observability, configuration, and testing.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages