Beehive Logic

Humanitarian Operations Management Platform — Beneficiary, Event & Partner Tracking System

| Full Stack · Go · PostgreSQL · HTMX · GPT-4 · Google Sheets

Overview

A humanitarian organization managing field operations across multiple regions came to us with a workflow stitched together from spreadsheets. Program staff, project managers, and HQ each maintained their own files; data was copy-pasted between them; donor 5W reports took days to assemble. The client needed one internal platform that could:

  • Track beneficiaries and their vulnerability profiles
  • Log every event and partner-led activity tied to specific projects
  • Enforce strict role-based visibility (field staff see only their own organization’s data, HQ sees everything)
  • Generate donor-ready 5W reports on demand
  • Push live data to Google Sheets so partner organizations could consume it without direct database access
  • Let non-technical managers ask data questions in natural language

We designed and built the platform end-to-end in Go.


Architecture at a Glance

              ┌────────────────────────────────┐
   Browser → │      Go HTTP server (HTMX)      │ ← partial renders, no JS framework
              └─────────────┬──────────────────┘
                            │
                Handler → Service → Repository → Cache
                            │
   ┌────────────┬───────────┼───────────┬────────────┬──────────────┐
   ▼            ▼           ▼           ▼            ▼              ▼
 RBAC         5W           GPT-4      Google      WebSocket       Audit
 (4 roles)   Reports     SQL Assist   Sheets      Hub             Log
                                      Auto-Import
                            │
                  PostgreSQL (sqlx) · Redis (sessions, cache)

Reference data is hot-loaded into an in-memory cache at startup; sessions live in Redis; the GPT-4 assistant runs SQL through a hardened gateway; a background worker pushes query results to Google Spreadsheets on configurable intervals.


What We Built

Domain model & RBAC

  • Beneficiaries with a 13-category vulnerability taxonomy
  • Events, partner activities, projects, organizations, places
  • Append-only audit log with automatic retention cleanup
  • Four-role permission system — Admin, HQ DB Manager, Project Manager, Manager, User — with per-project and per-organization scoping enforced at the service layer

AI-powered SQL assistant

  • GPT-4 with OpenAI function-calling so admins can query the database in plain language
  • Hardened with a destructive-keyword blocklist (DROP / DELETE / INSERT / UPDATE / SET)
  • Response size caps and admin-only access

Google Sheets auto-import engine

  • Background worker runs custom SELECT queries on configurable intervals
  • Pushes results to Google Spreadsheets via per-user Service Account credentials
  • Enables near-real-time data sharing with external stakeholders — no manual copy-paste

Real-time updates

  • WebSocket hub (gorilla/websocket) for live notifications across sessions

Reporting

  • Two report generators including the humanitarian-sector standard 5W framework (Who, What, Where, When, for Whom)
  • Downloadable output for donor packets

Server-rendered UI

  • Go html/template + HTMX for fast, partial page updates without a JS framework
  • Light bundle, maintainable codebase, no SPA toolchain to babysit

Auth & sessions

  • Google OAuth login
  • Redis-backed sessions via scs/v2

Infrastructure

  • Dockerized two-stage build
  • GitLab CI/CD pipeline auto-deploying to a production VPS on every push to main
  • golang-migrate for schema versioning
  • Automatic audit-log retention cleanup

Cross-Cutting Engineering

  • Clean layered architecture: handler → service → repository → cache
  • Raw SQL via sqlx for full query control
  • In-memory cache for reference data, hot-loaded at startup
  • Permission checks at the service layer, never trusting the UI
  • Continuous delivery from main to production

Technical Stack

LayerTechnology
LanguageGo (Golang)
DatabasePostgreSQL
Cache / SessionsRedis
HTTP / UIGo html/template + HTMX
Real-timeWebSocket (gorilla/websocket)
AIOpenAI GPT-4 (function-calling)
External I/OGoogle Sheets API, Google OAuth 2.0
Sessionsscs/v2 (Redis store)
SQLsqlx (raw SQL)
Migrationsgolang-migrate
ContainersDocker, Docker Compose
DeployGitLab CI/CD → VPS

Outcome

The platform replaced the client’s spreadsheet workflow and is now the single source of truth for their field operations.

  • Program staff log events directly from the field
  • Project managers run scoped reports without needing IT support
  • HQ pulls 5W reports for donors in minutes instead of days
  • The auto-import engine eliminated the manual copy-paste cycle for partner data sharing
  • The GPT-4 SQL assistant lets non-technical managers answer their own data questions

The system has been running in production with continuous delivery via GitLab CI/CD. The modular layered architecture made it straightforward to extend — the HQ DB Manager role and partner activities module were both added post-launch with zero refactoring of existing code.

Beehive Logic

High-performance software engineering for market leaders. Working across Ukraine, serving clients worldwide.

Services

Company

© 2026 Beehive Logic