Patchly is an AI-powered error tracking service. It captures production errors, groups them by fingerprint, reads your source code from GitHub, and generates fix suggestions using an LLM.
patchly in your appnpm install patchly
import { init } from "patchly";
const patchly = init({
dsn: process.env.PATCHLY_DSN!, // from patchly.cc → Settings → your project
release?: string, // optional — app version, enables source map lookup
userId?: string, // optional — track affected users
autoCapture?: boolean, // default: true — captures uncaught exceptions automatically
});
patchly.capture(error: Error); // manual capture
await patchly.close(); // flush on graceful shutdown (Node.js)
instrumentation.ts — server-side auto-captureCreate at the project root:
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
const { init } = await import("patchly");
init({ dsn: process.env.PATCHLY_DSN! });
}
}
Enable in next.config.ts:
const nextConfig = {
experimental: { instrumentationHook: true },
};
export default nextConfig;
app/error.tsx — client-side error boundary"use client";
import { useEffect } from "react";
import { init } from "patchly";
const patchly = init({ dsn: process.env.NEXT_PUBLIC_PATCHLY_DSN! });
export default function Error({ error, reset }: { error: Error; reset: () => void }) {
useEffect(() => { patchly.capture(error); }, [error]);
return (
<div>
<h2>Something went wrong</h2>
<button type="button" onClick={reset}>Try again</button>
</div>
);
}
.env.localPATCHLY_DSN=https://<key>@api.patchly.cc/<projectId>
NEXT_PUBLIC_PATCHLY_DSN=https://<key>@api.patchly.cc/<projectId>
import { init } from "patchly";
const patchly = init({ dsn: process.env.PATCHLY_DSN! });
// Uncaught exceptions are captured automatically via process.on("uncaughtException").
// Graceful shutdown — flush remaining events
process.on("SIGTERM", async () => {
await patchly.close();
process.exit(0);
});
PATCHLY_DSN in your .env and run the appthrow new Error("patchly test")Log in at patchly.cc → Settings → create or select a project → copy the DSN.