⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat: add web Sentry SDK with session replay and opt-in API tracing
Andrej284d78b35264
diff --git a/ENVIRONMENT_SETUP.md b/ENVIRONMENT_SETUP.mdindex cdd6fe3fe..67af859af 100644--- a/ENVIRONMENT_SETUP.md+++ b/ENVIRONMENT_SETUP.md@@ -97,6 +97,16 @@ Hosted multi-tenant instances should enable the cloud abuse gates. Self-hosted i- `KANEO_TURNSTILE_SITE_KEY` - Cloudflare Turnstile site key, on the **web container**. The production web image bakes the literal placeholder `KANEO_TURNSTILE_SITE_KEY` into the bundle; `apps/web/env.sh` swaps it for the runtime value when the container starts.- `VITE_TURNSTILE_SITE_KEY` - Local dev only. Set in `apps/web/.env` when running `pnpm dev`; Vite reads this at build/dev time. Not used in the production image.+#### Sentry (error monitoring)++All Sentry integration is opt-in; leave these unset for zero telemetry.++- `SENTRY_DSN` - Sentry DSN for the API. When unset, the Sentry SDK never initializes.+- `SENTRY_ENVIRONMENT` - Environment tag for API events (defaults to `NODE_ENV`).+- `SENTRY_TRACES_SAMPLE_RATE` - Fraction of API requests to trace for performance monitoring, `0`-`1` (default: `0`, tracing off).+- `KANEO_SENTRY_DSN` - Sentry DSN for the **web container** (browser errors, tracing, session replay). Same runtime-placeholder mechanism as `KANEO_TURNSTILE_SITE_KEY`.+- `VITE_SENTRY_DSN` - Local dev only. Set in `apps/web/.env` when running `pnpm dev`.+For a complete list of all environment variables, their descriptions, and configuration options, see the [official documentation](https://kaneo.app/docs/core/installation/environment-variables).## Common Issues & Troubleshootingdiff --git a/apps/api/src/instrument.ts b/apps/api/src/instrument.tsindex 980a268ec..811c15a5e 100644--- a/apps/api/src/instrument.ts+++ b/apps/api/src/instrument.ts@@ -1,10 +1,15 @@import * as Sentry from "@sentry/node";+const tracesSampleRate = Number.parseFloat(+ process.env.SENTRY_TRACES_SAMPLE_RATE ?? "",+);+if (process.env.SENTRY_DSN) {Sentry.init({dsn: process.env.SENTRY_DSN,environment:process.env.SENTRY_ENVIRONMENT ?? process.env.NODE_ENV ?? "production",sendDefaultPii: false,+ tracesSampleRate: Number.isFinite(tracesSampleRate) ? tracesSampleRate : 0,});}diff --git a/apps/web/.env.production b/apps/web/.env.productionindex 5960a372d..023c18965 100644--- a/apps/web/.env.production+++ b/apps/web/.env.production@@ -1,3 +1,4 @@VITE_API_URL="KANEO_API_URL"VITE_CLIENT_URL="KANEO_CLIENT_URL"-VITE_TURNSTILE_SITE_KEY="KANEO_TURNSTILE_SITE_KEY"\ No newline at end of file+VITE_TURNSTILE_SITE_KEY="KANEO_TURNSTILE_SITE_KEY"+VITE_SENTRY_DSN="KANEO_SENTRY_DSN"diff --git a/apps/web/package.json b/apps/web/package.jsonindex 2173d39ac..0dbb87286 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -38,6 +38,7 @@"@radix-ui/react-switch": "^1.3.7","@radix-ui/react-tabs": "^1.1.21","@radix-ui/react-tooltip": "^1.2.16",+ "@sentry/react": "^10.69.0","@tailwindcss/vite": "^4.3.3","@tanstack/react-query": "^5.101.4","@tanstack/react-query-devtools": "^5.101.4",diff --git a/apps/web/src/instrument.ts b/apps/web/src/instrument.tsnew file mode 100644index 000000000..108458575--- /dev/null+++ b/apps/web/src/instrument.ts@@ -0,0 +1,21 @@+import * as Sentry from "@sentry/react";++const dsn = import.meta.env.VITE_SENTRY_DSN;++// In Docker builds the DSN is the literal "KANEO_SENTRY_DSN" placeholder until+// env.sh substitutes it at container start; skip init if it was never replaced.+if (dsn && !dsn.startsWith("KANEO_")) {+ Sentry.init({+ dsn,+ environment: import.meta.env.MODE,+ release: __APP_VERSION__,+ sendDefaultPii: false,+ integrations: [+ Sentry.browserTracingIntegration(),+ Sentry.replayIntegration(),+ ],+ tracesSampleRate: 0.1,+ replaysSessionSampleRate: 0.1,+ replaysOnErrorSampleRate: 1.0,+ });+}diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsxindex 09f26321d..e2c8bb9df 100644--- a/apps/web/src/main.tsx+++ b/apps/web/src/main.tsx@@ -1,3 +1,5 @@+import "./instrument";+import { QueryClientProvider } from "@tanstack/react-query";import { createRouter, RouterProvider } from "@tanstack/react-router";import { StrictMode } from "react";diff --git a/apps/web/src/vite-env.d.ts b/apps/web/src/vite-env.d.tsindex bdc1907cf..bca270bb7 100644--- a/apps/web/src/vite-env.d.ts+++ b/apps/web/src/vite-env.d.ts@@ -5,6 +5,7 @@ declare const __APP_VERSION__: string;type ImportMetaEnv = {readonly KANEO_API_URL: string;+ readonly VITE_SENTRY_DSN?: string;};type ImportMeta = {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a20830ba3..5cb7a6ddf 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -325,6 +325,9 @@ importers:'@radix-ui/react-tooltip':specifier: ^1.2.16version: 1.2.16(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@sentry/react':+ specifier: ^10.69.0+ version: 10.69.0([email protected])'@tailwindcss/vite':specifier: ^4.3.3version: 4.3.3([email protected](@types/[email protected])([email protected])([email protected])([email protected]))@@ -3417,6 +3420,14 @@ packages:'@selderee/[email protected]':resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==}+ '@sentry/[email protected]':+ resolution: {integrity: sha512-e/u1Abj0zRPwR/deGZAP3GOULrsx67/XXnM5Skniqs4uxTsdNtPek1Nef0tpxwaQJYxwh6pWdhswLPPbbPOgBQ==}+ engines: {node: '>=18'}++ '@sentry/[email protected]':+ resolution: {integrity: sha512-8391tnm96YbR7b8SYfEA/NEIZuyb2r3SZrtAT0bhZtjlujcYWjo7gugQvk8sWLU9cAa/euD00eJoIoJvNfpd7Q==}+ engines: {node: '>=18'}+'@sentry/[email protected]':resolution: {integrity: sha512-fO9PLmHdVURcSPUpWCItWAtgKiMwGdJHbovoSEyLplX5sxs2ugvI4CBPTrkkgqhObnZOD0CnWBKDzSVQYBKEyQ==}engines: {node: '>=14'}@@ -3425,6 +3436,10 @@ packages:resolution: {integrity: sha512-+uuqVEeiDzYuAKjZLqsROKXvRTbl/QeH0gfGRtpYib1cud4rAFWRIkFmcR7Jb7JGFYwmReyQotiTj/hcDszTZg==}engines: {node: '>=18'}+ '@sentry/[email protected]':+ resolution: {integrity: sha512-qrGz5Qaw93/IhMjlFN6uIaXeHwgHDaKGa6FkTAP6PonpkvSbGGqan6xfsENxzj9HUVoli1lZ6tMRDnt2qtSPhg==}+ engines: {node: '>=18'}+'@sentry/[email protected]':resolution: {integrity: sha512-IgArHczrZJxkgxoffHscj0NxQrG6kCazgmGQnlf3j58J1ec21YaUu8Tu+7G4Lo5tCiW3teQnwlKW1ttMXSqWRw==}engines: {node: '>=18'}@@ -3458,6 +3473,20 @@ packages:'@opentelemetry/core': ^1.30.1 || ^2.1.0'@opentelemetry/sdk-trace-base': ^1.30.1 || ^2.1.0+ '@sentry/[email protected]':+ resolution: {integrity: sha512-f0Il/JMteHjdWPNZQB3rtp1Pcj2Leb3p0KSZuv3rh0EUril9CbWtQVy5zJhoAppi+MWWmgRWa+6BpHbQf+ABQA==}+ engines: {node: '>=18'}+ peerDependencies:+ react: ^16.14.0 || 17.x || 18.x || 19.x++ '@sentry/[email protected]':+ resolution: {integrity: sha512-VF6nXvSninHcc7dC1Zme0RjkC7VgRMCixs6jKaQX5zTNeqTW3dZGSefSOVv+ZteRi3hJvVORq985VjUC9Z/0+A==}+ engines: {node: '>=18'}++ '@sentry/[email protected]':+ resolution: {integrity: sha512-uRhmNhtFGPOlM0iniVmWKAX3KVXI0le41yYK/iKdPjinT9jA3ZrmykO/Fv1v/KI5znOtwa9D6eHRnDTTMRxFrg==}+ engines: {node: '>=18'}+'@sentry/[email protected]':resolution: {integrity: sha512-0MwHrA8+nNvMIsqf8m3cXwCBlUjr6AS7N6CZvHJtY1DkqEvQqEbD5VIrhzEyHN/KMZIgQ8XeDCQRhjnXFQGRhg==}engines: {node: '>=18'}@@ -10476,12 +10505,30 @@ snapshots:domhandler: 5.0.3selderee: 0.11.0+ '@sentry/[email protected]':+ dependencies:+ '@sentry/conventions': 0.16.0+ '@sentry/core': 10.69.0++ '@sentry/[email protected]':+ dependencies:+ '@sentry/browser-utils': 10.69.0+ '@sentry/conventions': 0.16.0+ '@sentry/core': 10.69.0+ '@sentry/feedback': 10.69.0+ '@sentry/replay': 10.69.0+ '@sentry/replay-canvas': 10.69.0+'@sentry/[email protected]': {}'@sentry/[email protected]':dependencies:'@sentry/conventions': 0.16.0+ '@sentry/[email protected]':+ dependencies:+ '@sentry/core': 10.69.0+'@sentry/[email protected](@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))(@opentelemetry/[email protected](@opentelemetry/[email protected]))':dependencies:'@sentry/conventions': 0.16.0@@ -10518,6 +10565,23 @@ snapshots:'@sentry/conventions': 0.16.0'@sentry/core': 10.69.0+ '@sentry/[email protected]([email protected])':+ dependencies:+ '@sentry/browser': 10.69.0+ '@sentry/conventions': 0.16.0+ '@sentry/core': 10.69.0+ react: 19.2.8++ '@sentry/[email protected]':+ dependencies:+ '@sentry/core': 10.69.0+ '@sentry/replay': 10.69.0++ '@sentry/[email protected]':+ dependencies:+ '@sentry/browser-utils': 10.69.0+ '@sentry/core': 10.69.0+'@sentry/[email protected]':dependencies:'@apm-js-collab/code-transformer-bundler-plugins': 0.7.3@@ -11339,7 +11403,7 @@ snapshots:obug: 2.1.4std-env: 4.2.0tinyrainbow: 3.1.0- vitest: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ vitest: 4.1.10(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected]))'@vitest/[email protected]':dependencies: