Runtype
BlogPersona

From Script Tag to Production: Deploying AI Chat Into Any Stack

Whether you're embedding into an existing product or building something new, Persona deploys with a script tag, an npm install, or an AI-generated codebase.

Runtype TeamRuntype Team
personadeploymentembeddingshippinggetting-started

There are two kinds of people building AI products. Those adding AI to something that already exists, and those starting from scratch. Persona works for both.

Starting a new project from scratch

If you're prototyping a new idea, you don't need an existing product to embed into. The Ship tab in the Runtype dashboard integrates directly with tools like v0, Lovable, or your coding agent of choice.

Copy the generated prompts into your AI coding tool. In seconds, you have a functional web app with your AI chat agent built in.

This is the fastest path from "I have an idea for an AI product" to "I have a working demo I can show someone."

Embedding into an existing product

Start with the basic embed from our getting started guide, then adapt it to your framework.

For React projects

Install via npm and use the imperative API inside a useEffect:

React integration

The Ship tab

Every surface has a Ship tab that generates framework-specific embed code with your API keys, theme, and agent settings already filled in. If you tell it you're using Next.js, you get Next.js code. Vue, you get Vue code.

For advanced use cases, the Ship tab can also generate code that includes the DOM parser for page context awareness.

Connection modes

Persona supports two connection modes:

Direct mode: The browser connects directly to the Runtype API using client tokens. Simple, fast, no backend needed on your side.

Proxy mode: Route requests through your own server first. This lets you add custom logic, additional authentication, rate limiting, or audit logging before the request reaches Runtype.

Start with direct mode. Move to proxy mode when your product needs it.

Client tokens and security

Persona uses scoped client tokens that are safe to include in frontend code. Each token grants access only to specific flows and agents. You can restrict tokens to specific domains, separate test and production environments, and revoke tokens at any time.

Grab a client token from the Ship tab, paste the embed into your stack of choice, and you're live — direct mode, no backend required.