Backend Overview
The Hallo Stroke GoFiber REST API.
The backend (Hallo-Stroke-Backend) is a Go 1.24 REST API built on GoFiber v2 with PostgreSQL via GORM. It owns all business logic, authentication, the reminder scheduler, content scraping, and integrations with Google Maps, YouTube, and a WhatsApp gateway.
Tech stack
| Concern | Technology |
|---|---|
| Language | Go 1.24 |
| Web framework | GoFiber v2 |
| ORM | GORM v1.30 + postgres driver |
| Database | PostgreSQL 18 |
| Auth | JWT (golang-jwt/jwt/v4 + gofiber/jwt/v3), bcrypt |
| Validation | go-playground/validator v10 |
| API docs | Swagger (gofiber/swagger + swaggo/swag), served at /swagger |
| Scraping | Colly v2 (articles), Google Maps + YouTube Data API v3 (net/http) |
| Web push | SherClockHolmes/webpush-go |
| Logging | stdlib log + lumberjack rotating files |
Project structure
cmd/main.go # entry: Fiber app, middleware, migrations, DI, scheduler
config/config.go # godotenv loader
database/ # GORM conn + enum creation
routes/routes.go # central route registration
middleware/auth.go # JWT / Admin / OptionalJWT middleware
internal/
auth/ # users, profile, roles, caregiver-patient
faskes/ # facility finder (Google Maps + cache)
pengingat/ # reminders + scheduler logic
forum/ # threads, replies, likes, saves
whatsapp/ # bot, sessions, FAQ, broadcasts
superAdmin/ # login, raw SQL, export, async logging
pushNotification/ # web push
komunitas/ # community directory CRUD
dokter/ # doctor CRUD
shared/interface.go # cross-module interfaces + DTOs
scraping/
artikel/ # Kemenkes scraper + saved-articles
youtube/ # YouTube client + saved-videos
kategori/ # dynamic content categories
utils/ # hash, AES-GCM, image save, logger, verification code
docs/ # Swagger artifacts
build/uploads/ # static image storage
logs/app.log # rotating app logEach internal/<module>/ follows the same layered shape: model.go → repository.go → service.go → handler.go.
Health checks
| Method | Path | Description |
|---|---|---|
| GET | /health | Liveness — {status, service, version} |
| GET | /ready | Readiness — pings DB, 503 if disconnected |
| GET | /swagger/* | Swagger UI |
Base path
All API routes are under /api. Health, swagger, static uploads, and the WhatsApp webhook are registered at the root (in main.go), not under /api.
Server config
- Body limit: 5 MB
- Timeouts: 30s read/write
- CORS allowlist:
hallostroke.org,localhost:3000,localhost:3003,localhost:5173(credentials allowed, max age 86400) - Static uploads: served from
./build/uploadsat/uploads/*and/media/uploads/*
See Backend Architecture for the DI wiring, and the API Reference for the full endpoint list.