Sadaqah Box Raycast Extension
Track Your Charity & Sadaqah Contributions
Raycast extension for tracking your charitable giving (Sadaqah) with multi-currency support and gold value conversion.

Sponsor
Sponsored by erklab โ Architecting production-grade systems with AI-driven velocity and human-centered precision.
Demo
Features
๐ฆ Box Management
- Create Boxes: Organize your sadaqahs into different boxes (e.g., "Ramadan Charity", "Daily Sadaqah")
- Track Progress: Monitor total value, count, and currency breakdown for each box
- Multi-Currency Support: Handle donations in different currencies with automatic conversion tracking
โก Quick Actions
- Presets: Define preset amounts for quick donation recording (e.g., "Daily Sadaqah - 0.1g Gold")
- Keyboard Shortcuts:
โโง1-5 for quick preset access
- Default Preset: Set a preset as default for one-click adding
๐ Statistics & Reporting
- Dashboard Overview: Total boxes, sadaqahs, and value across all boxes
- Collection Receipts: Generate beautiful markdown receipts when emptying boxes
- Historical Data: Track all collections and their values over time
๐ Security & Performance
- Input Validation: All inputs validated with Zod schemas
- Request Timeouts: 30-second timeout with retry logic
- API Response Caching: Intelligent caching to reduce API calls
- Secure Error Handling: User-friendly error messages without exposing internals
- Cryptographically Secure IDs: Using
crypto.randomUUID() for ID generation
Installation
Prerequisites
- Raycast installed on macOS
- Node.js 18+ and npm
- Access to a SadaqahBox API instance
Setup
- Clone this repository:
git clone <repository-url>
cd sadaqahbox-raycast
- Install dependencies:
npm install
-
Configure the extension in Raycast:
- Open Raycast Preferences
- Go to Extensions โ Sadaqah Box
- Set the following preferences:
- API Host: Your SadaqahBox API URL (e.g.,
https://api.yourdomain.com)
- API Key: Your Better Auth API key
-
Build and install:
npm run build
Configuration
Extension Preferences
| Setting | Description | Required |
|---|
| API Host | Base URL of your SadaqahBox API | Yes |
| API Key | Better Auth API key for authentication | Yes |
Getting an API Key
- Log in to your SadaqahBox web application
- Navigate to Settings โ API Keys
- Generate a new API key
- Copy the key and paste it into Raycast preferences
Commands
Dashboard
Command: Dashboard
Main interface for managing your sadaqah boxes:
- View all boxes with their statistics
- Quick add using presets (โโง1-5)
- Open box details
- Collect/empty boxes
- Delete boxes
Manage Presets
Command: Manage Presets
Configure quick-add presets:
- Create preset amounts with names and currencies
- Set default preset for one-click adding
- Reorder presets (โโงโ/โ)
- Delete unused presets
Architecture
src/
โโโ api/
โ โโโ client.ts # Base HTTP client with timeout & retry
โ โโโ index.ts # API endpoint functions
โ โโโ cached.ts # Cached API wrappers
โโโ constants/
โ โโโ index.ts # App constants & configuration
โโโ utils/
โ โโโ cache.ts # Raycast Cache utilities
โ โโโ error-handler.ts # Error categorization & sanitization
โ โโโ security.ts # Secure ID generation
โ โโโ type-guards.ts # Runtime type checking
โโโ validation/
โ โโโ schemas.ts # Zod validation schemas
โโโ data/
โ โโโ quotes.json # Quranic verses & Hadith on sadaqah
โ โโโ quotes.ts # Quote types & utilities
โโโ services/
โ โโโ quote-service.ts # Random quote generation
โโโ dashboard.tsx # Main dashboard command
โโโ box-detail.tsx # Box detail view
โโโ create-box.tsx # Create box form
โโโ edit-box.tsx # Edit box form
โโโ add-sadaqah.tsx # Add sadaqah form
โโโ manage-presets.tsx # Preset management
โโโ collection-detail.tsx # Collection receipt view
โโโ presets-storage.ts # LocalStorage for presets
โโโ auth-client.ts # Better Auth client setup
โโโ types.ts # TypeScript type definitions
API Integration
The extension communicates with a SadaqahBox backend API. All API calls include:
- Authentication: API key via
x-api-key header
- Timeout Protection: 30-second request timeout with AbortController
- Retry Logic: Automatic retry on timeout errors
- Response Caching: Intelligent caching to minimize API calls
Cache Strategy
| Endpoint | Cache TTL | Invalidation |
|---|
| List Boxes | 5 minutes | On create/update/delete |
| Get Box | 5 minutes | On update/delete |
| Stats | 2 minutes | On any mutation |
| Currencies | 1 hour | On currency changes |
| Currency Types | 1 hour | On type changes |
| Sadaqahs | No cache | Real-time data |
| Collections | No cache | Real-time data |
Development
Available Scripts
# Development mode with hot reload
npm run dev
# Build for production
npm run build
# Run linting
npm run lint
# Fix linting issues
npm run fix-lint
# Publish to Raycast Store
npm run publish
Project Structure
- Components: Each command is a separate React component
- API Layer: Modular API functions with separation of concerns
- Utilities: Shared utilities for caching, errors, and security
- Validation: Centralized Zod schemas for input validation
Adding New Features
- New API Endpoint: Add to
src/api/index.ts and wrap in src/api/cached.ts
- New Form: Use
validation/schemas.ts for validation
- New Command: Create component in
src/ and register in package.json
Security Considerations
Input Validation
All user inputs are validated using Zod schemas:
- String length limits
- Numeric range validation
- Required field checking
- Type coercion with validation
Error Handling
- Raw errors are logged internally
- User-facing messages are sanitized
- Error categorization (network, timeout, auth, etc.)
ID Generation
- Cryptographically secure UUID generation
- No predictable IDs from timestamps
Data Sanitization
- Input sanitization to prevent XSS
- URL validation for API endpoints
Troubleshooting
Common Issues
"API Key is not configured"
- Check Raycast preferences for the extension
- Ensure API key is copied correctly
"Request timed out"
- Check internet connection
- Verify API host URL is correct
- API server may be slow/unresponsive
"Failed to load data"
- Verify API key has correct permissions
- Check API server is running
- Look at Raycast logs for details
Debug Mode
To see detailed error logs:
- Open Raycast
- Run "Toggle Debug Mode" command
- Reproduce the issue
- Check Raycast logs
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
License
MIT License - see LICENSE file for details
Acknowledgments
- Quranic verses and Hadith provided for inspiration
- Built with Raycast API
- Authentication powered by Better Auth
May your sadaqah be accepted ๐คฒ