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 π€²