๐ Modern Go-Native Business Intelligence (BI) Engine โ API-first, lightweight BI for analytics, charting, and automated reporting with 3D visualization.
๐ A lightweight, API-first Business Intelligence (BI) engine built with Go - designed for modern applications that need embedded analytics, automated reporting, and real-time data visualization. The ultimate Go-native BI solution for developers.
// Integrate BI directly into your Go application
client := gobi.NewClient("https://your-gobi-instance.com")
client.SetAPIKey("your-api-key")
// Create charts programmatically
chart := &gobi.Chart{
Name: "Sales Analytics",
Type: "3d_surface",
Data: salesData,
}
# Schedule daily reports with webhook notifications
schedule:
name: "Daily Sales Report"
cron: "0 9 * * *" # Every day at 9 AM
webhook: "https://your-app.com/webhooks/reports"
# Service-to-service authentication
curl -H "Authorization: ApiKey your-api-key" \
https://gobi.example.com/api/charts
# Real-time webhook notifications
POST /webhooks/reports
{
"event": "report.generated",
"data": { "report_id": 123, "status": "success" }
}
// Analyze query performance and get optimization suggestions
optimizer := database.NewQueryOptimizer()
plan, err := optimizer.AnalyzeQuery(sql, dataSource)
for _, suggestion := range plan.Suggestions {
fmt.Println("Optimization:", suggestion)
}
// Execute query with optimization
optimizedService := infrastructure.NewOptimizedSQLExecutionService(cacheService)
result, err := optimizedService.ExecuteWithOptimization(ctx, dataSource, sql)
fmt.Printf("Execution time: %v, Cache hit: %v\n",
result.ExecutionTime, result.CacheHit)
// Get index suggestions
indexManager := database.NewIndexManager()
suggestions, err := indexManager.SuggestIndexes(queryPatterns, dataSource)
for _, suggestion := range suggestions {
fmt.Printf("Index suggestion: %s\n", suggestion.SQL)
}
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ API Layer โ โ Service Layer โ โ Repository Layerโ
โ (Handlers) โโโโโบโ (Business โโโโโบโ (Data Access) โ
โ โ โ Logic) โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Infrastructure โ โ Validation โ โ Database โ
โ Services โ โ Layer โ โ Connection โ
โ (Cache, Auth, โ โ (SQL, Chart, โ โ Pool โ
โ Encryption) โ โ DataSource) โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Query Optimizer โ โ Index Manager โ โ Performance โ
โ (Analysis, โ โ (Multi-DB โ โ Monitoring โ
โ Suggestions) โ โ Support) โ โ (Metrics, โ
โ โ โ โ โ Analytics) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
Chart Type | 2D | 3D | Interactive |
---|---|---|---|
Bar Charts | โ | โ | โ |
Line Charts | โ | โ | โ |
Pie Charts | โ | โ | โ |
Scatter Plots | โ | โ | โ |
Area Charts | โ | โ | โ |
Surface Charts | โ | โ | โ |
Heat Maps | โ | โ | โ |
Gauge Charts | โ | โ | โ |
Funnel Charts | โ | โ | โ |
TreeMap Charts | โ | โ | โ |
Sunburst Charts | โ | โ | โ |
Tree Diagram | โ | โ | โ |
Box Plot | โ | โ | โ |
Candlestick charts | โ | โ | โ |
Word Cloud charts | โ | โ | โ |
Graph charts | โ | โ | โ |
Waterfall charts | โ | โ | โ |
Polar charts | โ | โ | โ |
Gantt charts | โ | โ | โ |
Rose charts | โ | โ | โ |
Geo/Map/Choropleth charts | โ | โ | โ |
Progress/Circular Progress charts | โ | โ | โ |
# Clone and setup everything
git clone https://github.com/sy-vendor/gobi.git
cd gobi
make setup
# Start development server
make dev
# Server starts on http://localhost:8080
# Default admin: admin/admin123
# View all available commands
make help
# Development workflow
make dev-full # Format, lint, test, build
# Testing
make test # Run tests
make test-coverage # Run tests with coverage
make test-race # Run tests with race detection
# Code quality
make lint # Run linter
make format # Format code
make security-scan # Security vulnerability scan
# Database
make migrate # Run migrations
make setup-data # Setup sample data
make test-data # Test all chart data
# Docker
make docker-build # Build Docker image
make docker-run # Run Docker container
# Production
make prod-build # Production build with all checks
# Build and run with Docker
docker build -t gobi .
docker run -p 8080:8080 gobi
# Or use docker-compose
docker-compose up -d
The application uses config/config.yaml
for configuration management.
default:
server:
port: "8080"
jwt:
secret: "default_jwt_secret"
expiration_hours: 168
database:
type: "sqlite"
dsn: "gobi.db"
jwt.secret
: JWT signing secretjwt.expiration_hours
: Token expiration time (hours)
POST /api/auth/register
โ Register a new userPOST /api/auth/login
โ Login and get JWT tokenPOST /api/apikeys
โ Create a new API keyGET /api/apikeys
โ List all API keys (userโs own or all for admin)DELETE /api/apikeys/:id
โ Revoke an API keyPOST /api/webhooks
โ Create a new webhookGET /api/webhooks
โ List all webhooks (userโs own or all for admin)GET /api/webhooks/:id
โ Get a specific webhookPUT /api/webhooks/:id
โ Update a webhookDELETE /api/webhooks/:id
โ Delete a webhookGET /api/webhooks/:id/deliveries
โ List webhook delivery attemptsPOST /api/webhooks/:id/test
โ Test a webhookGET /api/dashboard/stats
โ Get dashboard statisticsPOST /api/datasources
โ Create a new data sourceGET /api/datasources
โ List all data sourcesGET /api/datasources/:id
โ Get a specific data sourcePUT /api/datasources/:id
โ Update a data sourceDELETE /api/datasources/:id
โ Delete a data sourcePOST /api/queries
โ Create a new queryGET /api/queries
โ List all queriesGET /api/queries/:id
โ Get a specific queryPUT /api/queries/:id
โ Update a queryDELETE /api/queries/:id
โ Delete a queryPOST /api/queries/:id/execute
โ Execute a queryPOST /api/charts
โ Create a new chartGET /api/charts
โ List all chartsGET /api/charts/:id
โ Get a specific chartPUT /api/charts/:id
โ Update a chartDELETE /api/charts/:id
โ Delete a chartPOST /api/templates
โ Upload a new templateGET /api/templates
โ List all templatesGET /api/templates/:id/download
โ Download a templatePOST /api/reports/schedules
โ Create a new report scheduleGET /api/reports/schedules
โ List all report schedulesGET /api/reports/schedules/:id
โ Get a specific report schedulePUT /api/reports/schedules/:id
โ Update a report scheduleDELETE /api/reports/schedules/:id
โ Delete a report scheduleGET /api/reports
โ List all generated reportsGET /api/reports/:id/download
โ Download a specific reportTreeMap (rectangular, area-based): shows hierarchy using nested rectangles, area represents value.
Tree Diagram: shows hierarchy using nodes and branches (parent-child), like org charts or family trees.
Box Plot: shows distribution of data based on five-number summary.
Word Cloud: shows text data visualization where font size represents word frequency or importance.
Graph/Network/Force-directed: shows relationships between entities using nodes and edges, supports force-directed layout for network analysis.
Supported chart types:
* * * * *
โ โ โ โ โ
โ โ โ โ โโโ Day of week (0-7)
โ โ โ โโโโโ Month (1-12)
โ โ โโโโโโโ Day of month (1-31)
โ โโโโโโโโโ Hour (0-23)
โโโโโโโโโโโ Minute (0-59)
0 9 * * *
โ Every day at 9:00 AM0 0 * * 1
โ Every Monday at midnight35 16 * * *
โ Every day at 4:35 PMcurl -X POST https://gobi.example.com/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "admin",
"email": "[email protected]",
"password": "admin123"
}'
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "admin",
"password": "admin123"
}'
curl -X POST http://localhost:8080/api/apikeys \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_jwt_token>" \
-d '{
"name": "My Service API Key",
"expires_at": "2024-12-31T23:59:59Z"
}'
Response:
{
"api_key": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz",
"prefix": "abc123def456",
"name": "My Service API Key",
"expires_at": "2024-12-31T23:59:59Z",
"created_at": "2024-01-15T10:30:00Z"
}
curl -X GET http://localhost:8080/api/queries \
-H "Authorization: ApiKey abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"
curl -X GET http://localhost:8080/api/apikeys \
-H "Authorization: Bearer <your_jwt_token>"
curl -X DELETE http://localhost:8080/api/apikeys/1 \
-H "Authorization: Bearer <your_jwt_token>"
curl -X POST http://localhost:8080/api/webhooks \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_jwt_token>" \
-d '{
"name": "Report Notifications",
"url": "https://your-app.com/webhooks/reports",
"events": ["report.generated", "report.failed"],
"headers": {
"X-Custom-Header": "custom-value"
}
}'
curl -X POST http://localhost:8080/api/webhooks/1/test \
-H "Authorization: Bearer <your_jwt_token>"
curl -X GET http://localhost:8080/api/webhooks/1/deliveries \
-H "Authorization: Bearer <your_jwt_token>"
curl -X POST http://localhost:8080/api/reports/schedules \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_jwt_token>" \
-d '{
"name": "Daily Sales Report",
"type": "daily",
"query_ids": [1, 2, 3],
"chart_ids": [1, 2],
"template_ids": [1],
"cron_pattern": "35 16 * * *"
}'
report.generated
โ Report generation completed successfullyreport.failed
โ Report generation failedwebhook.test
โ Test webhook event{
"event": "report.generated",
"data": {
"report_id": 123,
"report_name": "Daily Sales Report",
"schedule_id": 456,
"schedule_name": "Daily Sales Schedule",
"status": "success",
"generated_at": "2024-01-15T10:30:00Z",
"file_size": 1024,
"download_url": "/api/reports/123/download"
}
}
X-Gobi-Signature
: HMAC signatureX-Gobi-Timestamp
: Unix timestampX-Gobi-Event
: Event typeimport hmac
import hashlib
def verify_signature(payload, signature, timestamp, secret):
message = f"{timestamp}.{payload}"
expected = hmac.new(
secret.encode('utf-8'),
message.encode('utf-8'),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)
Use Authorization: Bearer <jwt_token>
header for user authentication.
Use Authorization: ApiKey <api_key>
header for service-to-service authentication.
API Key Features:
Security Notes:
All API errors are returned in JSON format:
{
"code": 401,
"message": "Token expired",
"error": "Token expired: token is expired"
}
Authorization header is required
Invalid token
Token expired
Token missing required claims
Invalid or expired API key
Coming soonโฆ