SaaS / AI Customer Support Web Application API Development Real-time Infrastructure Monorepo Architecture AI Integration

SiteAssist — AI Website Chatbot Platform

Built a production-grade AI chatbot SaaS from the ground up as a TypeScript monorepo — crawls your site, trains an AI assistant on your content, and embeds it in minutes with one script tag.

100%
Type Coverage
4
Apps in Monorepo
5+
Shared Packages
<50ms
API Latency
Next.js Hono TypeScript tRPC WebSocket Turborepo

Overview

SiteAssist is an AI-powered website chatbot platform. Businesses connect their website, documentation, or FAQ pages and SiteAssist’s crawler trains a custom AI assistant on that content. Visitors get instant, context-aware answers — with source citations and a seamless handoff to a human agent when needed. The whole thing deploys with a single script tag.

We built SiteAssist from the ground up as a structured TypeScript monorepo — a marketing site, a customer app, a documentation site, and a backend server, all sharing a common layer of auth, database access, and API contracts. The result is a codebase where a type change in the database schema propagates automatically to the API, the client, and the docs — with the TypeScript compiler catching every breakage before it ships.

The Challenge

SiteAssist needed to do a lot of things well simultaneously: crawl and index arbitrary website content, train and serve AI responses in real time, surface analytics to customers, and make the whole setup genuinely frictionless. The technical brief called for:

  • AI-powered content ingestion: a crawler that fetches site content and trains a per-customer AI assistant that responds accurately with citations
  • Real-time chat: a live widget on the customer’s site, backed by a persistent connection to the server — not a polling loop
  • Human handoff: agents need to step into conversations without breaking the user’s flow
  • Multiple surfaces: marketing site, customer app, public docs, and an API server, each with different deployment needs
  • Shared logic without copy-paste: auth, database models, and API types in one place, consumed reliably everywhere
  • Type safety end-to-end: no runtime surprises at API boundaries

Our Approach

Monorepo Structure

We used Turborepo to manage the build graph across apps and packages. The workspace is divided into two layers:

Apps — independently deployable surfaces:

  • apps/web — Next.js marketing site
  • apps/app — Next.js customer-facing application
  • apps/docs — documentation site
  • apps/server — Hono API server

Packages — shared internal libraries:

  • packages/auth — session management and middleware
  • packages/db — database schema and query helpers
  • packages/trpc — tRPC router definitions shared between server and clients
  • packages/ui — shared component library
  • packages/config — shared TypeScript and tooling configs

Turborepo’s remote caching meant CI builds only ran what changed — cutting build times significantly as the repo grew.

API Layer with tRPC and Hono

The backend runs on Hono, a lightweight edge-compatible router. Business logic is exposed through tRPC procedures — typed end-to-end so the client never writes a fetch call with a string URL. Procedure inputs and outputs are validated with Zod schemas that double as documentation.

tRPC’s router lives in packages/trpc, imported by both the Hono server and the Next.js clients. Changing a procedure’s output type surfaces type errors in every consumer simultaneously.

Real-Time with WebSockets

Features requiring live updates — notifications, collaborative state, activity feeds — are handled over a persistent WebSocket connection managed by the Hono server. The protocol is typed: message payloads are defined as discriminated unions in the shared package, so both the server and client know exactly what shapes to expect.

Auth Across Apps

The packages/auth package centralises session logic. Every app and API route imports the same getSession / requireAuth helpers rather than re-implementing cookie parsing or token validation. A single code path means a single audit target.

Database

The packages/db package owns the schema definitions and exposes typed query helpers. No app queries the database directly — all data access goes through the package, keeping schema migrations in one place and the query surface small.

Results

SiteAssist launched with a free tier that lets businesses embed an AI assistant trained on their site in under five minutes — no credit card, no engineering effort beyond pasting a script tag.

The monorepo architecture paid off immediately during development: sharing types across packages eliminated an entire category of bugs at API boundaries. The WebSocket layer delivers real-time chat with sub-50ms API latency. Because every app and package compiles together, refactors that touch shared code surface all breakages at once — before anything ships.

The platform launched with 100% TypeScript coverage across the entire codebase, from database schema to widget props, and a product that genuinely answers the question visitors are actually asking — not just the ones listed in a FAQ.

Ready to build something great?

Tell us about your project. We'll get back to you within one business day to schedule a free discovery call.