How jaydalal12/blockchain-indexer works
Project Type and Purpose
• This is a full-stack web application (“Blockchain Indexing Dashboard”) composed of:
• A React-based SPA in the client/ folder
• A Node.js + Express backend in the server/ folder
• A PostgreSQL database for persistence
• Integration with the external Helius webhook API to index blockchain transactions
• Purpose: Allow users to configure transaction categories and address filters, create webhooks on Helius, persist incoming events to Postgres, and display them in a live dashboard.
File Structure
• client/
• Typical Create-React-App structure (public/, src/, .env)
• src/App.js, routes, API calls via Axios to the backend (base URL from REACT_APP_SERVER_BASE_URL)
• server/
• index.js boots Express, configures middleware (dotenv, CORS, JSON, JWT auth)
• routes/ defines REST endpoints (auth.js, indexing.js) and a webhook receiver (/webhook)
• services/helius.js encapsulates calls to Helius API (create/delete webhook)
• schema.sql defines users and webhook_data tables
• tests/
• Basic unit tests (e.g., indexing.test.js) for backend logic
README for Insights
• Stack: React, Express, PostgreSQL, JWT, Axios
• Key flows:
• Auth (register/login) → JWT issuance → protected routes
• Indexing config → create/delete Helius webhook → store webhook_id
• Webhook events → POST /webhook → server persists JSONB payload to webhook_data
• Frontend polling/manual refresh → GET /api/webhook-data → render table
Main Components & Their Interactions
a. Frontend (React SPA)
• UI for auth, config, dashboard
• Axios REST calls to Backend
• Uses React Router, react-select, react-toastify
b. Backend (Express API)
• Auth endpoints (/register, /login) → JWT
• Indexing endpoints (/start-indexing, /stop-indexing, /data)
• Webhook endpoint (/webhook) exposed to Helius
• Service layer (services/helius.js) handles external HTTP calls
• Database access via pg
c. PostgreSQL Database
• Stores user credentials, Postgres connection details, webhook_id
• Persists incoming webhook_data JSONB with timestamp
d. External Services
• Helius Webhook API (creates & delivers blockchain transaction events)
• Optional ngrok for local tunneling of webhook endpoint
Relationships & Data Flows:
1. User browser → (HTTPS) → React SPA
2. React SPA → (REST + JWT) → Express API
3. Express API ↔ (SQL) ↔ PostgreSQL DB
4. Express API → (HTTPS) → Helius API (create/delete webhooks)
5. Helius → (Webhook POST) → Express /webhook endpoint → DB write
6. React polling/refresh → Express → fetch persisted data → display
Architectural Patterns & Principles
• Layered Architecture:
• Presentation (React)
• API / Business Logic (Express Routes + Services)
• Data Access (PostgreSQL)
• Separation of Concerns: Services folder isolates external API logic
• Stateless Auth: JWT tokens for session management
• Configurable Extensibility: Environment-driven base URLs, pluggable webhook filters