-
Notifications
You must be signed in to change notification settings - Fork 152
Description
🎯 Bounty: Alarms System - Database, API & Dashboard UI
Bounty: $15
Overview
Build a complete alarms system that allows users to create custom notification alarms, configure notification channels (Slack, Discord, Email, Webhook), and assign alarms to trigger on various events (uptime, analytics, errors, etc.).
This issue uses the new @databuddy/notifications package located at packages/notifications/.
Requirements
1. Database Schema (Required)
Create the database table(s) and migrations for storing alarms.
Schema Fields:
id- Unique identifier (nanoid)user_id/organization_id- Owner referencewebsite_id- Optional website associationname- Alarm name (required)description- Alarm description (optional)enabled- Boolean, whether alarm is activenotification_channels- Array of channels (slack,discord,email,webhook)slack_webhook_url- Optional Slack webhook URLdiscord_webhook_url- Optional Discord webhook URLemail_addresses- Array of email addresseswebhook_url- Optional custom webhook URLwebhook_headers- JSON object for custom headerstrigger_type- Type of trigger (uptime,traffic_spike,error_rate,goal,custom)trigger_conditions- JSON object for trigger conditions/thresholdscreated_at- Timestampupdated_at- Timestamp
Acceptance Criteria:
- Drizzle schema created in
packages/db/src/drizzle/schema.ts - Relations properly defined
- Migration runs successfully
- Indexes on
user_id,organization_id,website_id,enabled
2. API Endpoints (Required)
Create ORPC endpoints for alarm CRUD operations.
Endpoints:
alarms.list- List all alarms for user/organizationalarms.get- Get single alarm by IDalarms.create- Create new alarmalarms.update- Update existing alarmalarms.delete- Delete alarmalarms.test- Send test notification to configured channels
Acceptance Criteria:
- All endpoints created in
packages/rpc/src/routers/alarms.ts - Proper Zod validation schemas
- Authorization checks (user can only access their own alarms)
- Test notification uses
@databuddy/notificationspackage - Proper error handling and responses
3. Dashboard UI (Required)
Create the alarms management UI in the dashboard settings.
Pages/Components:
- Settings → Notifications page with alarms list
- Create/Edit alarm modal or page
- Channel configuration (add Slack URL, Discord URL, emails, webhook)
- Trigger type selection and condition configuration
- Test notification button
- Enable/disable toggle
Acceptance Criteria:
- UI matches existing dashboard design patterns
- Uses existing UI components (
Button,Input,Select,Dialog, etc.) - Mobile responsive
- Form validation with proper error messages
- Loading states and optimistic updates
- Success/error toasts using Sonner
- Uses Phosphor icons (not Lucide)
4. Testing (Required)
Acceptance Criteria:
- API endpoint tests in
packages/rpc/src/routers/alarms.test.ts - Test alarm creation, update, delete operations
- Test authorization (user cannot access others' alarms)
- Test validation (invalid webhook URLs, empty required fields)
Technical Requirements
- Follow existing codebase patterns and conventions
- Use
bunfor all package management (never npm/pnpm) - TypeScript with strict types (no
any,unknown, ornever) - Use
dayjsfor dates (neverdate-fns) - Use Tanstack Query for data fetching hooks
- Use Jotai for any local state if needed
- Proper error boundaries
- Use
roundedclass (notrounded-xlorrounded-md)
Design Reference
The UI should match the existing dashboard design. Reference these for patterns:
apps/dashboard/app/(main)/settings/- Settings page patternsapps/dashboard/components/- Existing component patterns- Current notification settings page at
apps/dashboard/app/(main)/settings/notifications/page.tsx(currently shows "Coming Soon")
Files to Reference
packages/notifications/- Notification providers and helperspackages/db/src/drizzle/schema.ts- Database schema patternspackages/rpc/src/routers/- API router patternspackages/validation/src/schemas/- Validation schema patterns
Submission Requirements
- All code follows linting rules (run
bun run lint) - Type checks pass (run
bun run check-types) - Tests pass
- PR includes screenshots of the UI
- PR description explains implementation choices
Questions?
Comment on this issue for any clarification needed before starting.