Add the runtime SDK
Install the npm package in the frontend you want to monitor.
npm install @mrdhanwani/conchThis is the full working map: npm package setup, runtime monitoring, AI ecommerce builder, public storefront APIs, deployments, route protection, and production env setup.
The SDK is a small JavaScript runtime client. It works in browser apps and Node runtimes, uses fetch, and posts JSON events to your CONCH backend.
Install the npm package in the frontend you want to monitor.
npm install @mrdhanwani/conchInitialize once near your app root with an ingest endpoint and API key.
import { initConch } from "@mrdhanwani/conch";
initConch({
apiKey: "conch_xxxxx",
endpoint: "/api/ingest/event",
appName: "storefront",
environment: "production",
});Capture exceptions, messages, or custom events with metadata that helps explain what happened.
import { captureException } from "@mrdhanwani/conch";
captureException(error, {
codeSnippet: "cart.items.map(renderLineItem)",
metadata: { route: "/checkout" },
});Call this once when your app starts. It stores the API key, endpoint, app name, environment, release, default metadata, custom headers, and optional hooks.
initConch({
apiKey: "conch_project_api_key",
endpoint: "https://your-backend.com/api/ingest/event",
appName: "checkout-web",
environment: "production",
release: "1.3.0",
metadata: { team: "growth", region: "in" },
headers: { "X-App-Version": "1.3.0" },
beforeSend(payload) {
return payload.errorMessage?.includes("ResizeObserver") ? null : payload;
},
onError(error) {
console.error("CONCH failed to report", error);
},
});Use this for real Error objects. CONCH keeps the name, message, stack trace, optional code snippet, and runtime metadata.
try {
await checkout();
} catch (error) {
captureException(error, {
codeSnippet: "await checkout()",
metadata: { route: "/checkout", cartId: cart.id },
});
}Use this for warnings, failed states, or non-Error cases where you still want an incident trail.
captureMessage("Payment gateway returned an empty response", {
metadata: {
route: "/checkout",
gateway: "stripe",
},
});Use this when you already have a normalized payload from another logger or custom error boundary.
captureEvent({
errorName: "HydrationError",
errorMessage: "Client and server markup did not match",
stackTrace: stack,
codeSnippet: "render(<App />)",
metadata: { route: window.location.pathname },
});Use this for debugging integration setup. It does not reveal the API key, only whether one exists.
const config = getConchConfig();
console.log(config);
// {
// initialized: true,
// endpoint: "...",
// appName: "checkout-web",
// environment: "production",
// release: "1.3.0",
// hasApiKey: true
// }CONCH is not trying to generate every possible website category today. The supported builder lane is ecommerce: stores, catalogs, product pages, cart interactions, saved products, and customer capture.
The builder turns a prompt and optional logo into an ecommerce-style site draft. It creates pages, navigation, hero copy, sections, product-like cards, catalog categories, cart controls, favourite actions, and a customer capture form.
When a generated draft is linked, CONCH creates a store record and product records. The public storefront API can then read products and write carts, favourites, and customer details.
The deployment area manages repository metadata and preview routing. For generated ecommerce stores, the public route can render the linked storefront with working cart, favourites, and lead capture.
The deployment dashboard imports GitHub repositories, detects the stack, stores project settings, records deployment runs, and exposes path-based previews under /site/:slug.
The backend expects an API key in X-API-KEY or the request body. It stores the log against the matching project and queues analysis.
Send at least an error message. Stack trace, code snippet, and metadata are optional but useful.
POST /api/ingest/event
X-API-KEY: conch_project_api_key
Content-Type: application/json
{
"errorName": "TypeError",
"errorMessage": "Cannot read properties of undefined",
"stackTrace": "TypeError: ...",
"codeSnippet": "user.name.toUpperCase()",
"metadata": {
"browser": "Chrome",
"os": "Windows",
"url": "https://example.com/checkout",
"userAgent": "Mozilla/5.0 ..."
}
}The npm SDK sends runtime failures to the backend ingest route. The backend validates the project API key, stores the log, and queues AI analysis for root cause notes.
Most production breakage comes from the browser calling localhost or the backend blocking the deployed origin. These are the env names that matter.
NEXT_PUBLIC_BACKEND_URLFrontendPublic backend origin used by browser API calls in production.
NEXT_PUBLIC_BASE_URLFrontendLegacy public backend origin. Prefer NEXT_PUBLIC_BACKEND_URL now.
CLIENT_URLBackendComma-separated frontend origins allowed for credentialed CORS.
PUBLIC_APP_URLBackendBase URL used to generate /site/:slug preview links.
PLATFORM_DOMAINBackendDomain suffix used for reserved preview domains.
GEMINI_API_KEYBackendEnables AI builder generation. Without it, the builder falls back to a local draft.
CLOUDINARY_*BackendRequired for product/logo image uploads.
Start in the builder for ecommerce pages, use deployments for public preview links, and add the SDK to any JavaScript app you want to monitor.