How andrewsheelan/windsurfing works
Main Components
• Frontend Client:
• Web browser interfaces showing responsive views.
• Interaction layers powered by Tailwind CSS, Stimulus, Turbo, and JavaScript modules that drive interactive behavior (e.g., chat window, product browsing, and cart updates).
• Rails Web Application:
• Controllers: Represent endpoints handling product management (ProductsController), shopping cart operations (CartsController and CartItemsController), orders (OrdersController), and real-time messaging (MessagesController, ChatChannel).
• Views: Mark the presentation layer that renders pages based on ERB templates (e.g., layouts, product views, cart views, chat partials).
• Channels: Highlight Action Cable components for real-time features, including ChatChannel and connection handling in ApplicationCable.
• Jobs & Background Processing: Include jobs (ProcessWithProgressJob) that manage asynchronous actions.
• Database and Storage:
• PostgreSQL (or SQLite as mentioned in the README for development).
• Active Storage for image uploads.
• Redis for Action Cable that supports real-time messaging.
• External Services and Integration Points:
• Devise for authentication, indicating secure user registration and role-based access.
• External APIs or services such as the Ollama service (found in app/services/ollama_service.rb) should be noted.
• CI/CD Integration: Although not the focus of the core architecture, the CI pipeline ensures code quality (RuboCop, tests, Dockerfile setup). You might annotate these components as part of the deployment/support infrastructure.
• Infrastructure & DevOps:
• Dockerfiles (multiple variants), docker-compose, and deployment configuration files (e.g., Procfile.dev, config/deploy.yml) should be captured as deployment artifacts.
• Dedicated directories for GitHub workflows and hooks that automate build, test, and deployment processes.
Relationships and Data Flows
• User Flow:
• Clients (web browsers) interact with the Rails application through HTTP requests that are routed to the appropriate controllers.
• Data Persistence:
• Attachments from models to Active Storage.
• Real-time Features:
• Background Processes:
• Asynchronous job queues that process long-running tasks (for example, order confirmations or stock validations).
Architectural Patterns and Principles
• MVC Pattern: Clearly segment the application into Model, View, and Controller components.
• Componentization: Break out distinct functions (product management, cart management, orders, chat) as separable modules within the architecture.
• Integration via Services: Represent the app/services directory (e.g., OllamaService) as integration points for external interactions.
• Real-Time Processing: Emphasize the use of Action Cable (channels and connection components) in the system to handle live communication.
• Modular and Layered Approach: Separate concerns such as business logic (models/services), presentation (views), and user interaction (controllers and channels).
• Deployment & DevOps: Optionally include Docker/CI/CD elements to indicate how the code is deployed and scaled.