Engineering Guidelines
This document defines how applications in SKIC Playground are structured, built, and maintained.
Monorepo Structureโ
All applications live in a monorepo at skic-v1-playground in Gitea. Each application is a top-level directory with its own build system.
skic-v1-playground/
โ
โโโ documentation/ # This Docusaurus site
โ
โโโ stock-market-pro/ # Go application
โ โโโ cmd/
โ โ โโโ server/
โ โ โโโ main.go # Entrypoint
โ โโโ internal/
โ โ โโโ ingestor/ # Data ingestion
โ โ โโโ analysis/ # Technical analysis engine
โ โ โโโ signals/ # Signal generation
โ โ โโโ notifier/ # Discord delivery
โ โโโ pkg/ # Shared public packages
โ โโโ Dockerfile
โ โโโ Makefile
โ โโโ go.mod
โ
โโโ shared/ # Cross-app shared libraries (Go modules)
โ โโโ discord/ # Discord client
โ โโโ config/ # Config loader
โ โโโ telemetry/ # Logging, metrics, tracing
โ
โโโ infra/ # Infrastructure-as-code
โ โโโ docker-compose.yml # Local dev stack
โ โโโ gitea-runners/ # CI runner config
โ
โโโ Makefile # Root-level make targets (build all, test all)
Go Workspace (go.work)โ
The monorepo uses Go workspaces so all Go modules can reference each other without publishing:
# go.work
go 1.22
use (
./stock-market-pro
./shared/discord
./shared/config
./shared/telemetry
)
This means local changes to shared/ are immediately reflected across all Go apps without replace directives in individual go.mod files.
Tech Stackโ
Applications โ Goโ
Go is the primary language for all backend services and autonomous applications.
Why Go:
- Statically typed, compiled, single binary deployment
- Excellent concurrency primitives (goroutines, channels) โ ideal for market data streams
- Native cross-compilation
- Fast build times, clean toolchain
- Standard library covers most needs (HTTP, JSON, time, crypto)
Standard libraries:
| Package | Purpose |
|---|---|
net/http | HTTP server / client |
encoding/json | JSON serialization |
database/sql + modernc.org/sqlite | SQLite (dev) |
github.com/lib/pq | PostgreSQL / TimescaleDB (prod) |
github.com/rs/zerolog | Structured logging |
github.com/spf13/viper | Config management |
github.com/robfig/cron/v3 | Scheduled jobs |
golang.org/x/sync | Concurrency utilities |
Data / Analysis โ Pythonโ
Python is used for data science and ML-heavy workloads where the Go ecosystem is thin:
pandas,numpyโ data manipulationpandas-ta,ta-libโ technical indicatorsscikit-learnโ pattern recognition / MLstatsmodelsโ GARCH, time series
When Python is used, it runs as a sidecar service alongside the Go application, exposing a local HTTP/gRPC API.
Frontend / Docs โ TypeScript + Reactโ
- Docusaurus v3 for documentation
- React + shadcn/ui + Tailwind for interactive components within docs
Code Conventionsโ
Goโ
gofmtโ enforced in CI- Error handling โ always wrap with
fmt.Errorf("context: %w", err), never ignore - Packages โ flat, purposeful. No circular dependencies.
internal/for app-private code - Config โ environment variables via Viper, validated at startup
- Logging โ structured JSON via zerolog, no
fmt.Printlnin production code - Tests โ table-driven tests in
_test.gofiles,testify/assertfor assertions
// Good โ explicit error context
if err := db.Query(ctx, q); err != nil {
return fmt.Errorf("ingestor: fetch candles: %w", err)
}
// Bad โ swallowed error
db.Query(ctx, q)
Gitโ
- Branch naming:
feat/description,fix/description,docs/description - Commit messages: conventional commits โ
feat:,fix:,docs:,chore:,refactor: - PRs: all changes via PR, even from Jarvis โ CI must pass before merge
- Main is always deployable
Makefile Targets (per app)โ
build: ## Build binary
go build -o bin/server ./cmd/server
test: ## Run tests
go test ./... -race -cover
lint: ## Run linter
golangci-lint run
docker: ## Build Docker image
docker build -t $(APP_NAME):$(VERSION) .
run: ## Run locally with .env
source .env && go run ./cmd/server
Adding a New Applicationโ
- Create directory
skic-v1-playground/<app-name>/ - Initialize Go module:
go mod init gitea.lego-cloud.eu/skic-v1-playground/<app-name> - Add to
go.work:use ./<app-name> - Create
.gitea/workflows/build.ymlfrom the CI template - Create
Dockerfile(multi-stage:golang:1.22-alpineโalpine:3.19) - Add documentation under
documentation/docs/products/<app-name>/following C4 structure - Add to homepage application table