LogoTemplate0
Logo of Nile + Next.js Multi-tenant AI Todo App on template0.com

Nile + Next.js Multi-tenant AI Todo App

Next.js 13 starter template that builds a multi-tenant, AI-native todo list on Nile's Postgres, with AI-generated task time estimates and embeddings.

Introduction

Nile's Next.js 13 quickstart is a deployable starter template that builds a multi-tenant, AI-native todo list application on Nile's Postgres-based data platform, wired to Next.js API routes for signup, tenant creation and task management.

What is the Nile + Next.js todo template?

It is an official example from the niledatabase GitHub repository (examples/quickstart/nextjs) that shows how to combine Next.js 13 with Nile for a multi-tenant todo app. The template takes user signup, tenant creation and task titles as input, stores them in a todos table alongside Nile's built-in users and tenants tables, and outputs each task with an AI-generated time estimate plus a 768-dimension embedding. It runs on Next.js with server-side API routes, deploys to Vercel with a one-click button that provisions the Nile integration, and requires Node 18 or newer.

Key features
  • Next.js 13 app — scaffolded with npx create-next-app from the template repo, with API routes mounted under /api and the client pointed at them through the NEXT_PUBLIC_APP_URL variable.
  • Nile multi-tenant database — every todo carries a tenant_id uuid, and Nile ships a built-in tenant table so the app can scope data per tenant without hand-rolled isolation logic.
  • Ready-made SQL schema — a single create table todos statement defines id (uuid, default gen_random_uuid()), tenant_id (uuid), title (varchar 256), estimate (varchar 256), embedding (vector 768) and complete (boolean).
  • AI time estimates — an OpenAI-compatible chat model generates an automated estimate for each task; the docs' example uses Fireworks with the llama-v3p1-405b-instruct model.
  • Vector embeddings — task text is embedded with a model such as nomic-ai/nomic-embed-text-v1.5 and stored in the vector(768) column for similarity search.
  • Built-in user authentication — Nile handles signup and login (new users appear in the users table), with optional Google auth enabled by setting the AUTH_TYPE variable to google.
  • One-click Vercel deploy — the deploy button clones the repo, names the project nile-todo and attaches the Nile integration store, so database provisioning happens during deploy.
  • Reference material — a live demo on Vercel, a YouTube video walkthrough, and step-by-step docs at thenile.dev covering tenants, AI embeddings, authentication and the JavaScript SDK.
Who should use the Nile + Next.js todo template?
  • Next.js developers new to multi-tenancy: clone it to see how tenant IDs, tenant tables and per-tenant queries fit together before designing their own schema.
  • SaaS teams evaluating Nile: run the app end to end, then inspect the database in Nile's query editor to judge whether tenant virtualization and built-in auth fit their stack.
  • AI feature builders: use the todo list as a working reference for calling an OpenAI-compatible chat model and storing embeddings in Postgres for later vector lookups.
  • Tutorial followers: pair the repo with the video guide and the getting-started docs to walk through signup, database creation and deployment in order.
What can you do with this template?
  • Prototype a multi-tenant app: sign up as a user, create a tenant, add tasks, and watch rows land in the joined tenants and todos tables via a SQL query in the Nile console.
  • Add AI estimation to an existing list: reuse the AI chat and embedding calls to attach automatic time estimates to any task-style data you already store.
  • Try vector search on Postgres: populate the embedding column with 768-dimension vectors and experiment with similarity queries without standing up a separate vector database.
  • Bootstrap a Vercel deployment: use the deploy button to get a hosted copy with a Nile database attached in a single flow.
How does the template work?
  1. Create a workspace and database in Nile from the invite-based signup flow.
  2. Run the create table todos SQL in Nile's query editor (the tenant table already exists).
  3. Generate database credentials under Settings, then Credentials.
  4. Add an API key, base URL and model names from an OpenAI-compatible vendor.
  5. Scaffold with npx create-next-app, rename .env.local.example to .env.local, fill in the values, then run pnpm install and pnpm run dev.
Pros and cons
  • Pro: official quickstart maintained by Nile, with a live demo, video guide and linked docs for each subsystem.
  • Pro: one-click Vercel deploy that also wires up the Nile integration.
  • Con: requires Node 18 or newer — on Node 16 the Nile SDK fails because it depends on the Node Fetch API, producing errors such as 400 unable to parse json or 400 email must not be empty on valid requests.
  • Con: the AI estimate feature needs an API key from an OpenAI-compatible vendor; without it the estimate functionality is unavailable.
FAQ
Is the Nile + Next.js todo template free?

The template itself is an open example published in the niledatabase GitHub repository. Running it requires a Nile account (signup currently starts with an invite request) plus an API key and base URL from an OpenAI-compatible model vendor for the AI estimate and embedding features.

What Node.js version does it need?

Node 18 or newer. The page states the example only works on Node 18 and above because the Nile SDK uses the Node Fetch API, which was stabilized in Node 18, and running it on Node 16 returns parsing and empty-email errors.

Does the template include authentication?

Yes. Nile provides user signup and login out of the box, and new users are visible by running select * from users in the Nile query editor. Google authentication can be enabled optionally by setting the auth type environment variable to google.

Which AI models does it use?

The page uses Fireworks as the example vendor with the llama-v3p1-405b-instruct chat model for time estimates and nomic-ai/nomic-embed-text-v1.5 for embeddings, but any vendor exposing OpenAI-compatible APIs works, since only the API key, base URL and model names are configured.

How is tenant data separated?

Each todo row stores a tenant_id uuid that points at Nile's built-in tenants table, and the app creates tenants per signed-in user. A join query such as selecting tenant name with todo title, estimate and completeness shows which tasks belong to which tenant.

screenshot of Nile + Next.js Multi-tenant AI Todo App on template0.com

Information

GitHub Info

  • Stars1,077
  • Last maintained2026/09/10
  • LicenseApache-2.0
  • Primary languageMDX

Categories

Tags

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates