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)
Recommended:
- 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:
- โ Read Architecture Overview
- โ Understand Database Schema
- โ Follow First Service Tutorial
- โ Check Migration Tasks
For Migration Work:
- โ Read Migration Overview
- โ Check current Phase Status
- โ Pick a task from Task Breakdown
- โ Follow implementation guide for that phase
For Feature Development:
- โ Read service guide (e.g., Wallet Service)
- โ Check API Reference for endpoints
- โ Write tests first (TDD)
- โ Implement feature
- โ 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! ๐