Skip to main content

Part of topic: Next.js Architecture, Backend & Modular Systems, Zero-Trust & Auditable Infrastructure, Full-Stack Systems Design

Building an Internal Operations Platform with Go: The Power of the Modular Monolith

Building an Internal Operations Platform with Go: The Power of the Modular Monolith

November 2, 2026 5 min read Go, PostgreSQL, Software Architecture, Modular Monolith, Backend Engineering, Production Systems

Building an Internal Operations Platform with Go: The Power of the Modular Monolith is a Developer Journal article by Ancel Ajanga on https://ancel.co.ke. Architectural lessons from building a production internal operations platform with Go and PostgreSQL: 8 business modules, 9 schemas, transactional outbox with FOR UPDATE SKIP LOCKED, and optimistic concurrency. It focuses on: Internal operational workflows—asset tracking, incident logs, weekly reports, employee feedback, and compliance audits—are often scattered…

Architectural lessons from building a production internal operations platform with Go and PostgreSQL: 8 business modules, 9 schemas, transactional outbox with FOR UPDATE SKIP LOCKED, and optimistic concurrency.

Who this is for

Backend engineers, technical leads, and system architects deciding between microservices and modular monoliths for mission-critical internal business platforms.

Problem

Internal operational workflows—asset tracking, incident logs, weekly reports, employee feedback, and compliance audits—are often scattered across spreadsheets and disparate tools, creating operational blind spots and data silos.

Business outcome

A unified, high-performance Go modular monolith with 8 business domains and 9 logical PostgreSQL schemas, featuring transactional outbox background processing and optimistic locking.

Metrics

  • 8 business modules cleanly partitioned in a single Go binary
  • 9 logical PostgreSQL schemas providing clear domain boundaries
  • PostgreSQL FOR UPDATE SKIP LOCKED for concurrent background worker job claiming

In growing organizations, internal operational workflows break silently long before customer-facing products do.

Hardware assets change hands in hallway conversations without custody records. Production incidents get resolved in chat channels without root-cause documentation. Weekly departmental reports sit in mutable shared folders where historical edits are lost. Employee feedback dries up because staff fear attribution.

When I set out to solve these operational breakdowns, the conventional industry hype suggested building microservices: spin up ten independent services, configure Kafka, manage distributed tracing, and write complex distributed saga coordinators.

Instead, I chose a different path: **a Go Modular Monolith with PostgreSQL**.

The resulting platform is hosted, actively used, and orchestrates eight core business modules with exceptional operational speed and zero microservice overhead.

The Architecture: Why a Modular Monolith?

Microservices have their place, but introducing them prematurely introduces immense operational friction: - **Network Latency & Serialization Overhead**: Every inter-service request incurs JSON/protobuf serialization, TCP handshakes, and network hops. - **Distributed Transactions**: You can no longer wrap a business operation in an atomic database transaction. You must build compensating sagas when step 4 of 6 fails. - **Deployment Complexity**: Managing multiple container deployments, service meshes, and CI/CD pipelines drains small engineering teams.

A **Modular Monolith** provides the best of both worlds: - **Logical Domain Separation**: Business logic is strictly segregated into independent packages with clean interface boundaries. - **Physical Unified Deployment**: The entire platform compiles into a single, highly optimized Go binary that deploys with trivial ease. - **Atomic Relational Operations**: Cross-domain workflows can execute inside single database transactions when consistency is paramount.

The Eight Business Modules and Nine PostgreSQL Schemas

The platform partitions operational responsibilities into eight clean business domains, backed by nine logical PostgreSQL schemas:

1. **`auth`**: User authentication, session management, and role-based permissions. 2. **`org`**: Departmental structures, organizational hierarchies, and team memberships. 3. **`assets`**: Hardware and equipment custody logs, serial number indexing, and lifecycle status. 4. **`incidents`**: Severity-tagged operational incidents (P1 to P4), resolution timelines, and root-cause postmortems. 5. **`reports`**: Departmental weekly submissions, KPI aggregations, and immutable executive briefings. 6. **`feedback`**: Anonymized employee feedback channels with cryptographic submitter isolation. 7. **`documents`**: Compliance documentation, standard operating procedures (SOPs), and policy versioning. 8. **`jobs`**: Transactional outbox queues and asynchronous worker coordination. 9. **`audit`**: Append-only audit logs capturing every state change, actor, timestamp, and IP address.

By enforcing schema boundaries within PostgreSQL, queries within the `assets` package cannot arbitrarily join into `feedback` tables without going through documented domain interfaces.

