Squadbase
Squadbase Docs

Next.js

Learn how to leverage Squadbase features with Next.js.

Next.js is a robust React-based framework that ships with built-in server-side rendering and static site generation, making it ideal for building high-performance internal AI apps that seamlessly integrate LLM APIs to boost business efficiency.

With Squadbase, delivering a Next.js app gives you all of the following out of the box:

  • Deployment to a secure cloud environment
  • Built-in user authentication
  • User analytics
  • Log monitoring
  • In-app feedback collection from users

You must enable standalone mode to deploy a Next.js app.

Squadbase currently supports only Next.js applications built in standalone mode. Update next.config.mjs / ts as shown below to enable standalone mode. See Configuring standalone mode.

Sample

Check out an AI app built with Next.js. With Squadbase you can deploy apps like this to a secure cloud and operate them safely inside your organization.

Resources

Handy references for developing with Next.js:

Create a new Next.js app

Run the following command:

npx create-next-app@latest

You’ll be prompted to choose settings. Here is the Squadbase team’s recommended configuration:

 Use TypeScript? Yes
 Use ESLint? Yes
 Use Tailwind CSS? Yes
 Put code in a `src/` directory? No
 Use App Router? Yes
 Use Turbopack for `next dev`? … Yes
 Customize the import alias (`@/*` by default)? … No

Next, customize next.config.ts:

// next.config.ts
import type { NextConfig } from "next";
 
const nextConfig: NextConfig = {
  output: "standalone",
};
 
export default nextConfig;

That’s it—ready to go! 🎉 For more details, see the official Next.js docs.

Deploy with GitHub integration

Create squadbase.yml

Add squadbase.yml to the root of your codebase. For an App Router project, your structure might look like this:

page.tsx
layout.tsx
next.config.ts
package.json
squadbase.yml

A minimal squadbase.yml:

# squadbase.yml
version: "1"
 
build:
  framework: nextjs
  runtime: node20 # node18, node20, node22

For customization options, see the reference.

Enable output: standalone

Next.js apps must be in standalone mode to deploy on Squadbase. Update next.config.mjs / ts:

// next.config.ts
import type { NextConfig } from "next";
 
const nextConfig: NextConfig = {
  output: "standalone",
};
 
export default nextConfig;

Import your GitHub repo into Squadbase

From the Squadbase dashboard home, import your GitHub repository. Deployment starts automatically once the import completes.

Push and deploy

Commit changes, push to GitHub, and a new deployment kicks off automatically.

Make the most of Squadbase features

Squadbase offers more than deployment—it streamlines development and operations for internal apps.

User authentication & member management

When a Squadbase team member opens your app, authentication happens automatically. If the app isn’t public, only authenticated users can access it. Each user can also have a project role.

Access user info (including project roles) from your Next.js code:

import { createNextjsServerClient } from "@squadbase/nextjs";
 
// In a server component or API route
const client = createNextjsServerClient({
  projectId: "your-project-id",
});
 
const user = await client.getUser();
console.log(user);
// {
//   username: string,
//   email: string,
//   firstName: string,
//   lastName: string,
//   iconUrl: string | null,
//   roles: string[]
// }

To fetch Squadbase user info from Next.js code, install @squadbase/nextjs.

User analytics

Squadbase collects access logs and surfaces usage analytics automatically—no extra code required.

User Analytics

Log monitoring

View runtime and access logs for each deployment (and each version) directly in the dashboard.

Log Monitoring

Feedback

Every deployed app includes a comment box so team members can submit feedback.

Feedback

On this page