Hallo Stroke

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

ConcernTechnology
LanguageGo 1.24
Web frameworkGoFiber v2
ORMGORM v1.30 + postgres driver
DatabasePostgreSQL 18
AuthJWT (golang-jwt/jwt/v4 + gofiber/jwt/v3), bcrypt
Validationgo-playground/validator v10
API docsSwagger (gofiber/swagger + swaggo/swag), served at /swagger
ScrapingColly v2 (articles), Google Maps + YouTube Data API v3 (net/http)
Web pushSherClockHolmes/webpush-go
Loggingstdlib 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 log

Each internal/<module>/ follows the same layered shape: model.gorepository.goservice.gohandler.go.

Health checks

MethodPathDescription
GET/healthLiveness — {status, service, version}
GET/readyReadiness — 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/uploads at /uploads/* and /media/uploads/*

See Backend Architecture for the DI wiring, and the API Reference for the full endpoint list.

On this page