Getting Started

This guide will help you set up the development environment and start working on the GitiNext backend.


๐Ÿ“‹ Prerequisites

Required:

  • Go 1.25+ - Download
  • Docker - Install
  • Docker Compose - Usually included with Docker
  • Git - Version control
  • PostgreSQL 15 (or via Docker)
  • Redis 7 (or via Docker)
  • GoLand or VS Code - IDE with Go support
  • buf - Protocol buffer tooling
  • psql - PostgreSQL client
  • Redis CLI - Redis client

๐Ÿš€ Quick Start (5 minutes)

Step 1: Clone the Repository

cd /opt/cryptotel/enterprise/stacks/gitinext
git clone <repository-url> gitinext-golang
cd gitinext-golang

Step 2: Install Dependencies

# Initialize Go workspace
go work sync

# Download all dependencies
go mod download

# Install buf for protobuf
go install github.com/bufbuild/buf/cmd/buf@latest

Step 3: Start Infrastructure

# Start database and cache
docker-compose up -d postgres redis minio

# Wait for PostgreSQL to be ready
sleep 5

# Run migrations
cd services/wallet && go run cmd/migrator/main.go
cd ../..

Step 4: Run a Service

# Run wallet service
cd services/wallet
go run cmd/server/main.go

# In another terminal, run gateway
cd services/gateway
go run cmd/main.go

Step 5: Test the Service

# Health check
curl http://localhost:7080/health

# Create a test wallet (via gRPC or HTTP)
curl -X POST http://localhost:7080/api/v1/wallet/hd \
  -H "Content-Type: application/json" \
  -d '{
    "telegram_id": "123456789",
    "network": "TON",
    "wallet_type": "internal"
  }'

๐Ÿ“ Project Structure

gitinext-golang/
โ”œโ”€โ”€ docs/                          # Documentation (you are here!)
โ”œโ”€โ”€ services/                      # Microservices
โ”‚   โ”œโ”€โ”€ gateway/                   # API gateway (HTTP/gRPC)
โ”‚   โ”œโ”€โ”€ wallet/                    # Wallet service
โ”‚   โ”œโ”€โ”€ watcher/                   # Blockchain watchers
โ”‚   โ”œโ”€โ”€ account/                   # User accounts
โ”‚   โ”œโ”€โ”€ market/                    # Market data
โ”‚   โ”œโ”€โ”€ transaction/               # Transactions
โ”‚   โ”œโ”€โ”€ payment/                   # Payment gateways
โ”‚   โ”œโ”€โ”€ voucher/                   # Voucher systems
โ”‚   โ”œโ”€โ”€ support/                   # Support tickets
โ”‚   โ””โ”€โ”€ kyc/                       # KYC verification
โ”œโ”€โ”€ packages/                      # Shared libraries
โ”‚   โ”œโ”€โ”€ logger/                    # Logging
โ”‚   โ”œโ”€โ”€ metrics/                   # Prometheus metrics
โ”‚   โ”œโ”€โ”€ database/                  # DB helpers
โ”‚   โ”œโ”€โ”€ errors/                    # Error handling
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ shared-schema/                 # Protobuf definitions
โ”‚   โ”œโ”€โ”€ proto/                     # .proto files
โ”‚   โ””โ”€โ”€ proto-gen/go/              # Generated Go code
โ”œโ”€โ”€ gitibot-back-main/             # Legacy Node.js (reference)
โ”œโ”€โ”€ docker-compose.yaml            # Local development
โ””โ”€โ”€ Makefile                       # Build commands

๐Ÿ› ๏ธ Development Workflow

Daily Workflow:

# 1. Pull latest changes
git pull origin main

# 2. Update dependencies
go mod download

# 3. Work on your feature/service
cd services/wallet
vim internal/wallet/service/signer/ton_signer.go

# 4. Run tests
go test ./...

# 5. Run service locally
go run cmd/server/main.go

# 6. Check logs
tail -f /var/log/wallet-service.log

# 7. Commit changes
git add .
git commit -m "Task 0.1: Implement TON signer"
git push

๐Ÿงช Testing

Run All Tests:

# From project root
make test

# Or manually
cd services/wallet && go test ./...

Run Specific Tests:

go test -v -run TestTONSigner ./internal/wallet/service/signer/

Integration Tests:

# Requires running services
make test-integration

๐Ÿณ Docker Development

Start All Services:

docker-compose up -d

View Logs:

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f wallet

Rebuild Service:

docker-compose up -d --build wallet

Stop Everything:

docker-compose down

๐Ÿ“Š Database Management

Access Database:

# Via Docker
docker-compose exec postgres psql -U postgres -d wallet_core

# Direct connection
psql -h localhost -p 5432 -U postgres -d wallet_core

Run Migrations:

cd services/wallet
go run cmd/migrator/main.go

View Tables:

-- List all tables
\dt

-- Describe table
\d wallets

-- View indexes
\di

๐Ÿ” Debugging

Enable Debug Logging:

export LOG_LEVEL=debug
go run cmd/server/main.go

Use pprof for Profiling:

# Service exposes pprof on port 6060
go tool pprof http://localhost:6060/debug/pprof/heap

Check Metrics:

# Prometheus metrics
curl http://localhost:9092/metrics

๐Ÿ“– Next Steps

For New Developers:

  1. โœ… Read Architecture Overview
  2. โœ… Understand Database Schema
  3. โœ… Follow First Service Tutorial
  4. โœ… Check Migration Tasks

For Migration Work:

  1. โœ… Read Migration Overview
  2. โœ… Check current Phase Status
  3. โœ… Pick a task from Task Breakdown
  4. โœ… Follow implementation guide for that phase

For Feature Development:

  1. โœ… Read service guide (e.g., Wallet Service)
  2. โœ… Check API Reference for endpoints
  3. โœ… Write tests first (TDD)
  4. โœ… Implement feature
  5. โœ… Update documentation

๐Ÿ†˜ Getting Help

Documentation:

  • Check relevant guide in /docs
  • Search issues on GitHub
  • Read inline code comments

Team Communication:

  • Slack: #gitinext-backend channel
  • Daily standup: 10:00 AM
  • Code review: GitHub PRs

Useful Commands:

# Search codebase
grep -r "functionName" services/

# Find usages
go list -f '{{.Dir}}' -m github.com/gitinext/gitinext-golang/...

# Format code
gofmt -w .

# Lint
golangci-lint run

๐Ÿ’ก Tips & Best Practices

Do:

  • โœ… Write tests for all new code
  • โœ… Use shared packages (logger, metrics, database)
  • โœ… Handle errors properly (don’t ignore them)
  • โœ… Add context to all service methods
  • โœ… Use connection pools (don’t dial per request)
  • โœ… Add Prometheus metrics
  • โœ… Update documentation

Don’t:

  • โŒ Hardcode values (use config/env vars)
  • โŒ Log sensitive data (mnemonics, private keys)
  • โŒ Ignore linter warnings
  • โŒ Skip error handling
  • โŒ Use unbounded concurrency
  • โŒ Create per-request database connections

Ready to start coding? Pick a task from the Migration Guide! ๐Ÿš€

© 2025 GitiNext - Enterprise Crypto Infrastructure | GitHub | Website