A production-ready full-stack application for document verification using blockchain technology. Documents are hashed with SHA-256, stored off-chain in S3-compatible storage, and their hashes are registered on the Ethereum blockchain for immutable verification.
┌─────────────────────────────────────────────────────────────────┐
│ Frontend (Next.js) │
│ React 18 │ TypeScript │ TailwindCSS │ ethers.js │ Zustand │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Backend API (Spring Boot) │
│ Spring Security │ JWT │ web3j │ JPA │ SHA-256 │ S3 Client │
└─────────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌───────────────────┐
│ PostgreSQL │ │ MinIO / S3 │ │ Ethereum Network │
│ Database │ │ Storage │ │ Smart Contract │
└──────────────┘ └──────────────┘ └───────────────────┘
- Document Upload: Upload PDF documents (max 50MB)
- SHA-256 Hashing: Automatic content hashing for integrity verification
- Blockchain Registration: Hash registered on Ethereum (Sepolia testnet)
- Role-Based Access: User, Approver, and Admin roles with JWT authentication
- Approval Workflow: Multi-step approval process with blockchain recording
- Public Verification: Anyone can verify document authenticity
- MetaMask Integration: Connect wallet for blockchain interactions
- Off-Chain Storage: Documents stored in S3-compatible storage (MinIO)
- Java 17 with Spring Boot 3.2.2
- Spring Security 6.x with JWT (jjwt 0.12.3)
- Spring Data JPA with PostgreSQL
- web3j 4.10.3 for Ethereum integration
- AWS SDK for S3 storage
- Next.js 14.1.0 with React 18
- TypeScript 5.x
- TailwindCSS 3.4.1
- ethers.js 6.9.2 for blockchain
- Zustand for state management
- React Query for data fetching
- Solidity 0.8.20
- Hardhat development environment
- OpenZeppelin contracts 5.x
- Sepolia testnet deployment
- Docker & Docker Compose
- Node.js 20+ (for local development)
- Java 17+ (for local development)
- MetaMask wallet
- Clone and configure
cd blockchain_project
cp .env.example .env
# Edit .env with your configuration- Start all services
docker-compose up -d- Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
- MinIO Console: http://localhost:9001
cd backend
./mvnw spring-boot:run -Dspring-boot.run.profiles=devcd frontend
npm install
npm run devcd contracts
npm install
npx hardhat compile
# Deploy to Sepolia
npx hardhat run scripts/deploy.js --network sepoliablockchain_project/
├── memory-bank/ # Project documentation
│ ├── projectbrief.md
│ ├── productContext.md
│ ├── systemPatterns.md
│ ├── techContext.md
│ ├── activeContext.md
│ └── progress.md
├── backend/ # Spring Boot API
│ ├── src/main/java/com/docverify/
│ │ ├── entity/ # JPA entities
│ │ ├── repository/ # Data repositories
│ │ ├── service/ # Business logic
│ │ ├── controller/ # REST endpoints
│ │ ├── security/ # JWT & auth
│ │ ├── config/ # Configuration
│ │ ├── dto/ # Request/Response DTOs
│ │ └── exception/ # Error handling
│ └── pom.xml
├── frontend/ # Next.js application
│ ├── src/
│ │ ├── app/ # Pages (App Router)
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom hooks
│ │ ├── lib/ # Utilities & API
│ │ └── store/ # Zustand stores
│ └── package.json
├── contracts/ # Solidity smart contracts
│ ├── contracts/
│ │ └── DocumentVerification.sol
│ ├── scripts/
│ │ └── deploy.js
│ └── hardhat.config.js
├── docker-compose.yml
└── README.md
| Role | Password | |
|---|---|---|
| Admin | admin@docverify.com | admin123 |
| Approver | approver@docverify.com | approver123 |
| User | user@docverify.com | user123 |
All protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <access_token>
POST /api/auth/register- Register new userPOST /api/auth/login- Login and get tokensPOST /api/auth/refresh- Refresh access token
POST /api/documents/upload- Upload document (multipart)GET /api/documents/my- Get user's documentsGET /api/documents/{id}- Get document detailsGET /api/documents/{id}/download- Download document
GET /api/approvals/pending- Get pending approvalsPOST /api/approvals/{id}/approve- Approve documentPOST /api/approvals/{id}/reject- Reject document
POST /api/verification/verify-hash- Verify by hashPOST /api/verification/verify-file- Verify by file
GET /api/admin/users- List all usersPUT /api/admin/users/{id}/enable- Enable userPUT /api/admin/users/{id}/disable- Disable userPOST /api/admin/users/{id}/roles- Add role
The DocumentVerification contract provides:
registerDocument(bytes32 hash, string storageKey)- Register documentapproveDocument(bytes32 hash)- Approve documentrejectDocument(bytes32 hash, string reason)- Reject documentverifyDocument(bytes32 hash)- Check document statusdocumentExists(bytes32 hash)- Check if registered
DocumentRegistered(bytes32 indexed hash, string storageKey, address registrant, uint256 timestamp)DocumentApproved(bytes32 indexed hash, address approver, uint256 timestamp)DocumentRejected(bytes32 indexed hash, address approver, string reason, uint256 timestamp)
cd backend
./mvnw testcd contracts
npx hardhat testcd frontend
npm test- Set strong JWT secret (min 256-bit)
- Configure production database
- Set up AWS S3 or production MinIO
- Deploy contract to mainnet/L2
- Configure HTTPS with SSL certificates
- Set up monitoring and logging
- Configure rate limiting
- Set up backup procedures
See .env.example for all required configuration.
MIT License - See LICENSE file for details.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
Built with ❤️ using Spring Boot, Next.js, and Ethereum