SDK Integration
Integrate the Claron SDK into your build workflow. The SDK compiles secure, opaque source mapping hashes directly into your application, unlocking exact file/line bug positioning and automated AI fixes in production without exposing your code structures.
SECURITY POLICY
Opaque Cryptographic Hashing
Source maps are NEVER exposed to the public browser. The SDK compiles encrypted data-claron-src tokens while the manifest and source maps remain private in Claron's R2-backed deployment storage.
ZERO-CONFIG BUNDLER SETUP
Install @claron/sdk, then load the plugin in your framework configuration with zero arguments. It automatically resolves keys from your local environment variables or configuration files.
Next.js Setup
Vite Setup
EXPECTED SDK OUTPUTS
Compilation & Build Outputs
- data-claron-src Injection
- Instrumented JSX/TSX elements receive an opaque encrypted source token: <button data-claron-src="cl1....">.
- Local Manifest
- Creates .claron/locations-manifest.json with loc1.<digest> entries and source file, line, and column metadata for deployment indexing.
- Source Map Payload
- Gzips and uploads source maps plus the manifest to /api/v1/sdk/deployments; the API stores them privately in R2.
EDGE CASES & COMPILER BEHAVIOR
Compiler Safeguards & Fallbacks
- Missing API Keys
- If CLARON_PROJECT_ID or CLARON_API_KEY is missing, the build logs a warning and skips deployment upload. The build does NOT fail.
- Non-Production Builds
- Production is enabled by default; set CLARON_ENABLED=false to disable tagging and uploads. Development environments stay disabled unless explicitly enabled.
- Dynamic / Runtime Elements
- Elements created dynamically at runtime via innerHTML do not have build-time data-claron-src tokens; the extension falls back to durable DOM context and selectors.
- Third-Party Libraries
- Libraries in node_modules are excluded; annotations fall back to the closest parent element with a valid data-claron-src or durable target identity.
WHAT TO DO IF THE SDK FAILS
Emergency Switch: Build is Crash-Gated
If you suspect the SDK is causing compile errors or blocking your deployment builds, you can bypass all SDK activities completely by setting the CLARON_ENABLED=false environment variable on your CI/CD provider. This shuts down all compiler transformation hooks instantly.
Dashboard Shows 'Source Resolution Unavailable'
Verify that the production build environment has CLARON_PROJECT_ID and CLARON_API_KEY variables set, that your package manager successfully runs the prepare script during build time, and that the Git commits match exactly between your deployed client version and dashboard build.
