Skip to content

Developer Documentation

Technical documentation for developers working on the Postmill codebase. This directory covers architecture, conventions, and infrastructure — everything you need to contribute effectively.

Target audience: Developers contributing to the Postmill monorepo (NestJS backend + Inngest job handler, Next.js frontend, shared libraries, Prisma).


API surfaces at a glance

SurfaceBase pathDescription
Public API v1/public/v1REST API for integrations, posts, media, and the full analytics surface (/public/v1/analytics/*) — used by the dashboard, n8n, Zapier, and the SDK.
MCP ServerMCP protocolAI agent tools exposed via Model Context Protocol.

Stability commitments

  • Schemaprisma migrate deploy is the migration method. Additive changes (nullable columns, defaulted columns) are safe. Renames and drops require an expand-contract plan.
  • AI provider resolution — no env-var fallback. Per-tenant configuration through AIOrgProviderConfig.
  • Provider framework — the kernel is the sole resolution path; there are no parallel registries or kill switches.

Page index

PageDescription
Local DevelopmentGet the stack running locally with minimal resources: Docker profiles, feature flags, memory guidance.
ArchitectureHigh-level monorepo architecture, app/library layout, data flow.
AI ArchitecturePluggable multi-provider AI layer: AIModelProvider, categories, surfaces, adapters, governance services.
DatabasePrisma schema management, migrate-deploy workflow, repository-only access, encryption at rest.
Data ModelPrisma models grouped by domain with keys and relationships.
Backend ConventionsNestJS layering (Controller → Service → Repository), DTO validation, CSRF, security invariants.
Frontend ConventionsNext.js App Router structure, SWR data fetching, Tailwind 3 styling, capability-aware UI.
Provider FrameworkKernel, identity triple, versions, catalog/health APIs.
Provider VersionsLive provider catalog grouped by domain.
IntegrationsThe channel-integration model: IntegrationManager, credential resolution, capability matrix, per-channel VPN egress.
Public API v1Public REST API endpoints for third-party integrations and automation.
Analytics APIUnified multi-channel analytics API under /public/v1/analytics/* with snapshot-based data.
MCPModel Context Protocol server entrypoints, auth, rate limiting.
OAuth AppsOAuth application registration and management.
PlugsAutomation hooks (auto plugs and post plugs) for social channel providers.
SDKOfficial @postmill-ai/postmill-sdk Node.js SDK for the Public API.
WebhooksWebhook configuration, dispatch, and SSRF-safe delivery.
Adding a ProviderStep-by-step guide for adding a new social channel provider.
Adding an AI AdapterGuide for implementing a new AI provider adapter.
Adding a Media StudioDescriptor + adapter + route recipe for the studio-kit.
TestingVitest per-package configuration, co-located specs, CI workflow.
Setup GateThe /setup onboarding wizard and gate semantics.
ContributingGround rules, invariants, PR workflow, review checklist.
GlossaryTerminology used across the codebase.

PageLocationDescription
AI Tools (user guide)../user-guide/ai-tools.mdEnd-user view of AI features.
Supported Channels../user-guide/supported-channels.mdUser-facing capability matrix for social channels.
Operations Guide../operations-guide/Self-hosting, deployment, monitoring.

Repository layout (quick reference)

apps/
  backend/         NestJS REST API — thin controllers + module wiring + Inngest handler
  frontend/        Next.js (App Router) + React — port 4200
  extension/       Browser extension
  commands/        CLI commands
  sdk/             Published SDK

libraries/
  nestjs-libraries/    Core backend logic, Prisma schema, repositories
  helpers/             Shared utilities, useFetch hook
  react-shared-libraries/  Shared React components
  providers/           Provider kernel + per-provider packages

tools/               Repo-owned tooling (not a workspace)
  db/                Migration/backfill helpers + the CI schema gates
  codegen/           Generators whose output is committed and drift-gated

docker/              Dockerfiles, dev compose files, nginx.conf, entrypoints
e2e/                 Playwright suite + seed data

Dockerfile           Pinned at the root: the image CI publishes
docker-compose.yaml  Pinned at the root: the self-hoster quick-start
openapi.yml          Generated from the controllers — never hand-edited

Root scripts/ is maintainer-local and gitignored; a fresh clone does not have it. Anything CI or a documented workflow needs lives in tools/.

Verified against v1.0.0

The AI-native social media management platform — postmill.ai