Nature Green — Tally Connector
Document purpose: Developer handover for the Nature Green Tally Connector. This guide explains the project structure, key components, data flows, APIs, Tally XML contract, setup & deployment steps, testing & troubleshooting, known issues, and recommended next work for incoming developers.
1. Project Summary
Nature Green Tally Connector is a middleware/web UI that connects the Nature Green ERP and Tally for two-way data sync: products/stock, suppliers, purchases, and ledger/payment related data. It provides an admin UI for configuration, mapping, and manual synchronization plus automated sync jobs.
Primary goals:
Allow users to configure Tally connection and sync master data (items, suppliers), transactions (purchase invoices, receipts), and inventory.
Generate and parse Tally-compatible XML for the Tally SOAP-like interface.
Provide logging, retry, and reconciliation features so operations are auditable and recoverable.
2. Repositories & Key Paths
This section lists the file structure you provided and highlights where to find important code.
Frontend (React / Vite or similar)
Main UI components:
/components/screens/app/— core screens and feature pages.Authentication:
/components/screens/app/Authentication/Login.jsx,LoginWithCompanyDetails.jsx
Dashboard:
/components/screens/app/Dashboard/Dashboard.jsx,CustomData.jsx,SystemSetting.jsx
ERP module:
/components/screens/app/ERP/ErpSettingPage.jsx,Purchases.jsx,StockItem.jsx,Suppliers.jsx
Tally integration UI:
/components/screens/app/tally/TallySettings.jsx
Logs & Error UI:
/components/screens/app/LogsFolder/Logs.jsx,ErrorPage.jsx
UI primitives & reusable components:
/components/ui/
Services & Utilities
Authentication Service:/utils/services/server/authentication.service.jsERP Service:/utils/services/server/erp.service.jsTally Service:/utils/services/server/tally.service.jsTally XML generation & parsing logic lives under this service.
Other
System logging UI:
/components/screens/app/LogsFolder/— displays logs from sync jobs.Entry scripts for sync/cron jobs (if present) — search for files named
sync,tally_sync,cronin repo root orscripts/.
3. High-level Architecture & Data Flow
User Interface: Admin config and manual sync triggers are on the React UI. Users may configure ERP API endpoints, label mapping, Tally connection (host/port/company), schedule jobs, and run manual syncs.
Service Layer: The frontend calls internal server endpoints (ERP service / Tally service). These services perform mapping, fetch data from ERP API, transform to Tally XML, and call Tally endpoints or accept Tally responses.
Tally Communication: Tally integration uses HTTP POST requests with XML payloads conforming to Tally’s Import/Export format. The Tally service creates XML envelopes for masters (stock items, ledgers) and vouchers (purchases), posts to the Tally server, and parses responses for success/failure.
Persistence & Logging: Operation status, request/response payloads, errors, and reconciliation data are stored in the app database or logs for audit and troubleshooting. The UI shows logs in the Logs page.
Scheduling: Cron or scheduled jobs periodically sync configured entities. Jobs can be retried on failure and tracked in logs.
4. Data Mapping Rules
The connector maps data between Nature Green ERP and Tally. Mapping lives in config or code (check erp.service.js and tally.service.js). Key mapping points:
Item (Stock Item)
ERP:
item_code,item_name,hsn,uom,price,stock_levelsTally:
STOCKITEM NAME,PARENT,UQC,ISGSTABLE,RATE
Supplier / Ledger
ERP supplier maps to Tally Ledger with group (e.g., Sundry Creditors).
Banking details may become Ledger + Bank A/c.
Purchase Vouchers / Invoices
ERP purchase invoice maps to Tally
VOUCHER(Purchase) withVOUCHERTYPENAME=Purchase/Purchase Invoice.Line items must include
STOCKITEMblock for each item, quantity and rate.
Stock / Serial No
If serial number tracking exists, ensure Tally XML carries
BATCHALLOCATIONSorALLINVENTORYENTRIES.LISTsub-blocks as per Tally schema.
Important: Always use canonical field names expected by Tally. Use the Tally service to generate correct XML wrappers.
5. Tally XML Contract (how to generate & parse)
Generation (Outbound to Tally)
Build a
ENVELOPEroot withHEADERandBODY→IMPORTDATA→REQUESTDATA→TALLYMESSAGEnodes.For masters (Stock Items, Ledgers), use
MASTERtags structured as Tally expects (example:STOCKITEMentries insideTALLYMESSAGE).For transactions, build
VOUCHERentries with fields:DATE,VOUCHERTYPENAME,PARTYLEDGERNAME,ALLINVENTORYENTRIES.LISTcontainingSTOCKITEMblocks.Include
COMPANYname in the envelope if Tally is running multiple companies.
Parsing (Inbound from Tally)
Tally returns an XML response with
IMPORTSUCCESS/IMPORTERRORorRESPONSEnodes. Parse to extractOLDDOCNUMBER,LINESTATUSor error messages. Log request & response.
Edge cases:
Tally may respond with partial errors (some vouchers succeed, some fail in the same payload). Handle partial success and reconcile which records to retry.
When sending masters, ensure dependencies exist (e.g., Ledger group) before inserting child objects.
6. Key Functions & Where to Find Them
Search for these functions/keywords in the repo to locate logic quickly:
generateTallyXML/buildEnvelope/createVoucherXMLpostToTally/tallyRequest/sendToTallymapErpToTally/mapFields/fieldMappingparseTallyResponse/handleTallyResponsesyncItems/syncSuppliers/syncPurchasesgetAuthToken/validateSession(auth handling)
Files likely containing logic:
/utils/services/server/tally.service.js/utils/services/server/erp.service.jsAny
scripts/orjobs/folder for scheduled syncs
7. Authentication & Security
User sessions: Handled by
authentication.service.js. It should manage login, token set, and refresh flow.API keys to ERP / Tally: Store in
.envand do not commit. For production use a secrets manager.Tally security: Tally usually listens on HTTP; it expects correctly formed XML. Ensure network access is restricted between app server and Tally host (VPC / firewall / IP allowlist).
Permissions: Ensure only admin-level users can run manual syncs and change mappings. Implement role-based UI restrictions.