How resilient-tech/india-compliance works
Project type and purpose
• This is an “app” (plugin) built on top of the Frappe Framework and ERPNext.
• It extends ERPNext by adding custom DocTypes, client scripts, server-side controllers, reports, and a standalone Vue-based India Compliance Account front-end.
• Its purpose is to simplify Indian tax compliance: GSTR-1 preparation, GSTR-2A/2B reconciliation, e-invoice & e-waybill integration, real-time validation, reporting, and an account portal for API access.
File structure
• Top-level:
• Configuration & CI (.github, pyproject.toml, setup.py, hooks.py, patches, etc.)
• App package: india_compliance/
• Public assets & front-end SPA: india_compliance/public/js/ (Vue components, bundles)
• Doctypes & overrides under india_compliance/gst_india/ and india_compliance/audit_trail/ etc.
• Utilities & API wrappers: india_compliance/utils/ and gst_india/utils/
• Reports: many india_compliance/gst_india/report/* folders
• Web templates & print formats for invoices and QR codes
• Pattern: MVC
• Models: DocType JSON + Python classes
• Views: Frappe web templates + client scripts + Vue SPA
• Controllers: Python API classes, server scripts, scheduler jobs, patch scripts
• External integrations are signaled by gst_india/api_classes and gst_india/utils/api.py.
Key insights from README
• Reinforces that India Compliance is a Frappe/ERPNext app.
• Features rely on government GST APIs (external services).
• There is also a separate “India Compliance Account” SPA (Vue, under public/js/india_compliance_account).
a. Frappe Framework & ERPNext Core
• HTTP server (Gunicorn/WSGI)
• Scheduler & background jobs
• ORM layer → MariaDB/MySQL + Redis cache/queue
• Built-in web UI
b. India Compliance App (this project)
• DocTypes & Models (GST settings, logs, registers, reconciliation tool)
• Server-side controllers & API wrappers (under gst_india/api_classes & utils/api.py)
• Patch scripts & migrations (patches folder)
• Reports (Python + JS under report/)
• Web templates & print formats (QR code templates, HTML/CSS)
• Client scripts (Frappe page customizations in JS under doctype folders)
• Scheduler hooks (hooks.py triggers jobs for e-invoice/e-waybill retry, data sync)
c. India Compliance Account SPA
• Vue.js front-end (components, router, store)
• Services (AuthService, AccountService) interacting with a custom REST API endpoint in the app
d. External Services
• GST APIs: e-invoice IRP, e-waybill, GSTIN validation, tax return endpoints
• ERPNext (core) APIs for user auth, database operations
e. Database & Cache
• MariaDB/MySQL storing DocType records
• Redis for caching, job queue
f. Developer / CI pipelines
• GitHub Actions for tests, linting, release workflows
Relationships and interactions
• User (browser) →
• Frappe web UI (DocType forms, reports) & India Compliance Account SPA →
• Frappe HTTP server →
• India Compliance controllers →
• Frappe ORM → MariaDB/Redis
• Background scheduler/job →
• India Compliance tasks (e-waybill generation, data sync) →
• External Government GST APIs
• Admin / Developer → GitHub → CI workflows → deploy to server
Important architectural patterns
• MVC via Frappe: DocType JSON (model), Python scripts (controller), client scripts & web templates (view)
• Modularization by domain: gst_india, audit_trail, income_tax_india, vat_india
• External API adapters isolating government API calls under api_classes and utils/api.py
• Scheduler jobs for asynchronous compliance tasks
• Vue SPA decoupled from Frappe UI, communicating over REST
Detail level
• Drill into a representative module (e.g., e-invoice flow):
1. DocType “E-Invoice” form → Client script triggers action → Server API class → External IRP → Response → DocType log
2. Report generation: scheduled job reads DocType records → Python report class → JSON → JS renders table
• Patterns:
• “api_classes” implement Adapter pattern
• Patches apply at install/update time (migration layer)
• Client scripts use event hooks on DocType forms