Next.jsTypeScriptApp Router

The customer database your Next.js app is missing

You built the product. You have sign-up routes, Prisma models, and maybe a few separate apps. But you still have no single place to see who your customers are across all of them. TinyCRM fixes that — with one SDK call per route and zero new infrastructure.

Installation

Install the SDK. It has zero runtime dependencies and weighs under 2 KB minified.

npm install tinycrm-sdk

Or with pnpm: pnpm add tinycrm-sdk

How it connects to Next.js

TinyCRM is a pure server-side SDK. In a Next.js App Router project, you call it from Route Handlers — the same place you write your backend logic. It does not interact with the React rendering pipeline at all.

Architecture diagram

Browser → Next.js Route Handler (app/api/auth/callback/route.ts)
                    │
                    ├── Insert user to Postgres (via Prisma)
                    └── identify(user) → TinyCRM API → Your dashboard

The SDK call happens entirely within your server — no browser SDK, no client-side tracking, no cookies or fingerprinting. Customer data originates from your own database, not from the user's browser.

Works with your existing Next.js stack

TinyCRM does not replace or conflict with any tool you already use.

Prisma

Call identify() right after prisma.user.create() in your sign-up handler.

Supabase Auth

Use in the auth callback route. Works with @supabase/ssr and cookie-based sessions.

Clerk

Fire from the webhooks/clerk endpoint when user.created fires.

NextAuth.js

Call in the signIn callback or the jwt callback depending on your flow.

tRPC

Works in tRPC procedures — they run server-side and have full Node access.

Vercel Edge

The SDK targets Edge-compatible fetch. Works on Vercel Edge Functions.

Getting started: Next.js App Router

A complete integration walkthrough. For a more detailed guide, see the step-by-step Next.js CRM tutorial.

Step 1 — Create a project and get your API key

Sign up at app.tinycrm.dev, create a project for your Next.js app, and copy the API key.

Step 2 — Add the key to your environment

# .env.local
TINYCRM_API_KEY=tcrm_proj_xxxxxxxxxxxx

Step 3 — Create a shared SDK instance

// lib/tinycrm.ts
import { TinyCRM } from "tinycrm-sdk";

export const tinycrm = new TinyCRM({
  apiKey: process.env.TINYCRM_API_KEY!,
});

Step 4 — Call identify() in your sign-up route

// app/api/auth/signup/route.ts
import { NextResponse } from "next/server";
import { tinycrm } from "@/lib/tinycrm";
import { prisma } from "@/lib/prisma";

export async function POST(req: Request) {
  const { email, name } = await req.json();

  // Create user in your own database
  const user = await prisma.user.create({
    data: { email, name },
  });

  // Sync to TinyCRM (fire-and-forget — doesn't block response)
  tinycrm.identify({
    email: user.email,
    name: user.name,
    status: "free",
    params: { source: "signup_form" },
  });

  return NextResponse.json({ ok: true });
}

Step 5 — Track upgrades and plan changes

// app/api/webhooks/stripe/route.ts
import { tinycrm } from "@/lib/tinycrm";

export async function POST(req: Request) {
  const event = await verifyStripeWebhook(req);

  if (event.type === "checkout.session.completed") {
    const email = event.data.object.customer_email!;

    tinycrm.identify({
      email,
      status: "paid",
      params: {
        plan: event.data.object.metadata.plan,
        stripe_customer_id: event.data.object.customer as string,
      },
    });
  }

  return new Response("ok");
}

Step 6 — Ping on meaningful activity

// Anywhere in your API routes
import { tinycrm } from "@/lib/tinycrm";

// Update last_activity timestamp without changing status/params
tinycrm.ping({ email: session.user.email });

Performance considerations

Fire-and-forget: Don't await the identify() call in request handlers where latency matters. The SDK returns a Promise — dropping it means the HTTP response returns immediately while the tracking request happens in the background.

Edge Runtime: The SDK uses native fetch with no Node.js-only APIs, making it fully compatible with Next.js Edge Runtime and Vercel Edge Functions.

Bundle size: The SDK is server-side only — it never appears in your browser bundle. No impact on Lighthouse scores or Core Web Vitals.

Error handling: All errors are swallowed silently by default (silent: true). A TinyCRM API outage will never break your sign-up flow.

Next.js FAQ

Does TinyCRM work with the Next.js App Router?

Yes. Call identify() from any Route Handler (app/api/**/route.ts). The SDK uses native fetch and runs on Node.js 18+ and the Edge Runtime.

Can I use TinyCRM with Prisma?

Absolutely. The SDK is independent of your ORM. Call identify() after you insert a user record with Prisma — the two operate side-by-side without conflict.

Will TinyCRM slow down my Next.js API route?

The identify() call is a single lightweight HTTP request. For zero latency impact, fire it without await (fire-and-forget). The SDK swallows errors silently by default so it never breaks your route.

Does the SDK run in the browser?

No. tinycrm-sdk is a server-side SDK — call it from API routes, server actions, or middleware only. Never import it in a client component.

Ready to know your Next.js customers?

14-day free trial. No credit card required. Takes 10 minutes to integrate.

Start free trial
npm install tinycrm-sdk