How hackclub/hcb works
This project is a comprehensive Ruby on Rails full‐stack web application built to power HCB – a fiscal sponsorship platform. Its purpose is to facilitate and manage financial transactions for hackathons, Hack Clubs, and other organizations using fiscal sponsorship. The system handles user interactions, API endpoints, financial transactions, background processing, and integrations with external services (like Stripe, Plaid, Twilio, and Google APIs).
• Frontend/UI Layer: Represent the Rails “views” (found under app/views) along with the asset pipeline (app/assets) and JavaScript controllers/components that deliver the user experience. This layer will interact with controllers for both traditional HTML pages and dynamic API responses.
• Web/API Layer: Show the Rails controllers which are organized in both the public and versioned API namespaces (such as app/controllers/api/v4 and api_controller.rb). Emphasize the RESTful endpoints that serve web and mobile clients.
• Business Logic Layer: Highlight the Models (in app/models) along with Service Objects (in app/services) and Concerns that implement the domain’s financial logic (e.g. handling sponsorship, donations, disbursements, invoice processing and reconciliation). This encapsulates the MVC “model” but also many service objects for tasks like transaction ingestion and external integration logic.
• Background Processing and Jobs: Represent the job system (in app/jobs) and integration with Sidekiq (via config/sidekiq.yml and initializers) used to process financial transactions, notifications, fee calculations, and integrations asynchronously.
• Data Storage Layer: Include the primary database (configured via config/database.yml and managed by numerous migration files in db/migrate). Show Postgres (or similar RDBMS) as the persistent store of users, transactions, events, and financial records.
• External Integrations: Identify all external systems the application communicates with:
– Payment/Gateway Systems: Stripe (including Stripe cards, top-ups, service fees), PayPal transfers.
– Banking and Financial Services: Plaid, bank accounts, ACH transfers, checks.
– Communication Providers: Twilio (for SMS and messaging), email delivery via mailers.
– Google Services: Google Suite integrations and domain management.
– Other external endpoints like Doorkeeper for OAuth and metrics/analytics systems.
• Infrastructure / Deployment: Briefly note the existence of Docker files, Codespaces support, CI/CD workflows on GitHub, and heroku.yml indicating deployment practices.
• How controllers delegate business logic to Models and Service Objects.
• Database as a central component that all layers (web, API, background jobs) interact with to store and retrieve persistent data.
Architectural patterns and design principles
• Use of RESTful API versioning – highlight the versioned API controllers.
• Asynchronous processing for long-running tasks (via Sidekiq jobs and various nightlies).
• Modular design with clear integration points to external financial and messaging systems.
• Containerization and infrastructure as code (Docker, dev containers, CI/CD workflows) that support repeatable deployments.
Final steps
• Keep the level of detail balanced – include major components and interactions without overloading every single file; focus on how the major subsystems connect.