Pragma logo

PragmaLabs (internal) · Internal platform

PragmaOS

Agency Operating System

PragmaOS is our own local-first operating system for running a product studio: clients, leads, projects, tasks, products, invoices, payments, content, and knowledge — schema-first, service-layered, ready for UI phases.

Product studio operationsPlatform foundation · Phase 1 schema & services

Entities

10 domains

Stack

Next + Prisma

Philosophy

Local-first ready

Challenge

Studios that preach systems should run one

What problem existed?

PragmaLabs cannot honestly sell NestOS or ConnectOS while running on sticky notes. We needed our own spine: pipeline, delivery, billing, content, knowledge — designed with the same discipline we charge clients for.

  • ▸Delivery and CRM easily drift apart without schema contracts
  • ▸Invoice history must survive product price changes
  • ▸Knowledge and client content need different permission futures
  • ▸Local-first ambition requires ID and delete strategies early

What we built

Schema as product

What PragmaLabs created

Phase 1 of PragmaOS is intentionally foundation-heavy: Prisma models for CRM, projects/tasks (with subtasks), products, invoices with line-item snapshots, payments, team members, content, and hierarchical knowledge — all behind a service layer so HTTP is never the only API.

CRM conversion

Leads are not clients until won — preserving pipeline history.

Billing integrity

Line items snapshot description and prices; payments support partials.

Sync-ready IDs

CUIDs and soft deletes chosen for future local-first conflict paths.

How it works

Phase plan

Simple workflow — how delivery was sequenced

  1. 1

    Architecture

    Folder model, service boundaries, env structure, ERD decisions.

  2. 2

    Schema push

    PostgreSQL + Prisma for all ten domains with enums as state machines.

  3. 3

    Service stubs

    Client service and base error handling patterns for expansion.

  4. 4

    Phase 2 ready

    UI, auth, and optimistic offline deferred until the data spine is honest.

In detail

Key parts of the product

Lead → client conversion

Pipeline statuses with convertedAt and client linkage.

Projects & nested tasks

Work breakdown without inventing a separate epic entity.

Product catalogue

Reusable services/products/subscriptions for invoice lines.

Content vs knowledge

Client deliverables separated from internal wiki hierarchy.

Technology

Technical stack

Next.js 15 App Router, Prisma, PostgreSQL, React Query and Zustand reserved for later UI. Services never expose Prisma raw into route handlers without a boundary — that discipline is the product.

  • Next.js 15
  • Prisma + PostgreSQL
  • React Query
  • Zustand
  • TypeScript
  • Service layer

Result

What improved

  • A complete domain model ready for UI investment.
  • Billing and CRM share coherent foreign keys and soft-delete policy.
  • Future ElectricSQL/PowerSync-style local-first work has a real substrate.
  • Client work benefits from dogfooding the same architecture principles.

PragmaOS is how we keep ourselves honest. The same patterns we recommend — service layers, snapshot billing, enums for state — are what we run.

Want something like PragmaOS for your business?

Book a free discovery call or a deeper working session — we start from your business problem, not a template.

Related work