Next.jsReactSaaSStarter

free-nextjs-ai-agent-boilerplate — Next.js SaaS Template

By emrahsinekli

A free AI chat interface template built on Next.js App Router, Tailwind CSS, TypeScript, and the Vercel AI SDK, supporting token streaming, a stop button, and switching between multiple model providers.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

2 previews
Desktop homepage1 / 2
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 2

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-14View source

What stands out

A quick read of the recorded project description.

01

Built on Next.js App Router, Tailwind CSS, TypeScript, and the Vercel AI SDK

02

Supports token-by-token streaming and provides a working stop button

03

Switch among Anthropic, OpenAI, and Google via the AI_PROVIDER environment variable

04

API keys are used only server-side and are not exposed to the browser

05

MIT license; the README states commercial use is allowed without attribution

06

The README provides examples for customizing the system prompt, theme colors, and adding tool calls

Template Details

This is a free AI chat UI template under the MIT license. The README states it is built with Next.js 16 (App Router), Tailwind CSS v4, TypeScript, and Vercel AI SDK v5. Core features include token-by-token streaming, a working stop button, and switching providers among Anthropic, OpenAI, and Google via environment variables. The project structure is clear: src/app/api/chat/route.ts provides the streaming POST endpoint, src/components/chat.tsx contains the full chat interface, and src/lib/model.ts centralizes model names and the system prompt. The README explicitly states that this free repository does not include authentication, a database, or payments; these belong to its commercial version, AgentShipKit. It also states that API keys remain server-side only and are not sent to the browser.

Usage is to clone the repository, install dependencies, copy .env.example to .env.local, configure AI_PROVIDER along with the corresponding provider's API key and model name, then run npm run dev. The README also provides examples for customizing the system prompt, adjusting colors via OKLCH theme tokens, and adding tool calls using the AI SDK's tool function. For deployment, the README states you can push to GitHub, then import into Vercel and configure environment variables. The README does not provide information about testing, accessibility, browser compatibility, or performance.

Next.jsSaaSStarter

Is it right for your project?

Use Cases

  • Building a prototype AI chat interface with streaming output
  • Switching among Anthropic, OpenAI, and Google models for comparison testing
  • Using it as a starting point to learn how the Vercel AI SDK's useChat and streamText are used
  • Deploying a demo app on Vercel that contains only the chat UI

Suitable For

  • Developers who need free base code for an AI chat UI
  • Projects using Next.js App Router and TypeScript
  • Teams that want to add authentication, a database, or payments themselves
  • Readers who want to understand how streaming chat is implemented with the Vercel AI SDK

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    After cloning the repository, run npm install and copy .env.example to .env.local

  2. 2

    In .env.local, set AI_PROVIDER (anthropic, openai, or google) along with the corresponding provider's API key and model name

  3. 3

    Run npm run dev, then visit http://localhost:3000

  4. 4

    When deploying to Vercel, add the AI_PROVIDER and API key environment variables in the project settings

  5. 5

    The README states that this free repository does not include authentication, a database, or payments

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

What is included here is the free version under the MIT license from the public repository; the free scope covers that version's code and does not mean that external services or third-party assets are free.

Must comply with when using

  • You may use, modify, commercialize, and distribute this version's code for free.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses; the code's MIT license alone is not sufficient to determine this.
  • External services such as domains, hosting, databases, payments, or AI may incur separate charges.
  • You need to set the AI_PROVIDER environment variable and choose one of anthropic, openai, or google.
  • When using the Anthropic provider, you must configure ANTHROPIC_API_KEY and apply for an API key yourself.
  • You need to specify the ANTHROPIC_MODEL model name, for example claude-sonnet-5.
  • To use Anthropic, you need to obtain an API key from console.anthropic.com.
  • To use OpenAI, you need to obtain an API key from platform.openai.com.
  • To use Google, you need to obtain an API key from aistudio.google.com.
  • The free repository does not include authentication or database features; these belong to the paid premium kit.
  • If you want to use local models (Ollama, LM Studio), you need to add @ai-sdk/openai-compatible yourself and configure a local endpoint.
  • Authentication features such as Supabase Auth are available only in the paid AgentShipKit; the free repository does not include them.
  • Polar / Stripe payment features are available only in the paid AgentShipKit; the free repository does not include them.
  • Lifetime updates are a benefit of the paid AgentShipKit; the free repository does not provide them.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

AI_PROVIDER=anthropic # anthropic | openai | google

Original README

ANTHROPIC_API_KEY=sk-ant-...

Original README

ANTHROPIC_MODEL=claude-sonnet-5

Original README

