Skip to content
Docs GitHub

init

Initialize Sentry in your project (experimental)

Usage

sentry init <target> <directory>

Initialize Sentry in your project (experimental)

Arguments:

ArgumentDescription
<target><org>/<project>, <org>/, <project>, or a directory path
<directory>Project directory (default: current directory)

Options:

OptionDescription
-y, --yesNon-interactive mode (accept defaults)
--dry-runPreview changes without applying them
--features <features>...Features to enable: errors,tracing,logs,replay,metrics,profiling,sourcemaps,crons,ai-monitoring,user-feedback
-t, --team <team>Team slug to create the project under

All commands support --json for machine-readable output and --fields to select specific JSON fields.

Experimental: sentry init is experimental and may modify your source files. Always review changes before committing.

Prerequisites: You must be authenticated first. Run sentry auth login if you haven't already.

Examples

Terminal window
# Interactive setup
sentry init
# Non-interactive with auto-yes
sentry init -y
# Dry run to preview changes
sentry init --dry-run
# Target a subdirectory
sentry init ./my-app
# Use a specific org (auto-detect project)
sentry init acme/
# Use a specific org and project
sentry init acme/my-app
# Assign a team when creating a new project
sentry init acme/ --team backend
# Enable specific features
sentry init --features profiling,replay

Target Syntax

SyntaxMeaning
(omitted)Auto-detect org and project
acme/Use org acme, auto-detect or create project
acme/my-appUse org acme and project my-app
my-appSearch for project my-app across all accessible orgs

Path-like arguments (starting with ., /, or ~) are always treated as the directory. The order of target and directory can be swapped — the CLI will auto-correct with a warning.

Available Features

FeatureDescription
errorsError monitoring
tracingPerformance tracing
logsLog integration
replaySession replay
metricsCustom metrics
profilingProfiling
sourcemapsSource map uploads
cronsCron job monitoring
ai-monitoringAI/LLM monitoring
user-feedbackUser feedback widget

What the Wizard Does

  1. Detects your framework — scans your project files to identify the platform and framework
  2. Installs the SDK — adds the appropriate Sentry SDK package to your project
  3. Instruments your code — configures error monitoring, tracing, and any selected features

Supported Platforms

  • JavaScript / TypeScript — Next.js, Express, SvelteKit, React
  • Python — Flask, FastAPI

More platforms and frameworks are coming soon.