Generating template structure
The user is asking for a boilerplate starter template that includes Next.js, Prisma, and Tailwind CSS, which suggests they want a code skeleton. I need to consider the framework version; the latest as of late 2025 appears to be v15, but my knowledge is capped at 2024, when Next.js 14 was stable. I’ll default to TypeScript, as it's commonly used. I'll provide the necessary files like package.json and Tailwind config and include concise setup commands for an easy start.Structuring boilerplate template
The user wants explicit file paths and content for a boilerplate template that includes the necessary dependencies for Next.js, React, Prisma, and Tailwind CSS. I’ll include a basic structure like package.json, which lists all the required dependencies, and maybe a minimal next.config.js.
For the quick start commands, I could mention that Next now has a built-in Tailwind option. However, since they requested something explicit, I'll provide a manual integration approach, including an example repo tree highlighting only the essential custom files to keep it concise.Drafting template structure
I'm considering a structure that includes the necessary files for the boilerplate. This will feature a root directory with important files like package.json, the Prisma schema, Tailwind configurations, and Next.js configurations.
I'll include a small example of a Prisma model, such as Post, and showcase how it would be used on a page. I should mention the environment variable DATABASE_URL in a .env file, but won’t include that file since the user would create it. For simplicity, I’ll use Prisma with SQLite to keep configuration minimal.Outlining Prisma schema and setup
For the Prisma schema, I’ll define the datasource to use SQLite and the Prisma client generator. The model will include a Post with an auto-incrementing ID, title, and creation date.
In the prisma.ts file, I'll set up the PrismaClient and ensure it's globally available in development.
For Tailwind, I’ll configure the content paths to include all relevant directories in the Next.js app. The globals.css file will import Tailwind’s base, components, and utilities, along with some body styling.
Finally, in layout.tsx, I’ll establish the RootLayout with metadata, and in page.tsx, I’ll fetch all posts using Prisma with the correct server component setup.Creating the boilerplate package structure
I need to ensure that the plain server components are set up correctly without any "use client" declarations. I’ll include an example RESTful route at app/api/posts/route.ts.
For the minimal package.json, I will reflect Next.js version 14.1 or 14.2 and include scripts for essential commands like "dev," "build," and Prisma-related tasks. I’ll include necessary dependencies and devDependencies like Prisma, Tailwind, ESLint, and TypeScript.
It's also important to mention the DATABASE_URL in the .env file for SQLite. Though we might skip some files like tsconfig or .gitignore for brevity, I’ll provide a concise overview and quick setup steps at the top. Below is a minimal, opinionated Next.js (App Router) + Prisma + Tailwind CSS starter in TypeScript using SQLite.
1. Folder structure
your-app/
app/
api/
posts/route.ts
layout.tsx
page.tsx
lib/
prisma.ts
prisma/
schema.prisma
public/
favicon.ico
styles/
globals.css
.env
next.config.mjs
package.json
postcss.config.js
tailwind.config.ts
tsconfig.json
2. Core config files
package.json
{
"name": "next-prisma-tailwind-starter",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate dev",
"prisma:studio": "prisma studio"
},
"dependencies": {
"@prisma/client": "^5.8.0",
"next": "14.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.0.0",
"eslint-config-next": "14.2.0",
"postcss": "^8.4.31",
"prisma": "^5.8.0",
"tailwindcss": "^3.4.0",
"typescript": "^5.0.0"
}
}
.env
DATABASE_URL="file:./dev.db"
Do not commit .env to version control.
next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true
}
};
export default nextConfig;
tsconfig.json
{
"compilerOptions": {
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"types": ["node", "react", "react-dom"],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};
tailwind.config.ts
import type { Config } from "tailwindcss";
const config: Config = {
content: [
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./pages/**/*.{js,ts,jsx,tsx,mdx}"
],
theme: {
extend: {}
},
plugins: []
};
export default config;
3. Prisma
prisma/schema.prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Post {
id Int @id @default(autoincrement())
title String
createdAt DateTime @default(now())
}
lib/prisma.ts
import { PrismaClient } from "@prisma/client";
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
log: ["query", "error", "warn"]
});
if (process.env.NODE_ENV !== "production") {
globalForPrisma.prisma = prisma;
}
4. Tailwind + global styles
styles/globals.css
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--bg: #020617;
--fg: #e5e7eb;
--accent: #22c55e;
}
html,
body {
padding: 0;
margin: 0;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
"SF Pro Display", sans-serif;
background-color: var(--bg);
color: var(--fg);
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
5. Next.js App Router
app/layout.tsx
import "./../styles/globals.css";
import type { Metadata } from "next";
export const metadata: Metadata = {
title: "Next + Prisma + Tailwind Starter",
description: "Minimal starter template"
};
export default function RootLayout({
children
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className="min-h-screen bg-slate-950 text-slate-50">
<div className="mx-auto max-w-3xl px-4 py-10">{children}</div>
</body>
</html>
);
}
app/page.tsx
import { prisma } from "@/lib/prisma";
export default async function HomePage() {
const posts = await prisma.post.findMany({
orderBy: { createdAt: "desc" }
});
return (
<main className="space-y-8">
<header className="space-y-2">
<h1 className="text-3xl font-bold tracking-tight">
Next + Prisma + Tailwind Starter
</h1>
<p className="text-sm text-slate-400">
Simple example using SQLite, Prisma, and Tailwind CSS.
</p>
</header>
<section className="space-y-3">
<h2 className="text-xl font-semibold">Posts</h2>
{posts.length === 0 ? (
<p className="text-slate-400">
No posts yet. Create one using the API route at{" "}
<code className="rounded bg-slate-900 px-1 py-0.5 text-xs">
POST /api/posts
</code>
.
</p>
) : (
<ul className="space-y-2">
{posts.map((post) => (
<li
key={post.id}
className="flex items-center justify-between rounded border border-slate-800 bg-slate-900 px-4 py-2"
>
<span>{post.title}</span>
<span className="text-xs text-slate-500">
{post.createdAt.toISOString()}
</span>
</li>
))}
</ul>
)}
</section>
</main>
);
}
6. Example Prisma API route
app/api/posts/route.ts
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
export async function GET() {
const posts = await prisma.post.findMany({
orderBy: { createdAt: "desc" }
});
return NextResponse.json(posts);
}
export async function POST(req: Request) {
const body = await req.json().catch(() => null) as { title?: string } | null;
if (!body?.title || body.title.trim().length === 0) {
return NextResponse.json(
{ error: "Title is required" },
{ status: 400 }
);
}
const post = await prisma.post.create({
data: { title: body.title.trim() }
});
return NextResponse.json(post, { status: 201 });
}
7. Minimal favicon (optional)
public/favicon.ico
Use any favicon, or leave it out; Next will warn but still run.
8. Setup & run
From the project root:
# install dependencies
npm install
# generate Prisma client
npx prisma generate
# create initial migration and DB
npx prisma migrate dev --name init
# start dev server
npm run dev
Open http://localhost:3000.
You now have a working Next.js + Prisma + Tailwind boilerplate with:
- App Router
- Prisma client with SQLite
- Tailwind configured
- Example Prisma-backed page and API route.