apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx
<$Partial path="quickstart_db_setup.mdx" />
Use the create-next-app command and the with-supabase template, to create a Next.js app pre-configured with Cookie-based Auth, TypeScript, and Tailwind CSS.
npx create-next-app -e with-supabase
Supabase's Agent Skills is a curated set of instructions that give your AI agent procedural knowledge about working with Supabase.
Install them so your AI coding agent can produce more accurate, reliable code using current Supabase patterns, such as authentication, server-side rendering, and database migrations, rather than relying solely on training data.
To install, run the following command in the root of your project:
npx skills add supabase/agent-skills
Rename .env.example to .env.local and populate with your Supabase connection variables that you can get from the helper below, or from the project Connect panel.
NEXT_PUBLIC_SUPABASE_URL=<SUBSTITUTE_SUPABASE_URL>
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=<SUBSTITUTE_SUPABASE_PUBLISHABLE_KEY>
<$Partial path="api_settings.mdx" variables={{ "framework": "nextjs", "tab": "frameworks" }} />
Create a new file at app/instruments/page.tsx and populate with the following.
This selects all the rows from the instruments table you created earlier and renders them on the page.
<$CodeTabs>
import { createClient } from "@/lib/supabase/server";
import { Suspense } from "react";
async function InstrumentsData() {
const supabase = await createClient();
const { data: instruments } = await supabase.from("instruments").select();
return <pre>{JSON.stringify(instruments, null, 2)}</pre>;
}
export default function Instruments() {
return (
<Suspense fallback={<div>Loading instruments...</div>}>
<InstrumentsData />
</Suspense>
);
}
</$CodeTabs>
Run the development server, go to http://localhost:3000/instruments in a browser and you should see the list of instruments.
npm run dev