How riadizur/simple_be_with_go_framework works
Project type and purpose
• This is a backend framework written in Go (“Simple Backend Framework with Go”) that provides:
• HTTP REST API endpoints
• WebSocket support
• SQLite3 integration
• Process logging
• Environment-variable configuration
File structure
• Top-level:
• .github/workflows/go.yml → CI/CD pipeline
• install.sh → bootstrap script for Go workspaces and folder structure
• kubota-gasoline-api/ → main application module
• Inside kubota-gasoline-api:
• cmd/main.go → application entrypoint and router setup
• internal/
– database/database.go → DB connection and migrations
– handlers/shift.go, websockets.go → HTTP & WS handlers
– models/shift.go → domain model definitions
• db/kubota_gasoline.db → embedded SQLite file
• log/process.log → runtime log output
• build.sh, build-win.sh → build scripts
• .env → environment configuration
README insights
• Emphasizes light-weight “cook-your-code” flow:
• init with install.sh
• write handlers in internal/
• build with build.sh
a. Main components
1. API Server (Go application in cmd/main.go)
2. HTTP REST Layer (handlers/shift.go)
3. WebSocket Layer (handlers/websockets.go)
4. Database Layer (database/database.go)
5. SQLite DB (db/kubota_gasoline.db)
6. Logging Subsystem (log/process.log)
7. Env Config Loader (.env)
8. CI/CD Workflow (.github/workflows/go.yml)
b. Relationships and interactions
• External client → HTTP request → REST handlers → DB layer → SQLite → return data
• External client → WebSocket handshake → WebSocket handler → push updates
• Application init → Env loader reads .env → config struct passed to DB & server
• Any handler/service → logs actions/errors → log/process.log
• CI workflow → on push → triggers tests/build → deploy artifacts
c. Architectural patterns & principles
• Layered architecture (entrypoint → handlers → services/database → persistence)
• Dependency injection via explicit config from .env
• Single-binary Go deployment (static build.sh)
d. Key technologies/frameworks
• Go standard library net/http + Gorilla/WebSocket (or similar)
• mattn/go-sqlite3 driver
• github.com/joho/godotenv (for .env)
• log package writing to file
• Layers: Entry, API, Persistence, Logging, Config, DevOps
• Interactions (DB reads, WS messages)