How 0yeifer/any_calendar works
Project type and purpose
• This is a Frappe‐based plugin/app (“extended_calendars”) whose goal is to integrate and sync events between two external calendar providers (GoHighLevel and HubSpot) and the native Frappe/ERPNext calendar.
• It uses Frappe’s MVC architecture: Python “doctype” classes for server logic and persistence, JSON files for metadata, JS files for client UI, hooks for extension points, and patch scripts for migrations.
Main components
a. Frappe Framework (Core)
– HTTP/TCP server (Bench)
– Web client (Desk UI)
– REST API / RPC layer
– ORM + MariaDB (or PostgreSQL) backing store
b. extended_calendars App
– Python doctype modules: calendar_hubspot, ghl_calendar, goujana_calendar
– JSON doctype definitions (schema + permissions)
– JS extension files for client‐side override/customization
– hooks.py (to register scheduled tasks, API overrides, event handlers)
– patches (migration scripts)
– overrides for built‐in doctypes (contact, event, google_calendar)
c. External Calendar Providers
– HubSpot Calendar API
– GoHighLevel Calendar API
d. Users & Clients
– Browser/Desk users interacting via UI
– Scheduled Jobs or Webhooks (for sync logic)
Relationships & Data Flow
1. User (browser) → Frappe Desk UI (JS) → Frappe REST/RPC → Python doctype controllers → Database
2. Sync job (hooked scheduler or webhook) → Python integration logic → external API (HubSpot/GoHighLevel) ↔ HTTP ↔ Frappe doctype records
3. Overrides intercept CRUD on core “Event”/“Contact” doctypes to propagate changes bidirectionally.
4. Patch scripts run at app installation to migrate existing calendars.
Architectural Patterns & Principles
• MVC (Model = Doctypes/ORM, View = Frappe Desk JS templates, Controller = Python methods + hooks)
• Plugin/Hook architecture (app extends core without modifying core code)
• Adapter pattern for external APIs (calendar_hubspot.py, ghl_calendar.py each wrap provider REST calls)
• Separation of concerns:
• Data model in JSON/Python
• Sync logic in Python modules
• UI tweaks in JS override files
Technologies & Frameworks
• Python 3.x, Frappe framework
• MariaDB (or PostgreSQL)
• JSON (metadata definitions)
• JavaScript (client overrides in public/js)
• pyproject.toml for packaging
• CI via GitHub Actions (.github/workflows/ci.yml)