Setup guide
Every step here is also in the dashboard, under your project's Setup tab, with your own key already filled in.
Before you start
- Create an account and an organization.
- Create a project and pick its stack. Each project gets its own key, which starts with
smk_.
In the examples below, replace smk_YOUR_PROJECT_KEY with that key.
With the installer
Run this in the root of your app. It finds your stack, asks you to sign in through the browser, shows every change it wants to make, and applies them only after you say yes.
curl -fsSL https://app.stackmon.dev/install | shOn Windows, in PowerShell:
irm https://app.stackmon.dev/install.ps1 | iexUseful flags for stackmon init:
--yesapplies the changes without asking, for scripts.--stack goskips detection when your repo holds more than one kind of app.--key smk_…uses a project key instead of the browser sign-in.
Run stackmon status later to check that events are arriving.
Laravel
Install the package
composer config repositories.stackmon composer https://app.stackmon.dev/packages/composer
composer require stackmon/stackmon-laravel
Add these lines to .env
STACKMON_KEY=smk_YOUR_PROJECT_KEY
STACKMON_ENDPOINT=https://app.stackmon.dev/api/v1/events
STACKMON_RELEASE=1.0.0
Unhandled exceptions are reported from then on. To send error logs as well, add a channel in config/logging.php:
'stackmon' => ['driver' => 'stackmon', 'level' => 'info'],
PHP
composer config repositories.stackmon composer https://app.stackmon.dev/packages/composer
composer require stackmon/stackmon-php
Start it as early as possible, for example at the top of public/index.php:
StackMon\StackMon::init([
'key' => getenv('STACKMON_KEY'),
'endpoint' => 'https://app.stackmon.dev/api/v1/events',
'release' => '1.0.0',
'environment' => 'production',
]);
Go
go env -w GOPROXY=https://app.stackmon.dev/packages/go,https://proxy.golang.org,direct GONOSUMDB=stackmon.dev
go get stackmon.dev/go@latest
Other modules still come from proxy.golang.org. Set the same two variables in CI.
Start it first thing in main:
import stackmon "stackmon.dev/go"
func main() {
stackmon.Init(stackmon.Options{
Key: os.Getenv("STACKMON_KEY"),
Endpoint: "https://app.stackmon.dev/api/v1/events",
Release: "1.0.0",
})
defer stackmon.Flush(2 * time.Second)
handler := stackmon.Middleware(mux) // reports panics in HTTP handlers
http.ListenAndServe(":8080", handler)
}
Report any other error with stackmon.CaptureError(err). In goroutines, add defer stackmon.Recover(). stackmon.SlogHandler turns slog error logs into events.
Flutter
flutter pub add 'stackmon_flutter:{"hosted":"https://app.stackmon.dev/packages/pub","version":"^0.1.0"}'
Wrap your app in lib/main.dart:
import 'package:stackmon_flutter/stackmon_flutter.dart';
void main() {
StackMon.run(
() => runApp(const MyApp()),
options: const StackMonOptions(
key: 'smk_YOUR_PROJECT_KEY',
endpoint: 'https://app.stackmon.dev/api/v1/events',
release: '1.0.0',
),
);
}
Flutter web is not supported yet.
Android
Add the repository in settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://app.stackmon.dev/packages/maven") }
}
}
Add the dependency in app/build.gradle.kts:
dependencies {
implementation("dev.stackmon:stackmon-android:0.1.0")
}
Add the key to AndroidManifest.xml:
<application ...>
<meta-data android:name="dev.stackmon.key" android:value="smk_YOUR_PROJECT_KEY" />
<meta-data android:name="dev.stackmon.endpoint" android:value="https://app.stackmon.dev/api/v1/events" />
</application>
No code is needed: StackMon starts before Application.onCreate, so crashes during app start are caught too. A crash is sent the next time the app opens.
iOS and macOS
In Xcode, choose File, Add Package Dependencies, and paste:
https://app.stackmon.dev/packages/git/stackmon-swift.gitChoose version 0.1.0 and add the StackMon library to your app target. Then start it when the app launches:
import StackMon
@main
struct MyApp: App {
init() {
StackMon.start(StackMonOptions(
key: "smk_YOUR_PROJECT_KEY",
endpoint: URL(string: "https://app.stackmon.dev/api/v1/events")!
))
}
var body: some Scene { WindowGroup { ContentView() } }
}
With UIKit, call StackMon.start in application(_:didFinishLaunchingWithOptions:). A crash is sent the next time the app opens.
Any other language
Send a JSON event over HTTP:
curl -X POST https://app.stackmon.dev/api/v1/events \
-H "X-StackMon-Key: smk_YOUR_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '{"level":"error","message":"StackMon test event"}'
AI assistants
StackMon runs an MCP server, so an assistant such as Claude Code can read your issues and help set up projects. Create a personal token in the dashboard under MCP, then add the server:
claude mcp add --transport http stackmon https://app.stackmon.dev/mcp \
--header "Authorization: Bearer smu_YOUR_TOKEN"
A token can be read-only, and it sees only the organizations you belong to.