DeesseJS
  • Enterprise
  • Pricing
DeesseJS logoDeesseJS

Software engineering as a commodity: agents that code, workflows that scale, infrastructure that works. Built with the DeesseJS ecosystem.

Ecosystem

  • Errors
  • DRPC
  • Collections
  • FP

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base

Use cases

  • SaaS apps
  • AI products
  • Landing pages
  • API backends
  • Internal tools

Company

  • About
  • Manifesto
  • Principles
  • Vision
  • Enterprise
  • Delivery
  • Help

Legal & Trust

  • Privacy
  • Terms
  • Cookies
  • DPA
  • Security

Community

  • Open Source Program
  • Github
  • LinkedIn
  • X

Explore

  • Customers
  • Templates
  • Ecosystem
  • Stack
© 2026 DeesseJS. All rights reserved.
  1. Knowledge Base
  2. Agents
  3. Use the Next.js RAG template
rag

Use the Next.js RAG template

From the templates registry to a streaming chat endpoint with embeddings.

The Next.js RAG template wires a streaming chat endpoint to a Postgres-backed vector store. It is the fastest path to a working RAG product on DeesseJS.

1. Scaffold

deessejs init nextjs-rag

2. Configure the embedding model

Set EMBEDDING_MODEL and EMBEDDING_DIMENSIONS in the env. Defaults target OpenAI's text-embedding-3-small at 1536 dimensions.

3. Index your corpus

pnpm rag:index ./content

The script chunks, embeds, and upserts into the documents table.

4. Stream a query

const answer = await rag.stream("What does ADR-013 say about topic tags?")
for await (const chunk of answer) {
  process.stdout.write(chunk.text)
}

What's next

  • Build your first agent stack — combine RAG with tool use for an agent that can both retrieve and act.
  • Manage Postgres migrations — version the documents table as the schema evolves.

Similar guides

  • 2026-07-22

    Build your first agent stack

    Compose an AI agent with the SDK, a tool registry, and a streaming endpoint.
    aillmrag
    David PereiraChief Executive Officer
    1 min read

Ready to ship?

Read more, or ship with us.

Subscribe to the blog and changelog feeds, install the CLI to scaffold a project in under five minutes, or talk to our delivery team if you need a hand. Same templates, same contracts, same guarantees.

Install the CLIBrowse the registry