This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
bin/dev- Start the development server using foreman/overmind (runs Rails server + Vite)bin/rails s- Start Rails server onlybin/vite dev- Start Vite development server only
Important: Do NOT run bin/dev or bin/rails s - assume the development server is already running. Only use these commands if explicitly asked to start the server.
bin/rails test- Run all testsbin/rails test test/models/- Run model testsbin/rails test test/controllers/- Run controller testsbin/rails test test/integration/- Run integration tests
bin/rails db:setup- Create, migrate and seed databasebin/rails db:migrate- Run migrationsbin/rails db:rollback- Rollback last migrationbin/rails db:reset- Drop, create, migrate and seed database
bin/rubocop- Run Ruby linter (configured for Rails omakase)bundle exec brakeman- Run security scanner
bin/rails "email:test[your-email@example.com]"- Test email configurationbin/rails "email:test_resend[your-email@example.com]"- Test Resend API specifically
bin/rails "invitations:cleanup"- Clean up expired invitationsbin/rails "reminders:process"- Send daily payment reminders (runs automatically via SolidQueue)bin/rails "reminders:stats"- Show reminder system statisticsbin/rails "reminders:test[project_id]"- Test reminder system for a specific project
bin/rails telegram:setup_webhook- Configure webhook for development/productionbin/rails telegram:webhook_info- Check webhook status and configurationbin/rails telegram:remove_webhook- Remove webhooksbin/rails telegram:reset_webhook- Reset webhook (remove and setup)bin/rails telegram:test_webhook- Test webhook endpoint locally- Bot responds to commands:
/start,/help,/status,/payments,/pay,/settings,/unlink
- Backend: Ruby on Rails 8.0+ with Inertia.js for frontend integration
- Frontend: Svelte 5 with TypeScript, TailwindCSS, and ShadcnUI components
- Database: SQLite with SolidCache, SolidQueue, SolidCable for caching/jobs
- Authentication: Magic link authentication with bcrypt sessions
- Build System: Vite for frontend asset compilation
- Project: Main subscription entity with cost splitting logic (
app/models/project.rb:158) - BillingCycle: Represents billing periods with payment tracking (
app/models/billing_cycle.rb:68) - Payment: Individual payment records with evidence uploads
- User: Authentication and profile management with magic links and Telegram integration
- ProjectMembership: Join table for project access control
- Invitation: Email-based invitation system for project members
- TelegramMessage: Telegram notification tracking and delivery status
- Currency Support: Multi-currency support via
CurrencySupportconcern - Billing Frequency: Configurable billing cycles (daily, weekly, monthly, quarterly, yearly)
- Cost Splitting: Automatic per-member cost calculation based on project membership
- Payment Tracking: Evidence upload, confirmation workflow, and reminder system
- Archive Policy: Automatic archiving of old billing cycles based on configuration
- Inertia.js: Server-driven SPA with Svelte components
- Layout System: Multiple layouts (auth, admin, main) in
app/frontend/layouts/ - Component Structure: Reusable UI components in
app/frontend/lib/components/ - Routing: Rails routes with Inertia page components in
app/frontend/pages/
- Magic Links: Primary authentication method via
MagicLinkmodel - Sessions: Managed through
Sessionmodel andAuthenticationconcern - Authorization: Role-based access (owner/member) via
Authorizationconcern - Admin Access: HTTP Basic auth for admin routes (
/admin/*)
- Primary: Resend API for production email delivery
- Fallback: SMTP configuration support
- Development: Letter Opener for email preview at
/letter_opener - Templates: ERB templates in
app/views/*_mailer/with both HTML and text versions
- Bot Framework: telegram-bot-ruby gem for Telegram API integration
- Account Linking: Users can link Telegram accounts via verification tokens in profile settings
- Notifications: Payment reminders, billing cycle alerts, and payment confirmations via Telegram
- Bot Commands: Interactive commands including
/start,/help,/status,/payments,/pay,/settings,/unlink - Services:
TelegramBotServicefor webhook processing,TelegramNotificationServicefor message formatting - Jobs:
TelegramNotificationJobfor asynchronous delivery - Models:
TelegramMessagefor delivery tracking and status - Webhooks: Primary integration method via
TelegramControllerat/telegram/webhook - Routes: Profile integration routes for token generation, status checking, unlinking, and notification preferences
- Testing: Full webhook endpoint testing with mocked service calls
- Queue: SolidQueue for job processing
- Billing Jobs: Automatic billing cycle generation and archiving
- Reminder Jobs: Automated payment reminder system
- Email Jobs: Asynchronous email delivery
- Telegram Jobs: Asynchronous Telegram notification delivery
- Active Storage: For payment evidence uploads
- Security: Secure file access with token-based downloads
- Development: Local storage in
storage/directory
- Billing Configuration: Global settings for billing frequencies and policies
- Error Monitoring: SolidErrors dashboard at
/admin/errors - Project Management: Admin oversight of all projects
- Rate Limiting: Rails 8 native rate limiting for magic link requests and invitations
- CSRF Protection: Standard Rails CSRF tokens
- Content Security Policy: Configured CSP headers
- Parameter Filtering: Sensitive data excluded from logs
- Error Handling: Comprehensive exception handling with notifications
- Email Verification: Magic link verification for invitation security
- Audit Logging: Security event logging for invitation and authentication flows
- Credentials: Telegram bot token stored in Rails credentials (
telegram_bot_token) - Webhook Secret: Optional webhook secret token in Rails credentials (
telegram_webhook_secret) - Routes: Telegram webhook endpoint and profile integration routes in
config/routes.rb - Initializers: Telegram webhook configuration in
config/initializers/telegram.rb - Development: Webhook-based integration requiring ngrok for local testing
- Environment Variables:
TELEGRAM_WEBHOOK_URLfor development webhook setup (webhooks auto-enabled when present)- Production webhooks are automatically configured using
base_urlfrom credentials
- Letter Opener: Email preview in development
- Web Console: Debugging in development
- Docker: Full containerized development and production setup
- Kamal: Deployment configuration included
- Minitest: Rails default testing framework
- Fixtures: Test data in
test/fixtures/ - Integration Tests: Full workflow testing in
test/integration/ - Controller Tests: Including TelegramController webhook endpoint testing
- Service Tests: TelegramBotService and TelegramNotificationService testing
- Authentication Helpers:
sign_in_as(user)andadmin_authenticatehelpers
- Invitation Flow: Complete documentation in
docs/INVITATION_FLOW_DOCUMENTATION.md - Authentication Flow: Complete documentation in
docs/AUTHENTICATION_FLOW_DOCUMENTATION.md - Telegram Webhooks: Complete webhook setup and troubleshooting in
docs/TELEGRAM_WEBHOOKS.md