Harbur — High-performance infrastructure platform. Now available.
Client SDKs

Next.js Integration

Using the official harbur package inside Next.js App Router, Server Actions, and Edge runtimes.

Installation

Terminal
npm install harbur

Note

Add your API key to .env.local as HARBUR_API_KEY=re_live_....

App Router Route Handler

app/api/send/route.ts
import { Harbur } from "harbur";
import { NextResponse } from "next/server";

const harbur = new Harbur(); // Automatically uses process.env.HARBUR_API_KEY

export async function POST(req: Request) {
  try {
    const { to, subject, html } = await req.json();

    const { id } = await harbur.emails.send({
      from: "notifications@yourdomain.com",
      to,
      subject,
      html,
    });

    return NextResponse.json({ success: true, id });
  } catch (error: any) {
    return NextResponse.json({ error: error.message }, { status: 500 });
  }
}

Server Actions

app/actions/email.ts
"use server";

import { Harbur } from "harbur";

const harbur = new Harbur();

export async function sendWelcomeEmail(userEmail: string, name: string) {
  try {
    const result = await harbur.emails.send({
      from: "welcome@yourdomain.com",
      to: userEmail,
      subject: `Welcome to the team, ${name}!`,
      html: `<h1>Welcome aboard, ${name}</h1><p>We are thrilled to have you.</p>`,
    });

    return { success: true, messageId: result.id };
  } catch (error: any) {
    return { success: false, error: error.message };
  }
}