Choosing an adapter

Where your feedback lives — Prisma or Drizzle for production, memory for tests and demos, localStorage for client-only setups.

An adapter is the storage layer behind SitePing. All four implement the same SitepingStore contract (6 methods), so you can swap them without touching the widget.

AdapterWhere data livesUse it for
@siteping/adapter-prismaYour database, via PrismaProduction — the standard setup
@siteping/adapter-drizzlePostgreSQL or Turso / libSQL, via Drizzle ORMProduction on a Drizzle codebase — tables in your schema, serverless drivers like Neon HTTP
@siteping/adapter-memoryAn in-process arrayTests, previews, throwaway demos
@siteping/adapter-localstorageThe visitor's browserClient-side demos and prototypes — no server at all

Need a different backend? Write your own with @siteping/adapter-kit.

Screenshots stay inline in the feedback unless the Prisma or Drizzle store gets a screenshotStorage: @siteping/screenshot-storage sends them to Cloudflare R2, AWS S3, Cloudflare Images, your database or your disk.

Two ways to mount a store

Server mode — the widget talks to an HTTP endpoint, and the endpoint talks to the store. This is the production shape:

// app/api/siteping/route.ts
import { createSitepingHandler } from "@siteping/adapter-prisma";
import { prisma } from "@/lib/prisma";

export const { GET, POST, PATCH, DELETE, OPTIONS } = createSitepingHandler({ prisma });

Any other store mounts the same way with @siteping/server: createSitepingHandler({ store }).

Client-side mode — the widget writes to a store directly in the browser, no server needed:

import { initSiteping } from "@siteping/widget";
import { LocalStorageStore } from "@siteping/adapter-localstorage";

initSiteping({ store: new LocalStorageStore(), projectName: "my-demo" });

Writing your own adapter? Install @siteping/adapter-kit: snapshot backends get a complete store from createCollectionStore, query backends implement the 6 methods, and both verify with the shared conformance suite (67 tests). See Writing an adapter.

Edit on GitHub

On this page