Technology Stack
Dokumentasi lengkap library, framework, dan tools yang digunakan di MStore Backend Go.π― Core Stack
Web Framework
GoFiber v2.52
Fast HTTP framework built on Fasthttp
- Express-like API
- Zero memory allocation router
- Built-in middleware support
Fasthttp v1.65
High-performance HTTP engine
- 10x faster than net/http
- Zero-allocation design
- Connection pooling
Database
GORM v1.30
ORM library untuk Go
- Auto migrations
- Associations & preloading
- Hooks & callbacks
- Soft deletes
MySQL Driver v1.8
Official MySQL driver
- Connection pooling
- Prepared statements
- Transaction support
MongoDB Driver v1.17
Official MongoDB driver
- BSON support
- Aggregation pipeline
- Change streams
Redis v9.7
Redis client untuk Go
- Pipelining
- Pub/Sub
- Cluster support
Authentication & Security
JWT v5.2
JSON Web Token implementation
- HS256, RS256 support
- Claims validation
- Token refresh
Crypto
Go cryptography library
- bcrypt password hashing
- AES encryption
- TLS support
π‘ External Integrations
Payment Gateway
Providers:- Xendit: QRIS, E-Wallet, VA, Credit Card
- Midtrans: Snap API, Core API
Message Broker
NATS v1.44
Cloud-native messaging
- Pub/Sub
- Request/Reply
- Queue groups
RabbitMQ v1.10
Message queue broker
- AMQP 0.9.1
- Reliable delivery
- Dead letter queues
Kafka v0.4
Event streaming platform
- High throughput
- Partitioning
- Consumer groups
IoT & Real-time
MQTT v1.5
MQTT client untuk IoT
- QoS levels
- Retained messages
- Last will & testament
WebSocket v1.3
WebSocket support untuk Fiber
- Real-time bidirectional
- Connection pooling
- Auto reconnect
- MQTT: QRIS payment notification real-time
- WebSocket: Live order updates, stock alerts
π Observability (LGTM Stack)
Logging
Zap v1.27
Structured logging
- Zero-allocation
- JSON output
- Log levels
ECS Zap v1.0
Elastic Common Schema
- Standardized format
- Loki integration
Tracing
OpenTelemetry v1.34
Distributed tracing
- Span creation
- Context propagation
- Trace sampling
Jaeger Client v2.30
Jaeger tracing client
- Trace visualization
- Service dependencies
- Performance analysis
Metrics
Usage:π οΈ Development Tools
Code Quality
Swaggo v1.16
Swagger documentation
- Auto-generate from comments
- OpenAPI 3.0 support
Validator v10.23
Struct validation
- Tag-based rules
- Custom validators
Testify v1.10
Testing toolkit
- Assertions
- Mocking
- Test suites
Testing
Godog v0.15
BDD testing framework
- Gherkin syntax
- Feature files
- Step definitions
Pact v2.4
Contract testing
- Consumer-driven contracts
- Provider verification
CLI & Configuration
Cobra v1.9
CLI framework
- Commands & subcommands
- Flags & arguments
Godotenv v1.5
Environment variables
- .env file loading
Env v6.10
Struct-based config
- Tag-based parsing
π¦ Utilities
Data Processing
Excelize v2.9
Excel file processing
- Read/Write XLSX
- Formulas & styles
UUID v1.6
UUID generation
- v4 random UUIDs
QR Code v2.2
QR code generation
- PNG/JPEG output
- Custom styling
Internationalization
Usage:π₯ Firebase & Cloud
Firebase Admin v3.13
Firebase Admin SDK
- Firestore
- Authentication
- Cloud Messaging
AWS SDK v1.55
AWS SDK untuk Go
- S3 storage
- SQS queues
- SNS notifications
π GraphQL
Usage:π¨ Expression & Rules Engine
Usage:π Version Matrix
| Category | Library | Version | Status |
|---|---|---|---|
| Framework | GoFiber | v2.52.9 | β Stable |
| Database | GORM | v1.30.0 | β Stable |
| Database | MongoDB Driver | v1.17.1 | β Stable |
| Cache | Redis | v9.7.0 | β Stable |
| Auth | JWT | v5.2.1 | β Stable |
| HTTP Client | Resty | v2.16.5 | β Stable |
| Message Broker | NATS | v1.44.0 | β Stable |
| Message Broker | RabbitMQ | v1.10.0 | β Stable |
| Message Broker | Kafka | v0.4.47 | β Stable |
| IoT | MQTT | v1.5.0 | β Stable |
| Logging | Zap | v1.27.0 | β Stable |
| Tracing | OpenTelemetry | v1.34.0 | β Stable |
| Validation | Validator | v10.23.0 | β Stable |
| Testing | Testify | v1.10.0 | β Stable |
| Testing | Godog | v0.15.0 | β Stable |
| CLI | Cobra | v1.9.1 | β Stable |
| Excel | Excelize | v2.9.1 | β Stable |
| GraphQL | gqlgen | v0.17.56 | β Stable |
| Firebase | Firebase Admin | v3.13.0 | β Stable |
| AWS | AWS SDK | v1.55.5 | β Stable |
π Performance Characteristics
Benchmarks
| Operation | Throughput | Latency (P95) |
|---|---|---|
| HTTP Request (Fiber) | 100k req/s | < 10ms |
| Database Query (GORM) | 10k qps | < 5ms |
| Redis Get | 100k ops/s | < 1ms |
| NATS Publish | 1M msg/s | < 0.5ms |
| JSON Marshal | 1M ops/s | < 1Β΅s |
π‘ Best Practices
DO β
- Use connection pooling untuk database & Redis
- Implement circuit breaker untuk external APIs
- Use context timeout untuk semua operations
- Enable OpenTelemetry instrumentation
- Use structured logging (Zap)
- Implement graceful shutdown
- Use dependency injection
DONβT β
- Jangan hardcode credentials
- Jangan skip error handling
- Jangan block goroutines indefinitely
- Jangan ignore context cancellation
- Jangan log sensitive data
- Jangan skip input validation
π Related Documentation
Service Template
Template service dengan best practices
API Styleguide
Panduan API design & conventions
Testing Guide
Unit, integration, dan E2E testing
Observability
LGTM stack setup & monitoring
Need Help? Contact backend team atau check GitHub Issues