Fin-Trust is a premium, production-ready peer-to-peer (P2P) loan matching platform. It automates financial assessments, document KYC parsing, and location-based borrower-lender pairing using artificial intelligence and geolocational metrics.
- Project Overview
- Key Features
- Technology Stack
- System Architecture
- Folder Structure
- Installation & Setup
- Environment Variables
- Documentation Links
- Performance Optimizations
- Security Practices
- Future Roadmap
- Contribution Guidelines
- Author Info
Fin-Trust was built to bridge the gap in decentralized loan transactions. By automating trust metric validations, the platform eliminates the high overhead costs and slow timelines of traditional credit scoring, while keeping P2P interactions transparent and secure.
- Profile Setup & Location Capture: The application automatically retrieves coordinates via browser geolocation and reverse-geocodes them to a read-only city input to block user spoofing.
- AI-Driven KYC Analysis: Uploaded credentials (Aadhaar, PAN, Bank Statements) are verified via Tesseract OCR. The parsed metadata is analyzed by the Google Gemini API to output risk rates and natural-language risk breakdowns.
- Smart Matching: The backend computes a proximity metric using the Haversine formula and checks criteria (lending bounds, minimum trust requirements, duration alignment) to suggest highly compatible local matches.
- Local Engagement: Users review proximity badges on their dashboards. Private names and contact links are locked and only shared after mutual match acceptance.
- Secure Authentication: Verification codes (OTP) sent to the user's email to verify registration.
- Stateless Tokens: Secure session validation via JWT Bearer headers.
- Role-Based Access Control: Strict routing parameters distinguishing
borrower,lender, andadminportals.
- Automated Geolocation: Fast coords resolution with Nominatim fallback checks.
- Anti-Spoofing Rules: Locked coordinates inputs to ensure location parameters cannot be modified on the page.
- Proximity Calculation: Backend computing of the exact distance in meters between matched profiles.
- Document Metadata Verification: OCR scanning of PAN, Aadhaar, and Bank Statements.
- Score Generation: Automating credit scoring (0β100) using employment status, documentation uploads, and name consistency.
- Natural Language Explanations: Custom risk analysis summaries generated via the Google Gemini API.
| Component | Technology | Description |
|---|---|---|
| Frontend | React 19, Vite, Tailwind CSS v4, GSAP | Client application, custom responsive layouts, micro-animations. |
| Backend | Node.js, Express, Multer, Mongoose | REST API framework, file uploading, database modeling. |
| Database | MongoDB Atlas | NoSQL document storage. |
| External APIs | Gemini API, OSM Nominatim | AI explanations and address resolution. |
| Email Client | Brevo, Resend, Nodemailer | Outbound SMTP and API email deliverability. |
Fin-Trust is structured as a client-server web app:
graph TD
Client[Vite React Client] -->|1. Request Credentials| API[Express API Server]
API -->|2. Query Data| DB[(MongoDB Atlas)]
API -->|3. Evaluate Risk| Gemini[Google Gemini AI]
API -->|4. Email OTP| Email[Brevo / Resend HTTP API]
Client -->|Coordinates Lookup| Nominatim[OSM Nominatim Geocoder]
Detailed details are available in the Architecture Documentation.
fin-trust/
βββ backend/
β βββ config/ # DB & Transporter configurations
β βββ controllers/ # Route business logic (auth, matches, borrowers)
β βββ middleware/ # Authentication & Error handlers
β βββ models/ # Mongoose collections schemas
β βββ utils/ # Trust rating engine & AI tools
β βββ server.js # Entrypoint application file
βββ frontend/
β βββ public/ # Assets and icons
β βββ src/
β β βββ api/ # Axios interceptors & endpoints
β β βββ components/ # Forms, buttons, cards
β β βββ context/ # React authentication state providers
β β βββ layouts/ # Master layout shells
β β βββ pages/ # Router pages
β βββ vite.config.js # Vite bundle rules
βββ docs/ # Project documentation guides
Detailed details are available in the Database Documentation.
- Node.js (v18.x or v20.x recommended)
- MongoDB account (local installation or Atlas cluster)
git clone https://github.com/codedbyanup/Fin-trust.git
cd Fin-trustcd backend
npm install
cp .env.example .envUpdate .env with your variables:
PORT=5000
MONGO_URI=mongodb+srv://your_connection_string
JWT_SECRET=your_secret_key
EMAIL_USER=your_email
EMAIL_PASS=your_email_app_password
BREVO_API_KEY=your_brevo_key
GEMINI_API_KEY=your_gemini_keyStart the development server:
npm run devcd ../frontend
npm install
cp .env.example .envUpdate .env:
VITE_API_URL=http://localhost:5000/apiStart the client application:
npm run devDetailed design specifications can be found under the /docs directory:
- ποΈ System Architecture: Diagrams, workflows, and calculations.
- π API Documentation: Request formats, status codes, and endpoint guides.
- πΎ Database Design: ER diagram, validation fields, and collection tables.
- βοΈ Deployment Guide: Render, Vercel, and email SMTP bypass rules.
- Lazy Loading: Router components use React's
lazyand Suspense boundaries to load assets dynamically, reducing first-paint time. - Fast Connection Awaiting: Server does not start listening on the port until MongoDB has completed its connection handshakes, avoiding timed-out request blocks.
- SMTP Bypass: Deliveries of emails utilize Brevo/Resend HTTP endpoints directly on port
443to bypass port blocks on hosting environments.
- Password Encryption: Automated hashing with salt factor 10 using
bcryptjson user schema hooks. - Fail-Fast Connections: Added timeout limits (
serverSelectionTimeoutMS: 5000) on Mongoose to prevent application locks. - stateless JWT Authorization: Bearer token checks validation strictly on protected routing middlewares.
- CORS Constraints: Origin checks validate headers against domain configurations.
- Instant Chat Messages: Direct chat channels between accepted matches.
- Repayment Tracking: Payment schedule logs and installment calculations.
- Mobile App: React Native wrapper app targeting iOS & Android devices.
- Advanced Credit Bureau Sync: Syncing with credit registries to import historical metrics.
We welcome community contributions. To contribute:
- Fork this project.
- Create a branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'feat: add amazing feature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
- Author: Anup Kodase
- GitHub: @codedbyanup
- LinkedIn: linkedin.com/in/anup-t-3a3763331
- Email: anupkodase@gmail.com