How ondc-official/ondc-sdk works
Project Type and Purpose
• This is a full-stack, microservice-based reference Buyer App (ONDC SDK Buyer App) that implements the demand-side (BAP) of the ONDC network.
• It provides a React/Redux frontend, Node.js “Client API” and “IGM” services, a Python-based ONDC protocol layer, ancillary Flask services (MMI geolocation, Bugzilla ticketing, catalog ingestion), all composed via Docker-Compose.
File Structure
• Top-level submodules:
• biap-app-ui-front (ReactJS app served by Nginx)
• biap-client-node-js (NodeJS BAP API layer)
• biap-igm-node-js (NodeJS IGM API layer)
• py-ondc-protocol (Python ONDC protocol implementation)
• ondc-mmi-service (Python Flask MMI geolocation)
• biap-bugzilla-service (Python Flask bug-ticket service)
• catalog-service (Python Flask catalog ingestion/search)
• Configuration & orchestration:
• docker-compose*.yaml, init-letsencrypt.sh, .env files
• deploying_ansible/ (Ansible playbooks for production)
• CI/utility scripts: check_for_latest_commit_and_build.py, NSDL Postman collection.
README
• Confirms microservice architecture: protocol layer (Python), client API (NodeJS), front app (React+Nginx), ancillary APIs (Flask).
• Tech stack: React, Redux, NodeJS/Express, Python/Flask, MongoDB, Nginx, Docker, Ansible.
• External integrations: ONDC registry/network, Juspay (payment), MapMyIndia (geolocation), Firebase Auth, Bugzilla.
Main Components & Their Interactions
a. Frontend Layer
• biap-app-ui-front: React/Redux SPA served by Nginx reverse proxy.
• Talks to → NodeJS BAP API via HTTP(S).
b. Client API Layer (NodeJS)
• biap-client-node-js: Exposes BAP REST endpoints (/search, /on_search, /init, /on_init, etc.).
• biap-igm-node-js: Exposes IGM-related endpoints for order/item grievances.
• Forwards ONDC-compliant messages to → py-ondc-protocol or ancillary services.
c. Protocol Layer (Python)
• py-ondc-protocol: Implements ONDC 1.2.0 protocol, signs messages, handles encryption, communicates with external ONDC networks (BPPs, registry).
d. Ancillary Microservices (Python Flask)
• ondc-mmi-service: Geolocation, PIN code lookup via MapMyIndia APIs.
• biap-bugzilla-service: Ticket management via embedded Bugzilla container.
• catalog-service: Catalog ingestion, indexing, search.
e. Data Storage
• MongoDB cluster/container for persisting user sessions, catalogs, orders, logs.
f. External Services
• ONDC network (registry, BPPs)
• Juspay payment gateway
• Firebase Authentication
• MapMyIndia APIs
• Bugzilla (self-hosted container)
g. Infrastructure & Deployment
• Docker-Compose bundles all microservices and MongoDB locally.
• Nginx serves the React app and routes API traffic.
• Ansible playbooks (deploying_ansible/) for production rollout.
Architectural Patterns & Design Principles
• Microservices: single-responsibility services, each in its own container.
• BFF (Backend-For-Frontend) pattern: NodeJS layer tailored to React UI.
• Protocol-Adapter: Python protocol layer abstracts ONDC messaging.
• 12-Factor app principles: environment-driven configurations, containerization, submodules.