Inspiration

Every business needs customer support, but hiring 24/7 support teams is expensive and doesn't scale. We saw businesses struggling with repetitive customer questions — the same "how do I reset my password?" or "what are your pricing plans?" asked hundreds of times a day. We wanted to build a platform where any business could deploy an AI support agent trained on their own knowledge base, in minutes, with zero coding. DigitalOcean's GenAI Platform gave us the perfect foundation — managed AI agents with built-in retrieval-augmented generation — so we could focus on building a great product instead of managing ML infrastructure.

What it does

Dochat is a B2B SaaS platform that lets businesses create and deploy AI-powered customer support agents on their websites. Here's how it works:

  1. Create an AI Agent — Configure your agent's name, personality, and instructions
  2. Build a Knowledge Base — Upload documents, add website URLs, or paste text. The agent learns your business inside and out
  3. Embed on Your Website — Drop a single <script> tag and a fully-themed chat widget appears on your site
  4. Live Chat Handoff — Track conversations in real-time, see escalations, and jump in as a human operator when needed
  5. Test Before Deploying — Use the built-in Playground to chat with your agent and refine its responses without affecting billing

Key features include conversation escalation to human support, agent health monitoring with auto-recovery, public/private agent visibility controls, customizable widget theming (colors, logo, suggested prompts), and a multi-tier subscription system (Free through Enterprise).

How we built it

Architecture: Turborepo monorepo with two Next.js 15 apps (dashboard + embeddable widget) and shared packages for UI components, database client, and constants.

DigitalOcean GenAI Platform: The core of Dochat. We use the GenAI API to provision AI agents, manage knowledge bases with multiple datasource types (files, websites, text), trigger indexing jobs, and serve chat completions with RAG.

DigitalOcean App Platform: Hosts both services with ingress routing — the main dashboard at / and the widget service at /widget/*.

Stack: React 19, Shadcn/ui, TailwindCSS, Prisma + PostgreSQL (DO Database), DO Spaces, Clerk auth, DodoPayments for billing, Vitest for testing (145 tests across 17 files). The widget is built as an embeddable IIFE bundle (esbuild) that injects an iframe for full CSS isolation from host sites.

Challenges we ran into

  • Standalone mode doesn't serve public files: Next.js standalone output doesn't include the public/ directory. We built force-static route handlers that read files at build time

Accomplishments that we're proud of

  • Production-ready from day one: Full billing system, auth, error recovery, health monitoring, and 145 automated tests
  • Agent auto-recovery: A cron-based health check system that pings agent endpoints and automatically recreates failed agents — zero-downtime self-healing
  • Seamless widget embedding: A single script tag gives any website a fully themed, iframe-isolated AI chat widget with session persistence
  • Playground isolation: Test conversations are flagged via metadata and excluded from billing — businesses can iterate on their agents without burning message credits
  • Event-driven architecture: A singleton EventBus powers real-time UI updates for KB indexing status, conversation messages, and agent health — no polling needed on the frontend

What we learned

  • DigitalOcean's GenAI Platform is powerful
  • Resilience matters more than features: Building auto-recovery, stale status reconciliation, and access key refresh made the platform reliable — features that users never see but always benefit from
  • Monorepo architecture pays off: Sharing UI components, types, and database clients between the dashboard and widget apps saved significant development time and kept everything consistent
  • Iframe isolation is worth the complexity: Embedding a widget on third-party sites means you can't trust the host CSS. The iframe approach was more work but guarantees a consistent experience everywhere

What's next for Dochat - AI Support Agents for Your Business

  • Multi-channel support: Extend beyond web widgets to WhatsApp, Slack, and email integrations
  • Custom agent actions: Let agents perform actions (create tickets, check order status, process refunds) via configurable tool integrations

Built With

Share this project:

Updates