Nuxt 3Vue.jsNitro

One customer view for all your Nuxt applications

Nuxt 3's server/ directory is a full Nitro server — it can run API routes, webhooks, and middleware entirely on the server. TinyCRM plugs into that layer with a single npm install: no Vue plugins, no configuration, no browser scripts. Just call identify() and move on.

Installation

npm install tinycrm-sdk

Add to .env:

TINYCRM_API_KEY=tcrm_proj_xxxxxxxxxxxx

Nuxt 3 + Nitro architecture

Nuxt 3 uses Nitro as its server engine. Files in server/ are Nitro event handlers — they have full server-side Node.js access and are never sent to the browser.

server/
  utils/
    tinycrm.ts         ← Shared SDK instance
  api/
    auth/
      signup.post.ts   ← POST /api/auth/signup — call identify() here
      session.get.ts   ← GET /api/auth/session
  routes/
    webhooks/
      stripe.post.ts   ← Webhooks — call identify() on paid conversions
  middleware/
    logger.ts          ← Optional: ping on authenticated requests

Getting started: Nuxt 3 integration

Step 1 — Create a server utility for the SDK

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

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

Step 2 — Identify customers in a Nitro API route

// server/api/auth/signup.post.ts
import { tinycrm } from "~/server/utils/tinycrm";
import { useDB } from "~/server/utils/db";

export default defineEventHandler(async (event) => {
  const { email, name } = await readBody(event);
  const db = useDB();

  const user = await db.insert(users).values({ email, name }).returning();

  // TinyCRM identify — fire and forget
  tinycrm.identify({
    email: user[0].email,
    name: user[0].name,
    status: "free",
    params: { source: "web_signup" },
  });

  return { ok: true };
});

Step 3 — Track paid conversions from webhooks

// server/routes/webhooks/stripe.post.ts
import { tinycrm } from "~/server/utils/tinycrm";

export default defineEventHandler(async (event) => {
  const body = await readRawBody(event);
  const stripeEvent = await verifyStripeWebhook(body!, getHeader(event, "stripe-signature")!);

  if (stripeEvent.type === "customer.subscription.created") {
    const email = stripeEvent.data.object.metadata.email;
    tinycrm.identify({
      email,
      status: "paid",
      params: {
        plan: stripeEvent.data.object.metadata.plan,
        interval: stripeEvent.data.object.items.data[0].plan.interval,
      },
    });
  }

  return { received: true };
});

Step 4 — Use with Nuxt Auth Utils

// server/api/auth/github.get.ts
// Using nuxt-auth-utils (sidebase/nuxt-auth-utils)
import { tinycrm } from "~/server/utils/tinycrm";

export default oauthGitHubEventHandler({
  async onSuccess(event, { user }) {
    await setUserSession(event, { user });

    // Identify after OAuth sign-in
    tinycrm.identify({
      email: user.email,
      name: user.name,
      status: "free",
      params: { provider: "github" },
    });

    return sendRedirect(event, "/dashboard");
  },
});

Nuxt ecosystem compatibility

Drizzle ORM

Call identify() after db.insert().

Prisma

Works after prisma.user.create().

nuxt-auth-utils

Integrate in OAuth success handlers.

Nuxt Hub (Cloudflare)

Compatible with CF Workers runtime.

Nuxt Pinia

No interaction — SDK is server-only.

Vercel

Works with @nuxtjs/vercel preset.

Nuxt FAQ

Does tinycrm-sdk work with Nuxt 3 server routes?

Yes. Nuxt 3 server routes in server/api/ and server/routes/ are powered by Nitro and run in a Node.js environment. Import and call tinycrm.identify() from any of these handlers.

Can I use TinyCRM in a Nuxt composable?

No — composables run on both client and server, and the SDK must remain server-only. Use it exclusively inside server/ directory files. Your Vue composables can call $fetch('/api/your-endpoint') which internally calls TinyCRM.

How do I handle multi-app customer merging in a Nuxt context?

Create a separate TinyCRM project for each Nuxt app, all pointing to the same TinyCRM account. Customers are merged by email — the same person signing up across two Nuxt apps will appear as one row in your dashboard.

Does it work with the Nuxt Cloudflare or Vercel Edge presets?

Yes. The SDK uses native fetch with no Node.js-specific built-ins, making it fully compatible with Edge runtimes including the Nuxt Cloudflare and Vercel Edge Nitro presets.

Know your Nuxt customers

14-day free trial. No credit card. Works with any Nitro preset.

Start free trial
npm install tinycrm-sdk