| Anthropic | [console.anthropic.com](https://console.anthropic.com/settings/keys) | `ANTHROPIC_API_KEY` |

Original README

| OpenAI | [platform.openai.com](https://platform.openai.com/api-keys) | `OPENAI_API_KEY` |

Original README

| Google | [aistudio.google.com](https://aistudio.google.com/app/apikey) | `GOOGLE_GENERATIVE_AI_API_KEY` |

Original README

**Why is there no auth or database?** Because that's the hard part, and it's the [premium kit](https://agentshipkit.com). This repo is the honest, useful free half.

Original README

**Does it work with local models (Ollama, LM Studio)?** Add `@ai-sdk/openai-compatible` and point it at your local endpoint in `src/lib/model.ts`.

Original README

- ✅ **Supabase Auth** — Google login, sessions, RLS policies, ready

Original README

- ✅ **Polar / Stripe payments** — checkout + webhooks + entitlement, wired

Original README

- ✅ **Lifetime updates** — one payment, forever

Original README
https://github.com/emrahsinekli/free-nextjs-ai-agent-boilerplate/blob/main/LICENSEhttps://github.com/emrahsinekli/free-nextjs-ai-agent-boilerplate/blob/main/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-14. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 85 / 100
Technologies
Next.js · React
Website type
SaaS · Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-07-12
Screenshot last checked
2026-10-14

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Review declaration: codex-user-requested-batch-review-20261015 · 2026-10-15

Inspect the recorded source material

SHA-256: 4474b80f8d7f5ab62597a64f797ed36777dcd99cc969c5a4a1646ee3dc0b91e0

2026-10-14T22:25:12.837Z

Source file / repository
# Free Next.js AI Agent Boilerplate

A clean, production-grade **AI chat UI** built with **Next.js 16 (App Router)**, **Tailwind CSS v4**, **TypeScript** and the **Vercel AI SDK v5**. Token streaming, stop button, provider switching — no bloat, no vendor lock-in.

> ### 🚀 Need Auth, Database and Payments too?
> Don't waste 2 weeks wiring Supabase, Stripe/Polar and a dashboard from scratch.
> **[Get the full commercial-ready boilerplate at agentshipkit.com →](https://agentshipkit.com)**

![License](https://img.shields.io/badge/license-MIT-green) ![Next.js](https://img.shields.io/badge/Next.js-16-black) ![AI SDK](https://img.shields.io/badge/AI%20SDK-v5-blue)

---

## What's inside

| | |
|---|---|
| 💬 **Streaming chat UI** | Real token-by-token streaming with a working stop button |
| 🔌 **Provider-agnostic** | Anthropic, OpenAI or Google — swap with one env var, not a refactor |
| 🎨 **Tailwind v4** | Dark, modern, responsive. No component library to fight |
| 🧠 **AI SDK v5** | `useChat` + `streamText`, the current API — not a stale v3 tutorial |
| 📦 **Zero backend** | One route handler. Deploy to Vercel in a click |
| 🔒 **Keys stay server-side** | The API key never reaches the browser |

## Quick start

```bash
git clone https://github.com/emrahsinekli/free-nextjs-ai-agent-boilerplate.git
cd free-nextjs-ai-agent-boilerplate
npm install
cp .env.example .env.local
```

Open `.env.local` and set **one** provider:

```bash
AI_PROVIDER=anthropic          # anthropic | openai | google
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODEL=claude-sonnet-5
```

Then:

```bash
npm run dev
```

Open <http://localhost:3000>. That's it — you have a streaming AI chat app.

### Get an API key

| Provider | Where | Env var |
|---|---|---|
| Anthropic | [console.anthropic.com](https://console.anthropic.com/settings/keys) | `ANTHROPIC_API_KEY` |
| OpenAI | [platform.openai.com](https://platform.openai.com/api-keys) | `OPENAI_API_KEY` |
| Google | [aistudio.google.com](https://aistudio.google.com/app/apikey) | `GOOGLE_GENERATIVE_AI_API_KEY` |

## Project structure

```
src/
├── app/
│   ├── api/chat/route.ts    # Streaming endpoint (POST)
│   ├── layout.tsx
│   ├── page.tsx
│   └── globals.css          # Tailwind v4 theme tokens
├── components/
│   └── chat.tsx             # The whole chat UI, one file, readable
└── lib/
    └── model.ts             # Provider switch — the only place models are named
```

## Customising

**Change the system prompt** — `src/lib/model.ts`:

```ts
export const SYSTEM_PROMPT = "You are a sarcastic pirate. Answer in one sentence.";
```

**Change the colours** — `src/app/globals.css`. The whole theme is six OKLCH tokens.

**Add tools (function calling)** — `src/app/api/chat/route.ts`:

```ts
import { tool } from "ai";
import { z } from "zod";

const result = streamText({
  model: getModel(),
  system: SYSTEM_PROMPT,
  messages: convertToModelMessages(messages),
  tools: {
    weather: tool({
      description: "Get the weather for a city",
      inputSchema: z.object({ city: z.string() }),
      execute: async ({ city }) => ({ city, tempC: 21 }),
    }),
  },
});
```

## Deploy

Push to GitHub, import the repo on [Vercel](https://vercel.com/new), and add your `AI_PROVIDER` + API key as environment variables. Done.

## FAQ

**Is this really free?** Yes. MIT licensed. Use it commercially, no attribution required.

**Why is there no auth or database?** Because that's the hard part, and it's the [premium kit](https://agentshipkit.com). This repo is the honest, useful free half.

**Does it work with local models (Ollama, LM Studio)?** Add `@ai-sdk/openai-compatible` and point it at your local endpoint in `src/lib/model.ts`.

---

## 🚀 Ship the whole SaaS, not just the chat box

This repo gives you the UI. **[AgentShipKit](https://agentshipkit.com)** gives you the business:

- ✅ **Supabase Auth** — Google login, sessions, RLS policies, ready
- ✅ **Polar / Stripe payments** — checkout + webhooks + entitlement, wired
- ✅ **Multi-agent dashboard** — agent runs, tool traces, streaming logs
- ✅ **Agent engine** — tool-calling loop, multi-step orchestration
- ✅ **SEO-ready landing page** — metadata, sitemap, JSON-LD
- ✅ **Lifetime updates** — one payment, forever

### [→ Download the Premium Agent Kit at agentshipkit.com](https://agentshipkit.com)

---

MIT © AgentShipKit

<sub>Keywords: nextjs ai agent template · ai agent boilerplate · ai agent starter kit · nextjs chatgpt clone · vercel ai sdk template · react ai chat ui · typescript llm starter</sub>
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.