Skip to content

Open Source

Forgekit

What it is

Forgekit is an open-source Next.js 16 AI starter kit with streaming chat, five model providers including local Ollama, RAG on pgvector, Better Auth and Docker.

Forgekit is an open-source, MIT-licensed Next.js 16 AI starter kit. It gives developers a working AI chat app with streaming responses, tool calling, retrieval over their own documents and a self-hosting deploy path from the first commit.

Problem

Most AI templates make the first streamed reply easy, then leave the hard parts to you: saved conversations, auth, per-user document scoping, rate limits, token usage, local models and a container that migrates its own database.

What I built

  • Streaming chat with saved threads on the AI SDK, and a model picker across OpenAI, Anthropic, Gemini, xAI and local Ollama
  • Weather, web fetch and calculator tools rendered as cards
  • RAG over PDF, Markdown and text uploads on PostgreSQL with pgvector (HNSW cosine index) and numbered citations
  • Better Auth email and GitHub sign-in, per-user rate limiting and token usage per model
  • An MCP endpoint exposing search_knowledge behind hashed fk_ API keys
  • A multi-stage Docker image (284 MB measured) that applies Drizzle migrations on boot, plus Vitest, Playwright and ESLint

Result

Forgekit installs, typechecks, lints, passes its 15 unit tests and builds cleanly. It runs with one setup script, and the same app deploys to Docker, Coolify or Vercel. Read the full write-up: [Forgekit: An Open-Source Next.js AI Starter Kit](/blog/nextjs-ai-starter-kit).

Stack

  • Next.js
  • AI SDK
  • PostgreSQL
  • pgvector
  • Better Auth
  • Drizzle
  • Docker

Gallery