Next.js Blog (B1)
For a Next.js site you own, backed by Supabase. Vireloop inserts the article row directly into your posts table, then calls a revalidate route so the static page rebuilds instantly.
1. Create the integration
- Onboarding Integration step → Next.js Blog → Create Integration.
- Vireloop generates a one-time revalidate secretand shows it in a dialog. Copy it now — you won't see it again.
2. Add the secret to your site
.env.local
# .env.local on your Next.js site
VIRELOOP_REVALIDATE_SECRET=<paste the key from Vireloop>Also keep your Supabase SUPABASE_SERVICE_ROLE_KEY available server-side (never with a NEXT_PUBLIC_ prefix). Vireloop needs it to write rows into your table.
3. Install the revalidate route
Add this route to your Next.js site so Vireloop can trigger a rebuild after each publish. It verifies the per-site secret from step 1.
app/api/revalidate/route.ts
import { NextResponse } from "next/server";
import { revalidatePath, revalidateTag } from "next/cache";
export async function POST(req: Request) {
const url = new URL(req.url);
const secret = url.searchParams.get("secret");
if (!secret || secret !== process.env.VIRELOOP_REVALIDATE_SECRET) {
return NextResponse.json(
{ ok: false, error: "unauthorized" },
{ status: 401 },
);
}
const { path, tag } = (await req.json().catch(() => ({}))) as {
path?: string;
tag?: string;
};
if (tag) revalidateTag(tag);
if (path) revalidatePath(path);
// sensible defaults if nothing passed
if (!tag && !path) {
revalidatePath("/blog");
revalidateTag("posts");
}
return NextResponse.json({ ok: true, revalidated: true });
}4. Finish the connection in Vireloop
Open Sites → your site → Connection and provide the remaining details so Vireloop can write and revalidate:
- Supabase URL and service-role key of the target project.
- The table to write to and a column map (article field → your column name).
- Your revalidate URL (e.g.
https://yoursite.com/api/revalidate).
Then click Test connection to confirm Vireloop can read the table.
How publishing works
- The featured image is uploaded to Vireloop storage; its URL is written into your image column.
- The article is inserted (or upserted on slug) using your service-role key and column map.
- Vireloop calls your revalidate route so the page rebuilds.
Prefer a decoupled contract? See API Webhook (B2) →