Start Quickstarts Next.js
Use Pushbase with Next.js
Learn how to create a Pushbase project, add some sample data, and query it from a Next.js app using the App Router.
Create a Pushbase project
Go to the dashboard and create a new project. Wait for the database to finish provisioning.
Create a Next.js app
Use the with-pushbase template to scaffold an app with auth already wired up.
terminal
npx create-next-app -e with-pushbase
Query your data
Create a server component that fetches rows from your todos table.
app/todos/page.tsx
import { createClient } from '@/utils/pushbase/server'
export default async function Todos() {
const qb = await createClient()
const { data } = await qb.from('todos').select()
return <pre>{JSON.stringify(data, null, 2)}</pre>
}Next steps
Lock down the table with Row Level Security, then keep users signed in with server-side auth.
Using the Pages Router? See the Pages Router guide for getServerSideProps examples.