Concurrency Control: Optimistic Locking with Version Columns

In a collaborative operational platform, two managers will inevitably attempt to edit the same incident report or reassign the same hardware asset at the exact same moment.

Without concurrency protection, the second write silently overwrites the first write's data—a bug known as a **Lost Update**.

The platform prevents lost updates using **Optimistic Concurrency Control (OCC)**: - Mutable entities include a `version` integer column. - When an entity is updated, the SQL query checks that the database version matches the version read by the client:

ql
UPDATE incidents.incidents
SET 
    title = $1,
    status = $2,
    version = version + 1,
    updated_at = NOW()
WHERE id = $3 AND version = $4;

If another user modified the incident in the milliseconds between read and write, the database version will have incremented. The `UPDATE` statement affects 0 rows. The Go backend detects this, rolls back the transaction, and returns a clean `409 Conflict` HTTP error, alerting the second user: *"This record has been modified by another team member. Please refresh to review the latest changes."*

Background Jobs: Transactional Outbox with `FOR UPDATE SKIP LOCKED`

Operational platforms routinely require background processing: sending email notifications, generating PDF compliance reports, and syncing telemetry.

Instead of introducing external message brokers (like RabbitMQ or Redis), the platform uses PostgreSQL's native **`FOR UPDATE SKIP LOCKED`** feature to implement a resilient **Transactional Outbox**:

1. When a business event occurs (e.g., an incident is escalated), the event payload is inserted into the `jobs.outbox` table **inside the exact same database transaction** that updated the incident record. 2. If the transaction succeeds, the job is guaranteed to be in the outbox. If the transaction fails, the job rolls back automatically. There is zero risk of ghost jobs or lost notifications. 3. Concurrent background worker routines poll the outbox table for pending jobs using:

ql
SELECT id, task_type, payload
FROM jobs.outbox
WHERE status = 'PENDING'
ORDER BY created_at ASC
LIMIT 10
FOR UPDATE SKIP LOCKED;

### Why `FOR UPDATE SKIP LOCKED` Matters In standard SQL locking (`FOR UPDATE`), worker 1 locks the first 10 rows. When worker 2 runs the query, it blocks and waits until worker 1 finishes, destroying concurrency.

With **`SKIP LOCKED`**, PostgreSQL skips past any rows currently locked by worker 1 and immediately grabs the next available unlocked rows. Multiple background workers can claim and process tasks concurrently with zero lock contention, zero race conditions, and zero external infrastructure dependencies.

Importing a Spreadsheet Is a Data-Integrity Problem

Asset registers usually start life as spreadsheets, and those are messy: the header is on row three, columns are named differently from file to file, and the same tag appears twice. Reading rows and inserting them would quietly corrupt the register, so the import is a pipeline with a person in the middle.

The file is inspected and the header row is found by scoring candidate rows against known column names. Values are normalised, and each row is classified and matched to existing assets by tag, then serial number. A tag and serial number that point at different assets become a conflict that is never applied, and blank cells never overwrite existing data. Before anything is written, a reviewer sees a preview of every proposed change, and the person who uploaded the file cannot approve it. Approved changes run in a single transaction, the previous state of every touched record is kept, and a rollback is refused if someone has edited those assets since.

The result is deterministic: the same file against the same data always produces the same proposal. The full breakdown is in the case study.

Key Engineering Takeaways

1. **A Modular Monolith is Often the Best Architecture**: Before adopting microservices, organize your code into modular domains with strict boundaries inside a single deployment. You get clean code without distributed systems headaches. 2. **PostgreSQL is More Than a Relational Store**: With logical schemas, optimistic locking, and `FOR UPDATE SKIP LOCKED`, PostgreSQL can handle business domains, concurrency guards, and job queues without external message brokers. 3. **Optimistic Locking Prevents Silent Data Corruption**: Always use version columns on mutable collaborative entities to prevent users from silently overwriting each other's work. 4. **Treat Imports as Controlled Changes**: Preview, conflict detection, a second approver and a guarded rollback let people trust what enters the system.

Explore the Internal Operations Platform Case Study or review the [Operations Platform Project Page](/projects/internal-operations-accountability-platform). [Reach out](/contact) to discuss backend systems and Go architecture.

Trade-offs

Chose a Go modular monolith over microservices to eliminate distributed transaction latency, network serialization overhead, and multi-service deployment complexity while preserving strict logical separation.

Challenges faced

Designing background jobs without external message queues by leveraging PostgreSQL transactional outbox tables and FOR UPDATE SKIP LOCKED row claiming.