Skip to content

charanxcode/DocureChain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DocureChain β€” Verify Once. Trusted Forever. πŸ”—

A hybrid blockchain + cloud document verification platform targeting the Indian Background Verification (BGV) industry.
Core Principle: Blockchain for trust. Cloud for speed. Device for privacy.


What is DocureChain?

Every time someone changes jobs in India, their entire career history is re-verified from scratch β€” a slow, expensive, and repetitive process. DocureChain introduces the BGV Chain: each document is verified once by the issuing institution, anchored on the Polygon blockchain, and reused across future employers with the person's consent. New employers only verify the latest record; everything before is already confirmed.

Key Highlights

Metric Traditional BGV DocureChain
Verification time 9–14 days 1–2 days
Repeated work 100% Only newest
Person controls data ❌ βœ… (consent)
Tamper-proof records ❌ βœ… (blockchain)

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         FRONTEND LAYER                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   Mobile (Expo RN)   β”‚   β”‚   Org Portal (Next.js 16 + TW4)  β”‚ β”‚
β”‚  β”‚  Wallet Β· Upload Β· QRβ”‚   β”‚  Landing Β· Person/Org Demo Views  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚             β”‚       API GATEWAY (:4000)     β”‚                     β”‚
β”‚             β”‚   Express + http-proxy-middleware                   β”‚
β”‚             β”‚   /api/v1/auth  β†’ Auth Service                     β”‚
β”‚             β”‚   /api/v1/documents β†’ Document Service              β”‚
β”‚             β”‚   /api/v1/verify β†’ Verification Service             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€-─
β”‚                        MICROSERVICES                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚Auth :4001β”‚  β”‚Doc  :4002 β”‚  β”‚Verify  :4003 β”‚  β”‚Notif  :4004 β”‚ β”‚
β”‚  β”‚Express   β”‚  β”‚Fastify    β”‚  β”‚Express       β”‚  β”‚Express      β”‚ β”‚
β”‚  β”‚JWT + DID β”‚  β”‚Multipart  β”‚  β”‚Hash + QR + IDβ”‚  β”‚Redis PubSub β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚Bull Queue β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚                               β”‚AI Mail :4005 β”‚                   β”‚
β”‚                               β”‚OpenAI+Resend β”‚                   β”‚
β”‚                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€-─
β”‚                         DATA LAYER                                β”‚
β”‚        PostgreSQL (Prisma)  Β·  Redis  Β·  AWS S3  Β·  IPFS/Pinata  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€-─
β”‚                      BLOCKCHAIN LAYER                             β”‚
β”‚           Polygon (Hardhat Β· OpenZeppelin Upgradeable)            β”‚
β”‚   IdentityRegistry  Β·  DocumentRegistry  Β·  AccessControl        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

  • Monorepo: Turborepo v2 + pnpm 9 workspaces
  • Smart Contracts: Solidity 0.8.20, OpenZeppelin Upgradeable, Hardhat
  • Frontend: Next.js 16 (App Router) + TailwindCSS v4, React Native (Expo)
  • Backend: Express, Fastify, Prisma ORM, Bull queues, Redis
  • AI: OpenAI (gpt-4o) for verification email drafting
  • Email: Resend for transactional delivery
  • Crypto: AES-256-GCM client-side encryption, SHA-256 hashing, DID:ethr identity

Project Structure

