$ show FarmBot/Farmbot-Web-App
FarmBot Web App is the cloud-based control panel for FarmBot, an open-source CNC farming robot. It provides a full-stack web application (Rails API + React/TypeScript SPA) for managing devices, creating automated sequences via a visual CeleryScript AST editor, scheduling farm events, monitoring telemetry and logs, managing plants/weeds/tools, and viewing real-time 2D/3D garden maps. The backend is a monolithic Rails app with PostgreSQL, RabbitMQ/MQTT for device communication, and DelayedJob for background processing. The frontend is a complex Redux SPA with extensive 3D visualization using Three.js. The system supports multiple hardware variants and includes firmware update management, camera calibration, and AI-assisted feedback. The codebase is actively developed with a large test suite, but exhibits some technical debt like legacy AST storage paths, future-dated migrations, and heavy mocking in tests.
The LLM identified 4 files worth highlighting for reuse:
Defines the CeleryScript language corpus with type specifications for all node kinds, arguments, and enums. Provides a declarative DSL for defining valid AST forms, including return values, allowed parents, and nested children. This is a reusable pattern for any domain-specific scripting language that requires structural validation, and could be extracted with minimal dependencies.
Implements a simple throttling mechanism using Redis with a sliding window counter. Allows per-user/per-IP limits with configurable intervals (second, minute, hour, day). The class is standalone and only depends on Redis, making it trivially reusable for any Ruby service needing rate limiting.
A controlled toggle button component with visual states for 'on', 'off', 'disabled', and 'syncing'. Uses subtle dimming and a small sync indicator to reflect server-side save status. The component is self-contained, accepts standard HTML button props, and demonstrates attention to UX detail for real-time UI state management.
A typed factory function for creating Redux reducers from a state shape and a set of action handlers. Supports lifecycle hooks (before/after handlers) and strict typing via generics. Removes boilerplate for large state trees and can be extracted as a reusable utility for any TypeScript Redux application.