How bindk/remitano_prj works
Main Components
• Rails Server (Application Core)
• Controllers: Separate API controllers (e.g., app/controllers/api/v1) and standard controller endpoints for server-side rendering.
• Views: Server-rendered views (with embedded React components planned for future work).
• Models: Business logic, including User and YouTubeVideo models.
• Routes: Centralized in config/routes.rb.
• ActionCable (Real-time Notifications)
• WebSocket server enabling real-time notifications when a new video is shared (e.g., app/channels/video_notifications_channel.rb).
• Sidekiq (Background Jobs)
• Background processing for tasks such as video processing (e.g., app/jobs/process_video_job.rb).
• External Services:
• PostgreSQL Database: Used for data storage (configured via config/database.yml).
• Redis: Serves multiple roles – as the backend for ActionCable (for real-time messaging) and as the queue backend for Sidekiq (configured in config/sidekiq.yml).
• Asset Pipeline & JavaScript: Server-side asset management (including Tailwind CSS and potential future React integration found in the app/assets and app/javascript directories).
• Deployment Infrastructure:
• Docker: Highlight containerization (Dockerfile and docker-related configurations).
• Dokku/Heroku-like Deployment: Note the deployment steps mentioned in the README for environments like Dokku.
Relationships and Interactions
• Frontend (server-rendered views and API endpoints) communicates directly with the Rails server.
• The Rails server interacts with the PostgreSQL database for CRUD operations.
• When a user shares a video:
• The controller invokes a service (e.g., app/services/youtube_video_extractor.rb) to extract OpenGraph metadata.
• The video is saved via the models.
• The background job (ProcessVideoJob) is enqueued and processed by Sidekiq using Redis.
• After successful processing, a notification is broadcasted over ActionCable to connected users.
• Asset compilation and JavaScript management take place using tools configured in app/assets and app/javascript, ensuring the frontend assets are properly built and served.
Architectural Patterns & Principles
• MVC Pattern: The standard Rails structure divides responsibilities among models, views, and controllers.
• Background Processing: Use of Sidekiq for offloading processing tasks and improving responsiveness.
• Real-time Communication: Leverage ActionCable to provide real-time notifications.
• API Layer Separation: There is a clear REST API structure (under app/controllers/api/v1) that distinguishes API logic from traditional server-rendered endpoints.
• Modularization: Services (app/services) encapsulate specific logic such as YouTube metadata extraction.
Relevant Technologies, Frameworks, and Libraries
• Ruby on Rails (version info from README)
• PostgreSQL for the database
• Redis for caching, ActionCable, and Sidekiq
• Sidekiq as the background job processor
• Tailwind CSS for styling (as observed in assets)
• ActionCable (for WebSockets)
• Devise (for authentication as seen from config/initializers/devise.rb)
• Docker and Dokku for deployments
Elements
• For example, from the client to the Rails server (authentication, video sharing requests) and from the Rails server to PostgreSQL and Redis.
• Asynchronous communication from Sidekiq, triggered by certain actions, and then the real-time notifications sent via ActionCable.