Skip to content

BitKa-Exchange/bitka-exchange

Repository files navigation

Bitka Backend Logo

Bitka Exchange (Backend Core)

Microservices cryptocurrency exchange
Built with Golang Fiber, Kafka, and PostgreSQL.

Go Fiber Architecture License


Caution

This software is an educational research project.

We are NOT affiliated, associated, authorized, endorsed by, or in any way officially connected with Bitkub Online Co., Ltd. or any of its subsidiaries.

This software is not intended for production financial use. No real assets are handled. (For the live demo we'll use testnet tokens only.)


📖 Overview

Bitka Exchange is a proof-of-concept centralized crypto exchange (CEX) designed to handle high-concurrency trading with strict double-entry accounting.

Key Features

  • Atomic Accounting: Double-entry ledger system preventing race conditions and negative balances.
  • Event-Driven: Asynchronous communication via Apache Kafka for scalability.
  • High Performance: In-memory matching engine (coming soon) and internal communication via gRPC.
  • Secure: RS256 JWT Authentication with strict role-based access control (RBAC).
  • Clean Architecture: Strict separation of concerns (Domain, Usecase, Repository, Delivery).

Note

We also have other repositories that you might want to check them out at Bitka Exchange GitHub Organization.


🏗️ System Architecture

The system is composed of decoupled microservices communicating via gRPC for synchronous and Kafka for asynchronous. In the end we plan to deploy hybrid using K3s but for now it's on docker in on-premises with 1 PostgreSQL instance as container (still logically separate database for each service).

c4 container diagram

🛠️ Tech Stack

Component Technology Description
Language Golang 1.24+ -
Framework Fiber v2 High-performance HTTP web framework
Database PostgreSQL 18 Primary persistence
Logging Zerolog Structured logging
ORM GORM Data access layer
Authentication JWT (RS256) User identity & access control
Internal Communication gRPC & Protobuf Synchronous inter-service communication
Messaging Apache Kafka Event streaming
Gateway Traefik Reverse proxy & load balancing
Containerization Docker & Docker Compose Containerization & local orchestration
CI/CD GitHub Actions Automated testing (WIP) & deployment
API Docs OpenAPI 3.0.3 API Contract & Specifications
Docs UI Docusaurus React framework markdown based docs

📂 Project Structure Overview

For more details, see Bitka online docs or Markdown file.

bitka/
├── docs/                 # OpenAPI & AsyncAPI (WIP) specifications
├── deploy/               # Deployment configurations
├── pkg/                  # Shared libraries (Logger, JWT, Middleware, Etc.)
├── portal/               # Docusaurus documentation site
├── services/
│   ├── auth/             # Authentication & User Management
│   ├── user/             # User data & Profile Management
│   ├── ledger/           # Wallet, Assets, & Double-Entry Accounting
│   ├── order/            # Order Management System
│   ├── matching/         # Order Matching Engine
│   └── market/           # Market Data Aggregation
├── compose.yml           # Local development stack
├── Makefile              # Build & Run commands
└── go.work               # Go Workspace configuration


🚀 Getting Started

Prerequisites

  • Docker & Docker Compose
  • Make
  • Node.js (optionally, for docs site)

1. Clone the Repository

git clone https://github.com/BitKa-Exchange/bitka-exchange.git
cd bitka-exchange

2. Set Up Environment Variables

Copy the template .env.template to .env and adjust any necessary variables.

3. Start Local Development Stack

make docker-dev

4. Access API Documentation

You can test the APIs using the interactive docs once the services are running.

cd portal
npm install
cd ..
make docs # at root folder

🧪 Testing (Planned)

We plan to implement unit and integration tests on necessary part for each service. But we will focus on integration/e2e testing to allocate time more on other aspect of the project.

Currently, we are interested in Testcontainer for integration/e2e tests. And K6 for load testing.


🤝 Contributing

We welcome contributions from students and anyone who want to learn together! Because this project purpose is mainly for creating environment for learning and research in each person's area of interest, and combine everyone's work to build a complete system.

Right now, we don't have a formal contribution guide yet, only some developer guidelines at Docs. If you want to contribute, feel free to open issues or pull requests.

Note

I also encourage you to reach out to me directly first if you want the experience of team collaboration - @14two-77

About

Bitkub Clone project for learning

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •