Skip to content
impulseDOCS
Get Started

Build with Next.js

Create a project (quickstart), open the Connect tab, and copy your .env. Then wire it up:

Terminal window
npm install postgres
lib/db.ts
import postgres from 'postgres';
export const sql = postgres(process.env.DATABASE_URL!, { ssl: 'require' });

Use the pooled connection string for serverless/edge-style deployments.

Terminal window
npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
const s3 = new S3Client({
endpoint: process.env.S3_ENDPOINT, region: 'us-central-1', forcePathStyle: true,
credentials: { accessKeyId: process.env.S3_ACCESS_KEY!, secretAccessKey: process.env.S3_SECRET_KEY! },
});
Terminal window
npm install @supabase/supabase-js
// lib/auth.ts — Supabase-compatible client against ImpulseAuth
import { createClient } from '@supabase/supabase-js';
export const auth = createClient(process.env.NEXT_PUBLIC_AUTH_URL!, process.env.NEXT_PUBLIC_AUTH_ANON_KEY!);

Verify sessions server-side (route handlers, middleware) against your project’s JWKS — see Auth → Integrating.

Terminal window
npm install ioredis
import Redis from 'ioredis';
export const redis = new Redis(process.env.REDIS_URL!);

Run next build and deploy the standalone output to a Cloud VPS behind Nginx or Caddy — full Node runtime, no serverless constraints. Fully static exports (output: 'export') can be served from an ImpulseDrive bucket with static hosting.