{"id":50736434,"url":"https://github.com/squid-protocol/help_farmers_farm","last_synced_at":"2026-06-10T14:01:29.684Z","repository":{"id":357600012,"uuid":"1237655399","full_name":"squid-protocol/help_farmers_farm","owner":"squid-protocol","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-28T13:32:35.000Z","size":856,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-28T14:07:02.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/squid-protocol.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-13T11:36:51.000Z","updated_at":"2026-05-28T13:32:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/squid-protocol/help_farmers_farm","commit_stats":null,"previous_names":["squid-protocol/help_farmers_farm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/squid-protocol/help_farmers_farm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squid-protocol%2Fhelp_farmers_farm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squid-protocol%2Fhelp_farmers_farm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squid-protocol%2Fhelp_farmers_farm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squid-protocol%2Fhelp_farmers_farm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squid-protocol","download_url":"https://codeload.github.com/squid-protocol/help_farmers_farm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squid-protocol%2Fhelp_farmers_farm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34155422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-10T14:01:27.628Z","updated_at":"2026-06-10T14:01:29.679Z","avatar_url":"https://github.com/squid-protocol.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HelpFarmers 🌾\n\nA robust, multi-tenant Django SaaS platform designed to manage farm volunteers, track logged hours securely, gamify the volunteer experience, and visualize complex agricultural impact metrics dynamically.\n\n---\n\n## 🏗 THE ARCHITECTURE (Micro-Services Map)\n\nThe project is strictly divided into domain-specific apps. **Do not mix their responsibilities.**\n\n* **`accounts/` (Identity \u0026 Routing)**\n  * Manages the custom User model and Role-Based Access Control (`account_manager`, `farm_manager`, `volunteer`).\n  * Processes Base64 avatar uploads via Cropper.js.\n  * Enforces the `RequireEmailMiddleware` tollbooth for legacy account claims.\n* **`farms/` (Tenancy \u0026 Management)**\n  * The core multi-tenant boundary. Holds the `Farm`, `Crop`, and `WorkCommitment` models.\n  * Contains the interactive `manager_dashboard` for CRM-style administration.\n  * Generates the manager-facing Volunteer Progress Report.\n* **`logs/` (Transactional Core)**\n  * Contains the `LogEntry` model (using exact `DecimalField` math).\n  * Handles the volunteer pacing engine, badge gamification, and individual dashboard visualizations.\n  * Protects against rapid \"Double-Click\" duplicate submissions.\n* **`analytics/` (Data Visualization Engine)**\n  * Acts purely as an HTMX API endpoint for rendering complex Plotly charts.\n  * Transforms raw `LogEntry` QuerySets into Pandas DataFrames for deep aggregations (e.g., 52-week activity heatmaps).\n* **`helpfarmers/` (System \u0026 Infrastructure)**\n  * Core settings, security headers, routing, and Sentry error tracking.\n  * Hosts the background Audit Logger for administrative tracking.\n* **`theme/` (Frontend Pipeline)**\n  * The local Node-based Tailwind CSS compilation pipeline.\n\n---\n\n## 🤖 UNIVERSAL LLM DIRECTIVES \n*If you are an AI, LLM, or new developer reading this repository, you MUST adhere strictly to the following core directives before suggesting any code changes:*\n\n### 1. Frontend \u0026 UI Paradigm\n* **HTMX over SPA:** This project uses **HTMX** for dynamic partial page updates. Do NOT suggest refactoring to React, Vue, or Angular. Views should return localized HTML fragments when handling HTMX requests.\n* **Tailwind CSS (Local Pipeline):** We use `django-tailwind`. Do NOT suggest adding Tailwind via CDN. Forms are rendered using `crispy-tailwind`.\n* **Plotly.js for Charts:** All data visualization is handled by Plotly. Charts are built server-side via Python/Pandas, stripped of their JS payload (`include_plotlyjs=False`), and rendered on the frontend using a globally loaded CDN script.\n\n### 2. Database \u0026 Data Isolation (CRITICAL)\n* **Row-Level Multi-Tenancy:** The entire platform revolves around the `farms.Farm` model. Almost every query involving Users, Crops, or Work Commitments **MUST** be filtered by `farm=request.user.farm`. Never write a view that leaks data across different farms.\n* **Soft Deletes / Data Preservation:** We rely on `on_delete=models.SET_NULL` for historical data (like `LogEntry.volunteer` or `LogEntry.crop`). Do NOT suggest changing these to `CASCADE`, as deleting a volunteer or crop should never destroy a farm's historical impact analytics.\n* **No Future Logging:** The `LogEntry` model strictly prohibits logging hours in the future via a custom validator.\n\n### 3. Security \u0026 Infrastructure\n* **Secret Management:** Hardcoded secrets are strictly forbidden. Use `django-environ` via the `.env` file. \n* **Strict HTTPS:** `helpfarmers/settings.py` enforces `SECURE_SSL_REDIRECT` and secure cookies when `DEBUG=False`. \n* **Testing Bypass:** A `TESTING = 'test' in sys.argv` flag safely bypasses SSL checks during local CI/CD runs so the Django test client doesn't crash on `301` redirects. Do not remove this.\n* **Avatar Uploads:** Do NOT use standard `multipart/form-data` for avatars. The frontend uses Cropper.js to send a Base64 string to the backend, which decodes it into a `ContentFile`.\n\n---\n\n## 🛠 LOCAL DEVELOPMENT SETUP\n\n### 1. Requirements\n* Python 3.10+\n* Node.js v20+ (Required for the `theme/` Tailwind compilation)\n* PostgreSQL / SQLite (Local)\n\n### 2. Environment Variables\nCreate a `.env` file in the root directory:\n```env\n# .env\nSECRET_KEY=your_secure_random_key_here\nDEBUG=True\nALLOWED_HOSTS=127.0.0.1,localhost\nDATABASE_URL=postgres://user:password@127.0.0.1:5432/helpfarmers_db","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquid-protocol%2Fhelp_farmers_farm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquid-protocol%2Fhelp_farmers_farm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquid-protocol%2Fhelp_farmers_farm/lists"}