AI App Template

A Next.js or Expo app with auth, a database, an agent, and a deploy

What it is

A full app scaffold for a product with users. It comes with authentication, a Postgres database, an AI agent your users can chat with, and a one-call deploy. Pick Next.js for a data-dense web app or Expo for mobile.

What it includes

PieceWhat it does
ScaffoldA Recursiv starter repo (nextjs or expo) created server side
AuthPasswordless plus OAuth sign-in, sessions, scoped per-user keys
DatabaseA Postgres database for your app data
AgentA model-agnostic agent (any supported model) with streaming chat
DeployA production deploy from the linked GitHub repo
IntegrationsOptional access to hundreds of data integrations as tools

How to start it

Scaffold a repo server side, create a project against it, then provision the rest. No local git or GitHub account required.

$npm install @recursiv/sdk
$export RECURSIV_API_KEY=sk_live_...
1import { Recursiv } from '@recursiv/sdk';
2
3const r = new Recursiv();
4
5// 1. Scaffold a starter repo. Templates: 'nextjs' | 'expo'
6const { data: repo } = await r.github.createFromTemplate({
7 template: 'nextjs',
8 name: 'my-ai-app',
9});
10
11// 2. Create the project linked to that repo
12const { data: project } = await r.projects.create({
13 name: 'my-ai-app',
14 repo_url: repo.repo_url,
15});
16
17// 3. Provision a database
18await r.databases.ensure({ project_id: project.id, name: 'main' });
19
20// 4. Create the agent
21const { data: agent } = await r.agents.create({
22 project_id: project.id,
23 name: 'App Assistant',
24 model: 'anthropic/claude-sonnet-4.6',
25 system_prompt: 'You help users get things done in this app. Be concise.',
26});

Add auth

Sign users up and in, then mint a short-lived scoped key per session instead of shipping a long-lived key.

1const session = await r.auth.signUp({ email, password });
2
3const apiKey = await r.auth.createApiKey(
4 { name: 'web-session', scopes: ['agents:read', 'agents:write', 'databases:read'] },
5 session.token,
6);

Stream the agent to your UI

In Next.js and browsers, chatStream() yields { delta } chunks. In Expo, use chatStreamText().

1for await (const chunk of r.agents.chatStream(agent.id, { message })) {
2 process.stdout.write(chunk.delta ?? '');
3}

Deploy

Deploys build from the linked GitHub repo.

1const { data: deployment } = await r.projects.deploy(project.id, {
2 branch: 'main',
3 type: 'production',
4});
5
6console.log(deployment.deployment_url);

Key SDK calls

  • r.github.createFromTemplate({ template, name }) - scaffold the repo
  • r.projects.create({ name, repo_url }) - the project
  • r.databases.ensure({ project_id, name }) - app database
  • r.auth.signUp(...), r.auth.signIn(...), r.auth.createApiKey(...) - auth and scoped keys
  • r.agents.create({ project_id, model, instructions }) - the agent
  • r.agents.chatStream(agentId, { message }) / r.agents.chatStreamText(...) - stream to your UI
  • r.projects.deploy(projectId, { branch, type }) - ship it

Next steps