docurechain/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ mobile/                  # Expo React Native – end-user wallet
β”‚   └── org-portal/              # Next.js 16 – product landing & demo
β”‚
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ api-gateway/             # Edge proxy bridging all microservices
β”‚   β”œβ”€β”€ auth-service/            # UUID/DID mapping, JWT signing
β”‚   β”œβ”€β”€ document-service/        # Fastify multipart S3/IPFS uploads + Bull queues
β”‚   β”œβ”€β”€ verification-service/    # Document hash, ID, and QR code verification
β”‚   β”œβ”€β”€ notification-service/    # Redis pub/sub push & email notifications
β”‚   └── ai-mail-service/         # AI-drafted verification emails (OpenAI + Resend)
β”‚
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ crypto-utils/            # AES-256-GCM encryption, DID generation, SHA-256 hashing
β”‚   └── shared-types/            # Common TypeScript interfaces
β”‚
β”œβ”€β”€ blockchain/
β”‚   └── contracts/
β”‚       β”œβ”€β”€ IdentityRegistry.sol # DID ↔ address mapping, issuer registration
β”‚       β”œβ”€β”€ DocumentRegistry.sol # Anchor document hashes, revocation
β”‚       └── AccessControl.sol    # Time-limited verifier access tokens
β”‚
β”œβ”€β”€ docker-compose.yml           # PostgreSQL 15 + Redis 7
β”œβ”€β”€ Makefile                     # Dev, test, deploy, clean targets
β”œβ”€β”€ turbo.json                   # Turborepo pipeline config
└── pnpm-workspace.yaml

Smart Contracts

Contract Purpose
IdentityRegistry Maps DIDs to Ethereum addresses. Registers verified issuers (owner-only).
DocumentRegistry Anchors SHA-256 hashes on-chain with owner DID, IPFS CID, doc type, and issuer. Supports revocation.
AccessControl Grants time-limited access tokens to verifiers. Owner can revoke anytime.

All contracts use OpenZeppelin Upgradeable proxies for future-proof deployment.


Getting Started

1. Prerequisites

  • Node.js β‰₯ 20
  • pnpm β‰₯ 9.0
  • Docker & Docker Compose

2. Environment Setup

cp .env.example .env
# Fill in: DATABASE_URL, REDIS_URL, JWT_SECRET, AWS/S3, Pinata,
#          Polygon RPC, OPENAI_API_KEY, RESEND_API_KEY, etc.

3. Start Infrastructure

Spin up PostgreSQL and Redis containers:

make services-up

4. Install & Build

pnpm install
pnpm run build

5. Deploy Smart Contracts

cd blockchain
npx hardhat compile
npx hardhat test
npx hardhat run scripts/deploy.ts --network mumbai

Important: Update .env with the deployed addresses for IDENTITY_REGISTRY_ADDRESS, DOCUMENT_REGISTRY_ADDRESS, and ACCESS_CONTROL_ADDRESS.

6. Start All Services

Boot every app and service via Turborepo:

make dev
# or: pnpm dev / turbo run dev
Service Default Port
API Gateway 4000
Auth Service 4001
Document Service 4002
Verification Service 4003
Notification Service 4004
AI Mail Service 4005
Org Portal (Next.js) 3000

Mobile App (Expo)

The React Native app provides:

  • Wallet Generation: Creates a secp256k1 keypair and DID:ethr identity, stored in expo-secure-store
  • Encrypted Document Upload: Select from gallery β†’ upload via API Gateway β†’ anchor on-chain
  • QR Code Verification: Scan any DocureChain QR to verify document authenticity against Polygon
cd apps/mobile
npx expo start

Testing

Run the full test suite across the monorepo:

make test
# or: pnpm test

Individual services can be tested in isolation:

cd services/verification-service
pnpm test

Security Model

Layer Mechanism
Transport Helmet headers, CORS, rate limiting on every service
Encryption AES-256-GCM client-side β€” server never sees raw documents
Identity DID:ethr decentralized identifiers, JWT-secured API paths
Blockchain SHA-256 hashes anchored on Polygon β€” tamper-proof source of truth
Access Time-limited on-chain access tokens; owner grants and revokes
Gateway Express reverse proxy with per-IP rate limiting (300 req/min)

Make Targets

Command Description
make dev Start infra + all services
make test Run monorepo-wide test suite
make services-up Docker Compose up (PostgreSQL + Redis)
make services-down Docker Compose down
make deploy-contracts Deploy Solidity contracts to Polygon
make clean Remove all node_modules, dist, .turbo

License

Private β€” All rights reserved.

About

A blockchain-powered mobile app for document verification and secure identity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors