1. Install the package

Run this command from your project directory.

npm install @ashkarhq/browser

2. Connect Ashkar to your project

Copy the public project key from Setup and run this once when your app starts.

import { init } from "@ashkarhq/browser";

export const ashkar = init({
  dsn: "https://app.ashkarhq.ir/api/v1/events",
  projectKey: "YOUR_PUBLIC_KEY",
  environment: "production",
  release: "web@1.0.0",
});

3. Send a test error

Run this once for verification, then remove it after the error arrives.

await ashkar.captureException(
  new Error("Ashkar JavaScript test"),
);
await ashkar.flush();

4. Find the error in Ashkar

Open the dashboard, enter your project and look for “Ashkar JavaScript test” in Issues. When it appears, the connection is ready.