Tryneth — AI-Powered Marketing & CRM Platform
Backend engineering for Tryneth — a multi-tenant AI marketing & CRM SaaS that connects a customer's website to a team of AI agents. Across a ~56,000-line TypeScript backend (~180 API endpoints, 13 scheduled jobs) I owned AI-agent orchestration, usage-based billing, the lead & telemetry pipeline, multi-platform publishing, and production reliability & security hardening.

Role: Backend Engineer
Designed and hardened the backend for a multi-tenant SaaS that automates SEO, content, calls, and client reporting with a cast of AI agents.
Context
Tryneth is a multi-tenant platform: a customer connects their website and gets an AI team — a blog writer, a voice assistant, and an analyst — on top of a full CRM, lead capture, session recording, and multi-platform publishing. I owned large parts of the backend: AI orchestration, the billing/metering system, lead & telemetry pipelines, third-party integrations, and production reliability & security. The product lives at tryneth.com, built at Techneth.
By the Numbers
- ~56,000 lines of TypeScript across 285 files (including tests)
- ~180 API route handlers powering the platform
- 5 purpose-built AI agents — Bob, Nova, Alan, Lisa, and Neth
- 13 scheduled cron jobs running background work
- 15+ third-party integrations wired in
- 7 publishers behind one orchestrator (5 CMS platforms + webhook + native)
- 98 production database tables, with Row-Level Security enabled on 97 of them
- 7 P0 security findings closed across 9 discrete fixes
Tech Stack
- Runtime: Node.js + TypeScript
- Data: PostgreSQL (Supabase, Row-Level Security on nearly all tables), Redis
- AI: Anthropic Claude (text/agents), Google Gemini (images), OpenAI, ElevenLabs (TTS/STT)
- Integrations: Stripe, Resend, SE Ranking, DataForSEO, Google Search Console, VideoSDK, and 5 CMS platforms (Duda / WordPress / WooCommerce / Shopify / Wix)
- Ops: Cron background jobs, usage ledgers, health probes, graceful shutdown
Highlight Projects
1. AI agent orchestration + usage-based billing engine
Built the layer driving 5 purpose-built AI agents (Bob, Nova, Alan, Lisa, Neth) from a canonical prompt spec, each with tuned model tiers and cost ceilings, across a ~56,000-line TypeScript backend with ~180 API endpoints and 13 scheduled jobs. Every AI action is metered in a virtual currency and charged atomically against the parent account via compare-and-swap to prevent race conditions and double-spend. Decision: meter at the point of spend with fail-closed semantics, so cost is always attributable and a failed charge never leaks free compute.
2. Cut AI inference cost with prompt caching
Profiled token usage and found one chat surface sending ~10M uncached tokens — because a volatile prefix busted the provider's prompt cache on every call. Restructured it into a stable cached prefix + a history breakpoint, then audited every agent. Impact: eliminated a major inference-cost driver on the busiest endpoint.
3. Telemetry-driven lead capture
Built the flow from a client-side tracking script, through a public ingest endpoint, into a normalized, tenant-scoped leads store — with bot filtering, CSRF-safe handling, and a schema-resilient insert that degrades gracefully across deployment versions. Leads link back to the exact tracked session and recording they came from.
4. Multi-platform content publishing
One orchestrator that publishes AI-written, SEO-optimized blogs across 7 publishers — 5 CMS integrations (WordPress, WooCommerce, Shopify, Wix, Duda) plus a generic webhook publisher and a native target — each with its own auth model. Added per-project scheduling (one post/day with conflict toggles) and failure notifications that explain why a publish failed.
5. Production reliability & security hardening
Closed 7 P0 security findings across 9 discrete fixes (header-based identity bypass, a JWT fallback secret, missing input verification, cross-tenant data access) and enabled Row-Level Security on 97 of 98 production tables. Hardened background jobs with claim-first compare-and-swap to eliminate double-charges, and added graceful shutdown/drain, rate-limiting, fan-out concurrency caps, and a public health probe.
Challenges & How I Mitigated Them
- Silent data mislabeling: a free-text description was surfacing under the CRM's "Send-to" field, traced to a tracking-script classification feeding an overloaded DB column. Fixed by exposing a correctly-normalized field for the UI to bind to — without touching the pipeline other consumers depended on.
- Double-charge / double-invoice under retries: introduced claim-first compare-and-swap so jobs atomically claim work before acting — idempotent by construction.
- Cost blowout from cache misses: a volatile prompt prefix silently disabled prompt caching; restructured to a stable cached prefix.
- Invisible leads: leads with a null owner were invisible to the account owner — attributed each lead to the account's root owner at creation.
- Split session recordings: a single session was fragmented into multiple recordings — fixed by persisting the session id across rotation.
- Deploy-window noise vs. real errors: separated expected abort/timeout errors during rolling deploys from genuine failures.
- Storage runaway: added a per-project recording retention policy (keep the N newest sessions).
Outcomes
- Shipped 5 third-party CMS publishing integrations (WordPress, WooCommerce, Shopify, Wix, Duda) plus a generic webhook publisher, all behind one orchestrator.
- Built and metered 5 distinct AI agents across a ~56,000-line TypeScript backend (~180 API endpoints, 13 scheduled background jobs).
- Integrated 15+ third-party services (Claude, Gemini, ElevenLabs, Stripe, SE Ranking, DataForSEO, Google Search Console, VideoSDK, and more).
- Closed 7 P0 security findings and enabled Row-Level Security on 97 of 98 production tables, hardening tenant isolation across the platform.
- Eliminated a major inference-cost driver by fixing a prompt-cache miss that was sending ~10M uncached tokens per call on the busiest endpoint.
- Made billing idempotent by construction (claim-first CAS) and bounded storage growth with a per-project recording retention policy.
What I Learned
The highest-leverage work wasn't new features — it was profiling for hidden cost, making operations idempotent, and tracing data mislabeling to its true source instead of patching the symptom. Metering must be right at the point of the operation, not bolted on later.