How cryptokitchen23/fengshui_agent works
Recognize the Main Project Components
• Web Application (Rails MVC): The core application is built using Ruby on Rails. Identify the MVC layers:
• Controllers: In app/controllers (e.g., PumpFunPromptsController, SystemPromptsController)
• Views: In app/views (with layouts and specific views for prompts)
• Models: In app/models (e.g., Message, Prompt)
• Frontend Assets: JavaScript and CSS managed in app/assets and app/javascript, supporting interactivity in the browser.
• Database: Managed via ActiveRecord with migrations found in db/migrate and overall schema in db/schema.rb.
• Background Job Processing: Located in app/jobs (e.g., telegram_bot_worker_job, twitter_bot_worker_job) to handle asynchronous tasks for messaging bots.
• Service Layer: Contains integrations with external APIs and business logic (e.g., openai_service, telegram_botter, twitter_botter, cmc_pump_fun_service, etc.).
• External Services: The README mentions using external API keys for services like OpenAI, Telegram, and CoinMarketCap. These services should be represented as distinct external components interfaced via the service layer.
Out the Relationships and Interaction Flow
• Client (Browser/User): Initiates requests that hit the Rails controllers.
• Controllers then coordinate between Models (database operations), Services (external API calls), and Views (to render responses).
• Background Jobs: Triggered either by controllers or scheduled tasks, they run asynchronously to interact with external platforms (bots) and process responses.
• The Database component (usually an SQL database, as indicated by ActiveRecord migrations) has a bidirectional relationship with models, maintaining persistent data.
Architectural Patterns and Design Principles
• MVC (Model-View-Controller): Clearly separate each major application layer.
• Service-Oriented Architecture: The “app/services” folder indicates encapsulated business logic for interfacing with external services and handling domain-specific tasks.
• Asynchronous Job Processing: Use of background jobs (e.g., Telegram and Twitter bot workers) introduces the aspect of event-driven processing.