getsentry / getsentry/sentry-javascript

Feature: simplify microfrontend project provisioning and DSN routing

Open
#21,944 4 comments 1 reaction 1 assignee Claimed by @chargome View on GitHub
Browser Feature javascript
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
515

Description

The current microfrontend setup requires manually creating a Sentry project per microfrontend and hardcoding its DSN into the bundler plugin config. For organizations with hundreds of microfrontends this doesn't scale — provisioning and wiring up each project is a significant operational burden.

**Current behavior**

- One Sentry project must be created per microfrontend
- Each DSN must be manually retrieved and embedded via `moduleMetadata` in the bundler plugin
- `makeMultiplexedTransport` handles runtime routing, but project creation is entirely out-of-band

**Gap**

The [Sentry Exporter for OpenTelemetry](https://docs.sentry.io/concepts/otlp/forwarding/pipelines/sentry-exporter/) already solves this at the collector layer with `auto_create_projects` + `routing.project_from_attribute`. There's no equivalent DX for browser microfrontends — the routing primitive exists (`makeMultiplexedTransport`) but project provisioning is a manual step that doesn't scale.

**Options**

- Auto-provision projects from the bundler plugin at build time using a server-side auth token (matches the OTel exporter model — token stays in CI, not the browser)
- Support a named-project routing mode where DSNs are resolved at build time from a project slug, eliminating the need to manually look up and embed DSNs
- A first-party CLI/script to bulk-create projects from a list and emit a DSN map for bundler consumption

**Workaround (available today)**

Projects can be bulk-created server-side and DSNs injected at build time using existing primitives:

1. **Sentry API** — `POST /api/0/teams/{org}/{team}/projects/` ([docs](https://docs.sentry.io/api/projects/create-a-new-project/)) with `project:write` scope; loop over your microfrontend list in CI to create projects and capture returned DSNs
2. **Terraform** — use the [`jianyuan/sentry`](https://registry.terraform.io/providers/jianyuan/sentry/latest/docs) or [`labd/sentry`](https://registry.terraform.io/providers/labd/sentry/latest/docs) provider with `sentry_project` + `for_each`; outputs the DSN as a resource attribute
3. Inject the resulting DSNs at build time via `moduleMetadata` in your bundler plugin config — the existing `makeMultiplexedTransport` setup ([docs](https://docs.sentry.io/platforms/javascript/best-practices/micro-frontends/)) handles runtime routing from there

The workaround is functional but requires owning the provisioning layer separately. The feature request is to make this a first-class, low-friction part of the microfrontend setup.

--

[View Junior Session in Sentry](https://sentry.sentry.io/explore/conversations/slack%3AD0AP8R5C3UH%3A1783018228.982239/?project=4510944073809921)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.