How hatttri/stock_app works
Main Components
• Web Client: Represent the web browser or client-side interface (HTML/JavaScript/CSS) that interacts with the Rails application. Since assets are managed under app/assets and app/javascript, show a clear “Browser” component.
• Rails Application Server: This is the core of your application. Split this into subcomponents such as:
• Controllers (defined in app/controllers): Handle HTTP requests, manage sessions (sessions_controller.rb), portfolios (portfolios_controller.rb), stocks (stocks_controller.rb), and users (users_controller.rb).
• Models (found in app/models): Represent the application’s business logic (User, Stock, Portfolio, Wallet, Alert). These interact with the database.
• Views (located in app/views): Present data to the user using Slim templates.
• Channels (found in app/channels): Indicate use of Rails Action Cable for real-time features (like live updates) if needed.
• Jobs/Mailers: For background processing and mailing (user_mailer, application_job), which might cover delayed operations such as notifications.
• Database: Represent the relational database (most likely PostgreSQL in a Heroku deployment) that stores user data, stock information, portfolios, alerts, etc.
• External Services:
• Twitter Search API: Used for fetching market data or sentiments.
• SendGrid: For emailing, such as user activation emails or alerts.
• Deployment Environment: Heroku for hosting the application.
• Testing Environment: RSpec, which is configured for unit, model, and system tests.
• Directional flows:
• Browser requests → Rails server (via controllers).
• Controllers interact with Models for data.
• Models read/write from/to the Database.
• Rails jobs/mailer components interact with External Services (SendGrid for emails).
Architectural Patterns & Design Principles
• MVC (Model-View-Controller): This pattern is central to the project, with a clear separation of concerns between controllers (request handling), models (business logic & data), and views (presentation).
• RESTful Routing: As implied by the controllers and routes configuration, data flows are organized following REST principles.
• Background Processing: Inclusion of jobs and mailers signifies asynchronous processing handling actions such as portfolio updates or sending activation emails.
• External Integrations: Make sure to show the integration with third-party services (Twitter and SendGrid).