













Red Lizard Studioz
Ontario, Canada
Multi-tenant platform for marketing agencies and their clients, with AI-generated SEO content, knowledge bases, conversational agents for support and lead capture, a sales pipeline, custom domains and a 24-section operations panel.
IncludesAI writingChat agentsMulti-client







Overview
The challenge
Links
Private — client project
System architecture
The platform is built as two deployed applications over a shared tenant model: a Strapi 5 backend that owns the data, the AI pipelines and 116 custom endpoints, and a Next.js 15 dashboard that is both the operator console and the public storefront renderer. The decisive choice was to treat Strapi as an application framework rather than a CMS — content types define the tenant-scoped data model, while the behaviour lives in roughly 25,000 lines of custom services covering generation, retrieval, agents, compliance and design.
Application Architecture
- Strapi 5 backend owning 39 content types and 116 custom REST endpoints, with two in-repo plugins.
- Next.js 15 App Router frontend serving the operator dashboard, public tenant storefronts, and 72 server-side API routes that proxy Strapi with per-route authorization.
- Authenticated same-origin proxy pattern plus a dedicated SSE proxy for streaming generation.
- AG-UI protocol over server-sent events for the agent runtime, so streaming, tool calls and lifecycle events follow a published contract.
- An embeddable widget mounted in Shadow DOM, served from the backend and installable on any external site with a one-line script tag.
Platform Features
- Multi-stage article pipeline: outline, draft, editorial review, conditional revision, branded cover image and scheduled publish.
- Per-tenant RAG over uploaded documents, services, FAQs, business profile and ingested website URLs.
- Chat agents with per-call tool authorization, lead capture, and a safety net that rescues contact details the model failed to save.
- Knowledge-gap detection that turns unanswerable visitor questions into scored blog ideas.
- Multi-agent website design pipeline with per-stage caching, graceful degradation and live progress reporting.
- Conversational interviews that populate the business profile, including an invite-link flow for respondents without accounts.
Data Model
- A project entity as the tenant root, related to articles, knowledge documents, keywords, leads, conversations, services, testimonials, FAQs, website pages and design records.
- Reusable components for per-tenant configuration: LLM config, compliance rules, widget config, theme, identity, contact, image agent and sales intelligence.
- Knowledge documents carrying a public/secure visibility enum that defaults to secure.
- Conversations modelled with intent, sentiment, outcome, unanswered questions and device attribution; leads with a full lifecycle including status, sub-status and generated summaries.
- Prompt overrides as first-class rows with scope and an optional project relation, where a null project means the global default.
Authentication
Identity spans agency staff working across every tenant and clients scoped to one business.
- Strapi JWT
- Google OAuth
- Role buckets
- Tenant assignment
- Internal shared secret
- Fail-closed policy
- Owner-only routes
Infrastructure & deployment
Both applications ship as Docker images built exclusively on CI runners and pulled by the servers — a policy adopted after an in-place build exhausted memory on a shared production host. Deployment is a Bitbucket pipeline that runs the test suite on every pull request and every branch push, builds against a registry-side BuildKit cache, and SSHes a deploy script to the target machine.
Hosting & Deploy
- Linode host behind Cloudflare, with TLS terminating at the proxy and the app configured for proxy trust.
- Separate dev and production images from distinct Dockerfiles, pinned to different Node majors for documented dependency reasons.
- Next.js standalone output running as a non-root user, with post-deploy image pruning that keeps the newest three tags.
CI/CD
- Tests run on every pull request and every branch push; a red suite blocks the build and the deploy.
- Backend suite is offline by design — no key, no database, no network — with model-calling tests opt-in behind a --live flag.
- Registry-cached BuildKit builds, commit-SHA and branch tags, and retry logic on registry push races.
- Branch-specific build arguments so each environment bakes its own backend URL, after a build-time constant once pointed a dev deploy at production.
Data & Storage
- Two PostgreSQL 17 instances: the application database and a pgvector instance for embeddings, the latter not exposed to the host in production.
- SQL migrations for the vector schema, including the visibility column and a visibility-filtered similarity function.
- Connection pooling configured per environment; container logs rotated after an unbounded log reached hundreds of megabytes.
Operations
- Three scheduled jobs: hourly article generation, five-minute scheduled publishing with a give-up guard, and a configurable daily digest with timezone support.
- Healthcheck on the frontend container, with memory limits and reservations on every service.
- Secrets supplied through CI variables and validated as non-empty before use, after an empty argument once shifted an entire positional list.
Built with
Delivered as a working two-application system with an operator console, public tenant storefronts, an embeddable widget and the AI pipelines behind them.
Application Surfaces
- A 24-section operator dashboard spanning content, business, super-admin and beta areas.
- Design Studio: a full-window AI website design editor with brief, plan, canvas, sections, versions, competitors and references panels.
- Public tenant storefronts with per-tenant routing, custom domain support and incremental revalidation.
- Authentication flows: sign-in, sign-up, Google OAuth, forgot and reset password.
- A public interview flow answerable from an invite link with no account, excluded from search indexing.
Integrations
- Six LLM providers behind one interface, with a connection test action in the dashboard.
- Postmark transactional email covering lead notifications, daily digests, password resets and interview invitations.
- News retrieval for content ideas, plus integration records for analytics, search console and scheduling with derived connection status.
- An embeddable chat widget installable on external, non-tenant websites.
Engineering Deliverables
- 111 test suites across both repositories, including a live-API suite for behaviour that offline stubs cannot verify.
- CI pipelines gating both applications, with deployment runbooks documented in-repo.
- A documented known-issues log recording root cause and verification for each resolved defect.