How I Built a 100% Local, Data-Sovereign Enterprise ERP Solo Using Cursor's Context Engine

Background & The Domain Challenge As the General Manager of a private corporate security and surveillance firm in South Africa—and drawing on a background in specialized law enforcement and organized crime investigation—I needed an operational management system that reflected the strict, uncompromising realities of our sector. Off-the-shelf SaaS products were fundamentally incompatible with our operational constraints.

We required a unified enterprise resource planning (ERP) platform to handle complex statutory payroll, cross-departmental logistics, fleet management, and CCTV surveillance records. More importantly, we required absolute physical data sovereignty over highly sensitive personnel and security data. Recently, I explicitly refactored our deployment strategy away from cloud-based hosting to an entirely on-premise, local hardware architecture to guarantee this physical control.

Using Cursor as my primary architectural partner, I engineered this monolithic ERP entirely solo. This post details how Cursor’s context engine makes extreme solo developer velocity viable at the enterprise level.

The Stack & Architecture

  • Framework: Next.js 16 (App Router, Server Actions)

  • Database: SQLite via better-sqlite3 (strictly local dev.db for air-gapped production deployment)

  • ORM: Prisma 7

  • UI: React 19, Tailwind CSS v4, Base UI

The Domain Complexity This is not a standard CRUD application. The system codifies highly specific South African labor laws and operational workflows:

  • Integer-Cents Financial Engine: To completely eradicate floating-point arithmetic errors over thousands of shifts, the database and calculation layers operate strictly in integer cents (ZAR × 100), converting to decimal only at the UI boundary.

  • Non-Standard Temporal Cycles: The operational logic ignores standard calendar months, dynamically anchoring payroll calculations from the 22nd to the 21st, executing complex UTC-noon normalizations to prevent timezone drift.

  • Multi-Tier Remuneration Routing: The codebase seamlessly manages parallel, decoupled financial pipelines. It evaluates raw database shift entries and applies dynamic 1.5× Sunday and 2× Public Holiday multipliers for hourly staff, while simultaneously routing absences through a rigid 21-shift divisor for flat-rate salaried personnel.

How Cursor Acted as a Force Multiplier The complexity of this system would traditionally demand a dedicated engineering pod. Cursor enabled me to build, audit, and scale it single-handedly through three specific workflows:

1. Contextual Containment via AGENTS.md To prevent AI context drift and ensure architectural consistency, I maintain a strict AGENTS.md file at the repository root. This document feeds Cursor the immutable laws of the codebase. By establishing rules like “all persisted money must use integer cents” and “always preserve local database sovereignty,” Cursor’s inline edits (Ctrl+K) and Composer outputs consistently aligned with my overarching design philosophy, drastically reducing hallucination and rework.

2. Multi-File Architectural Orchestration The application relies on absolute synchronization between raw shift data, dynamic summary buckets, and downstream Excel compliance exports. When implementing new statutory logic—such as decoupling raw night shifts to apply a specialized legislative allowance—I utilized Cursor’s multi-file indexing. In a single session, the IDE successfully navigated and updated the typescript definitions, the compute routing logic, the financial integer multipliers, and the downstream spreadsheet export formulas simultaneously, without breaking the tightly coupled dependencies.

3. Rapid Scaffolding of ETL Infrastructure Because the system runs locally, data ingestion from legacy sources is a frequent challenge. Cursor allowed me to rapidly scaffold standalone TypeScript ETL pipelines. I could feed the IDE examples of complex PDF fleet fuel reports or unstructured Excel personnel files, and it would immediately generate robust, Prisma-integrated import scripts to sanitize and inject that data directly into the local SQLite database.

The Takeaway Cursor has fundamentally altered the calculus of what a single domain expert can achieve. By pairing deep, sector-specific operational knowledge with Cursor’s advanced context engine, building a mission-critical, data-sovereign monolith is not just possible—it is highly efficient. I’m incredibly impressed with what the Anysphere team has built, and I am actively looking forward to pushing this IDE even further.