How to build a Sentry alternative
How to build a Sentry alternative with ordered prompts, data rules and failure checks. Deploy a focused tool with a tested export and restore path.
How to build a Sentry alternative starts with a private error inbox for one application. An application submits a bounded error event. The server groups it by a stable fingerprint, increments the issue count once and lets an owner resolve or reopen the issue. Use the Sentry catalog prompt for the wider context.
How to build a Sentry alternative with a clear v1
An application submits a bounded error event. The server groups it by a stable fingerprint, increments the issue count once and lets an owner resolve or reopen the issue. Write this flow into your README before generating screens. Keep session replay, source-map processing, tracing and arbitrary client payloads outside this version. Each would introduce a separate operating problem and a larger testing boundary.
Model the saved records
These are proposed tables for your replacement, rather than a description of the commercial product’s internals:
Project(id, owner_id, name, token_hash)
Issue(id, project_id, fingerprint, state, first_seen_at, last_seen_at)
ErrorEvent(id, project_id, source_event_key, issue_id, release, received_at)
IssueEvent(id, issue_id, kind, recorded_at)
Follow ownership from every child row to its root record. Check that relationship on reads and writes. Browser filters help navigation; server authorization determines access.
Input → validation → authorized transaction → committed revision → read/export
↓ failure
retained input
Define a bounded ingestion envelope
Accept a project token, a source event key, a release label and an allowlisted error code. Keep arbitrary request bodies, cookies and user-entered text out of the first version. Error telemetry can otherwise become an accidental copy of private application data.
Set a body-size limit before parsing JSON. Reject unknown keys and overly long strings. Rate-limit per project and cap daily retention. An ingestion token can create events only for its project; it cannot read the inbox or change issue state.
| Ingest fixture | Expected behavior |
|---|---|
| Same source key twice | One stored event |
| Unknown error code | Validation response |
| Oversized request | Rejected before persistence |
| Invalid project token | No project details disclosed |
| Repeated known code | Existing issue count increases |
Use a unique constraint on (project_id, source_event_key). Updating the issue and inserting the event belong in one transaction. If the insert conflicts, return the earlier event result without incrementing the issue again.
Keep fingerprinting predictable
For a small owned application, map known error codes to issue fingerprints. A code such as INVOICE_PDF_FAILED is more stable than a raw error string containing a changing file name. Store the mapping revision if you later change grouping rules.
Do not discard the event’s original code when grouping. An owner needs to inspect why an event belongs to an issue. A grouping change should create a deliberate migration or a new grouping version, rather than silently rewriting counts.
The first dashboard shows total received events, open issues and the last received timestamp. Label every count and its time window. “No errors today” differs from “the application has stopped submitting.” Keep a separate last-successful-ingest indicator so the owner can distinguish them.
Resolve issues without losing later failures
Resolving an issue records an owner action. Decide whether a later event reopens it; this guide reopens on any new unique event. Write that rule in the transaction and append an issue event so the timeline explains the change.
Test an owner resolving an issue at the same time as a new error arrives. Pick an ordering based on committed operations. The final state and timeline must agree. A timestamp sent by the client must never override the server’s ordering.
Add release labels to event rows, then filter without changing the issue’s lifetime totals. A release filter that rewrites the issue count can make old errors look resolved. Show filtered event totals separately from the issue’s current state.
Add one alert only after the inbox works
The first build can show a visible alert badge when an issue opens. External email delivery belongs in an outbox with retry records and suppression rules. Keep that extension separate from ingest so a mail outage never rejects an application error.
Before real use, submit only synthetic fixtures and inspect stored rows. Confirm that no request headers, access tokens or stack-local variables have slipped into diagnostics. Add structured redaction before expanding the accepted payload.
Choose the stack and write the first migration
Use Astro for server-rendered pages, HTMX for form updates, and Alpine.js for small local previews. Keep the database behind server routes. Start with SQLite on a Node host with persistent storage, or use a hosted SQL database when the application host has no persistent disk.
For a Cloudflare deployment, use an Astro server adapter and D1 bindings for the dynamic routes. A static Pages build alone cannot process these writes. Keep database access in one module so authorization and transaction rules are easy to inspect.
Add versioned migrations and a fixture command to the repository. Run the migration against both a fresh database and a populated development copy. Include foreign keys, unique constraints and indexes for the queries the main screen actually performs.
Prompt 1 builds the empty workflow
Explain the acceptance flow above to your coding agent, then send this first request:
Create a server-rendered Astro application using HTMX and Alpine.js.
Implement owner authentication with a maintained auth library.
Add the proposed SQL tables through a versioned migration.
Create an empty dashboard and a working first-record form.
Keep database credentials and session secrets on the server.
Document setup, migration and fixture commands in the README.
Run the app, create the first record and reload. Restart the process and read it again. An empty database should show a useful create action. A failed database connection should show a recoverable error instead of pretending there are no records.
Check the signed-out response directly. Private data must be absent from the response body, including serialized browser state. Use two owner accounts in development to check that changing an identifier cannot cross the ownership boundary.
Prompt 2 enforces the core write
Once the domain rules below are clear, ask for their implementation:
Implement the acceptance flow with server-side validation.
Enforce the domain invariant inside the database transaction.
Use stable request keys for operations that can be retried.
Return the saved identifier and revision after commit.
Reject stale edits while preserving the submitted values for review.
Add fixtures for duplicate requests, invalid parents and denied access.
Have the agent name the exact transaction boundary. A read followed by a later unrelated write can race. Send overlapping requests from two clients and inspect the resulting rows, rather than relying on a button becoming disabled.
Give every editable record a revision. Submit the loaded revision with the form. An update should match both the authorized record id and that revision. When nothing matches, return a conflict and let the person compare their attempted change with the saved version.
Prompt 3 completes the screens
Keep previews and saved results visibly distinct:
Build the owner list, detail screen and bounded public view if required.
Use the committed server response to update the interface.
Provide loading, empty, invalid, unavailable and retry states.
Keep attempted input after a failed save.
Support keyboard use with labeled controls and field-level errors.
Do not add features outside the stated v1 acceptance flow.
Use a slow connection to make pending states visible. Submit once, interrupt the response and retry using the same request key. Reopening the page should reconcile the actual saved result. A client-side success toast should appear only after the server confirms the operation.
Render user text with escaping. For any rich text you eventually add, choose a maintained sanitizer and an explicit allowlist. Test markup inside titles and notes. It should appear as text or be sanitized according to that rule.
Export and restore before deployment
Export stable identifiers, revisions, timestamps and every relationship needed to reconstruct the workflow. Put a format version at the top of the export. Do not include session cookies, raw share tokens or API credentials in a data download.
Import into a separate database first. Validate the complete file before changing saved records. Show counts and conflicts in a preview, then require an explicit commit. A failed import must leave the previous data intact. Reject unknown future format versions with an explanation.
Restore a fixture and compare both row counts and the result of the main acceptance flow. Counts alone miss broken relationships. If you cannot reconstruct the useful screen from the export, keep working on the format before trusting it with real data.
Deploy and exercise the hosted flow
Create production storage separately from development. Apply migrations before serving code that depends on them. Set secrets through the host’s secret configuration, then deploy the server build. Confirm that the domain uses HTTPS and the session cookie has appropriate secure settings.
Open the public or signed-in entry point on the deployed hostname. Perform the full acceptance flow with synthetic records, reload, and check the owner index. Then test an unavailable id and a signed-out request. The local build cannot establish that production bindings or authorization are configured correctly.
Keep logs to request ids, operation names and outcomes. Exclude user text and credentials. Add a health check that verifies required storage access without leaking private rows. Record the deployed version so a report can be connected to a particular release.
Back up before the next migration. Keep the previous artifact available and document whether a code rollback is compatible with the new schema. Prefer additive migrations while the project is young. Test restoration into a clean environment before removing your old service.
Keep the next version bounded
The basic build completes the acceptance flow with manually entered fixtures. A stronger personal tool adds permission tests, recovery, export and concurrent-edit handling. Reproducing the wider commercial service adds integrations and continuing operations; use the catalog’s three estimate levels to choose the next step.
Stop when the defined flow works on the deployed hostname and survives a restore. Write down one missing feature only when using the tool exposes a concrete need. Keep the rest outside the next coding prompt.
Continue with the related build post and the scope guide. For another implemented workflow boundary, see the HoneyBook guide.