feat: persist webhooks to SQLite, add delivery UI, and switch event i…#826
Merged
joelpeace48-cell merged 2 commits intoJun 30, 2026
Merged
Conversation
…ndexer to Horizon SSE - Migration 028: add `webhooks` and `webhook_deliveries` tables with cascade delete and retry index - Replace in-memory Map WebhookRepository with sqliteWebhookRepository backed by better-sqlite3 - Add missing webhook routes: GET delivery by ID, POST replay, POST test, POST /verify (public, no auth) - Wire event indexer to Horizon SSE ledger stream for near-instant indexing; fall back to 30s polling when horizonUrl is absent - Frontend: add webhook management page at /admin/webhooks with create, edit, delete, test, and delivery history with one-click replay - Remove dead import of unused createWebhookRoutes from routes/webhooks.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@Litezy is attempting to deploy a commit to the joelpeace48-cell's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Litezy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Comment on lines
+2273
to
+2288
| app.post(`${prefix}/webhooks/verify`, rateLimiter, (req, res) => { | ||
| const { signature, secret, payload } = req.body ?? {}; | ||
| if (!signature || !secret || payload === undefined) { | ||
| return res.status(400).json({ | ||
| error: 'signature, secret, and payload are required', | ||
| code: 'VALIDATION_ERROR', | ||
| }); | ||
| } | ||
| try { | ||
| const payloadStr = typeof payload === 'string' ? payload : JSON.stringify(payload); | ||
| const valid = webhookService.verifySignature(signature, secret, payloadStr); | ||
| return res.json({ valid }); | ||
| } catch { | ||
| return res.json({ valid: false }); | ||
| } | ||
| }); |
a14c6cb
into
FinesseStudioLab:main
7 of 15 checks passed
joelpeace48-cell
added a commit
that referenced
this pull request
Jun 30, 2026
feat: persist webhooks to SQLite, add delivery UI, and switch event i…
joelpeace48-cell
added a commit
that referenced
this pull request
Jun 30, 2026
feat: persist webhooks to SQLite, add delivery UI, and switch event i…
joelpeace48-cell
added a commit
that referenced
this pull request
Jun 30, 2026
feat: persist webhooks to SQLite, add delivery UI, and switch event i…
joelpeace48-cell
added a commit
that referenced
this pull request
Jun 30, 2026
feat: persist webhooks to SQLite, add delivery UI, and switch event i…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #448
Closes #521
Closes #468
Summary
Mapto SQLite via a new028_webhooksmigration andsqliteWebhookRepository. Webhooks and delivery history now survive restarts.GET /webhooks/:id/deliveries/:deliveryId,POST /webhooks/:id/deliveries/:deliveryId/replay,POST /webhooks/:id/test, andPOST /webhooks/verify(public, no auth required — for consumers verifying HMAC signatures).getEventsfetch instead of a 30s blind poll. Falls back to a 30s interval ifHORIZON_URLis not configured./admin/webhookswith create/edit/delete, event subscription checkboxes, one-click test delivery, and a delivery history modal with status badges and replay buttons.What changed
backend/src/db/migrations/028_webhooks.jswebhooks+webhook_deliveriestables with indexesbackend/src/dal/sqliteWebhookRepository.jsWebhookRepositorybackend/src/dal/index.jsWebhookRepository→createSqliteWebhookRepositorybackend/src/jobs/eventIndexer.jsstartSse({ contractIds, horizonUrl })with auto-reconnectbackend/src/index.jsfrontend/src/lib/apiClient.jsfrontend/src/pages/WebhookManagement.jsxfrontend/src/App.jsx/admin/webhooksbehindRequireAdminTest plan
webhooksandwebhook_deliveriestables are created on first bootPOST /api/v1/webhooks— create a webhook; verify row appears in SQLite, secret returned once onlyPOST /api/v1/webhooks/:id/test— sends a test delivery and records it inwebhook_deliveriesGET /api/v1/webhooks/:id/deliveries— delivery history returns persisted rowsPOST /api/v1/webhooks/:id/deliveries/:deliveryId/replay— replays a failed deliveryPOST /api/v1/webhooks/verify— returns{ valid: true/false }without authHORIZON_URLset: confirm/health/indexershows events processed within seconds of ledger closeHORIZON_URL: confirm fallback polling fires every 30s/admin/webhooks— create/edit/delete/test all work, delivery history modal shows with replay🤖 Generated with Claude Code