Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fin-Trust - Peer-to-Peer Loan AI Matching Platform

React Node.js Express MongoDB Tailwind CSS Gemini AI
Repo Size Top Language Commit Activity Last Commit

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.


πŸ”— Live Demo


πŸ“– Table of Contents

  1. Project Overview
  2. Key Features
  3. Technology Stack
  4. System Architecture
  5. Folder Structure
  6. Installation & Setup
  7. Environment Variables
  8. Documentation Links
  9. Performance Optimizations
  10. Security Practices
  11. Future Roadmap
  12. Contribution Guidelines
  13. Author Info

πŸ” Project Overview

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.

How It Works:

  1. 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.
  2. 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.
  3. 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.
  4. Local Engagement: Users review proximity badges on their dashboards. Private names and contact links are locked and only shared after mutual match acceptance.

✨ Key Features

πŸ” Authentication & Control

  • 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, and admin portals.

πŸ“ Local Proximity Engine

  • 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.

πŸ›‘οΈ Trust Analysis & AI OCR

  • 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.

πŸ› οΈ Technology Stack

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.

πŸ›οΈ System Architecture

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]
Loading

Detailed details are available in the Architecture Documentation.


πŸ“ Folder Structure

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.


πŸš€ Installation & Setup

Prerequisites

  • Node.js (v18.x or v20.x recommended)
  • MongoDB account (local installation or Atlas cluster)

1. Clone the Repository

git clone https://github.com/codedbyanup/Fin-trust.git
cd Fin-trust

2. Configure Backend

cd backend
npm install
cp .env.example .env

Update .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_key

Start the development server:

npm run dev

3. Configure Frontend

cd ../frontend
npm install
cp .env.example .env

Update .env:

VITE_API_URL=http://localhost:5000/api

Start the client application:

npm run dev

πŸ“˜ Documentation Links

Detailed design specifications can be found under the /docs directory:


⚑ Performance Optimizations

  • Lazy Loading: Router components use React's lazy and 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 443 to bypass port blocks on hosting environments.

πŸ›‘οΈ Security Practices

  • Password Encryption: Automated hashing with salt factor 10 using bcryptjs on 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.

πŸ—ΊοΈ Future Roadmap

  • 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.

🀝 Contribution Guidelines

We welcome community contributions. To contribute:

  1. Fork this project.
  2. Create a branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'feat: add amazing feature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

✍️ Author Info

About

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.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages