Skip to content

System625/loanguard

Repository files navigation

LoanGuard πŸ›‘οΈ

A modern, full-stack loan monitoring and risk management platform built with Next.js 14+, TypeScript, Supabase, and shadcn/ui.

LoanGuard TypeScript Supabase Tailwind CSS

Features ✨

Core Functionality

  • πŸ“Š Portfolio Dashboard - Track all loans with interactive charts and real-time statistics
  • ⚠️ Risk Assessment - Automated risk scoring based on loan parameters and payment history
  • πŸ”” Smart Alerts - Real-time notifications for overdue payments and high-risk loans
  • πŸ’° Payment Tracking - Record and monitor payment history with detailed analytics
  • 🌱 ESG Metrics - Track environmental, social, and governance performance
  • πŸ“ˆ Data Visualization - Interactive charts using Recharts (line, pie, and bar charts)

Technical Features

  • πŸ” Secure Authentication - Email/password auth with Supabase and protected routes
  • ⚑ Real-time Updates - Live data synchronization using Supabase subscriptions
  • πŸ“± Responsive Design - Mobile-first approach with Tailwind CSS
  • 🎨 Modern UI - Beautiful components from shadcn/ui
  • πŸ›‘οΈ Type Safety - Full TypeScript coverage with strict mode
  • βœ… Form Validation - Zod schemas for robust input validation
  • 🌐 Server & Client Components - Optimized with Next.js App Router
  • πŸ”„ Error Handling - Global error boundaries and toast notifications

Tech Stack πŸš€

  • Framework: Next.js 14+ (App Router)
  • Language: TypeScript
  • Database: Supabase (PostgreSQL)
  • Authentication: Supabase Auth
  • Styling: Tailwind CSS
  • UI Components: shadcn/ui + Radix UI
  • Charts: Recharts
  • Icons: Lucide React
  • Form Validation: Zod
  • Notifications: Sonner

Getting Started 🏁

Prerequisites

  • Node.js 18+ and npm
  • Supabase account (free tier available)
  • Git

Installation

  1. Clone the repository
git clone <your-repo-url>
cd loanguard
  1. Install dependencies
npm install
  1. Set up environment variables

Create a .env.local file in the root directory:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

Get these values from your Supabase Dashboard β†’ Project Settings β†’ API

  1. Set up the database

Run the SQL scripts from DEPLOYMENT.md in your Supabase SQL Editor to create:

  • Tables (profiles, loans, alerts, esg_metrics)
  • Indexes
  • Row Level Security (RLS) policies
  • Triggers
  1. Run the development server
npm run dev
  1. Open your browser

Navigate to http://localhost:3000

Project Structure πŸ“

loanguard/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/              # Authentication routes
β”‚   β”‚   β”œβ”€β”€ login/           # Login page
β”‚   β”‚   └── signup/          # Signup page
β”‚   β”œβ”€β”€ (protected)/         # Protected routes
β”‚   β”‚   β”œβ”€β”€ dashboard/       # Main dashboard
β”‚   β”‚   └── loans/[id]/      # Loan details pages
β”‚   β”œβ”€β”€ layout.tsx           # Root layout with providers
β”‚   β”œβ”€β”€ page.tsx             # Landing page
β”‚   β”œβ”€β”€ error.tsx            # Global error boundary
β”‚   └── not-found.tsx        # 404 page
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/                  # shadcn/ui components
β”‚   β”œβ”€β”€ Alerts.tsx           # Alerts panel component
β”‚   β”œβ”€β”€ DashboardCharts.tsx  # Charts component
β”‚   β”œβ”€β”€ NewLoanModal.tsx     # Create loan modal
β”‚   └── SupabaseProvider.tsx # Supabase context provider
β”œβ”€β”€ lib/
β”‚   └── supabaseClient.ts    # Supabase client config
└── .env.local               # Environment variables (create this)

Key Routes πŸ—ΊοΈ

Route Description Access
/ Landing page Public
/login User login Public
/signup User registration Public
/dashboard Main dashboard Protected
/loans/[id] Loan details Protected

Database Schema πŸ—„οΈ

Tables

  1. profiles - User profiles with roles (lender/borrower)
  2. loans - Loan records with risk scores and payment tracking
  3. alerts - System alerts and notifications
  4. esg_metrics - ESG performance metrics (optional)

See DEPLOYMENT.md for complete SQL schema.

Development πŸ’»

Available Scripts

# Start development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Run linter
npm run lint

Code Quality

  • TypeScript: Strict mode enabled
  • ESLint: Configured with Next.js recommended rules
  • Path Aliases: Use @/ for absolute imports

Adding New Components

# Add a new shadcn/ui component
npx shadcn@latest add <component-name>

Deployment πŸš€

See DEPLOYMENT.md for detailed deployment instructions to Vercel.

Quick Deploy to Vercel

Deploy with Vercel

Required Environment Variables:

  • NEXT_PUBLIC_SUPABASE_URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY

Features Overview πŸ“‹

Dashboard

  • Summary cards (Total Loans, Total Amount, Overdue, Average Risk)
  • Loans table with status tabs
  • Interactive charts (Line, Pie, Bar)
  • Create new loan modal
  • Real-time updates

Loan Details

  • Full loan information display
  • Payment history table
  • Add payment functionality
  • Update loan status
  • Delete loan with confirmation
  • Alerts accordion
  • ESG metrics (if available)

Alerts System

  • Slide-out panel with all alerts
  • Real-time notifications
  • Mark as read/unread
  • Delete alerts
  • Navigate to related loans

ESG Metrics

  • Overall ESG score
  • Individual scores (Environmental, Social, Governance)
  • Carbon footprint tracking
  • Add custom or mock data

Security πŸ”’

  • βœ… Server-side authentication checks
  • βœ… Row Level Security (RLS) on all tables
  • βœ… Protected API routes
  • βœ… Environment variables for secrets
  • βœ… HTTPS in production
  • βœ… Input validation with Zod
  • βœ… XSS protection with React

Performance ⚑

  • Server Components for reduced bundle size
  • Optimized images with Next.js Image component
  • Real-time subscriptions only where needed
  • Efficient database queries
  • Code splitting and lazy loading

Browser Support 🌐

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Contributing 🀝

Contributions are welcome! Please follow these steps:

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

License πŸ“„

This project is licensed under the MIT License.

Support πŸ’¬

For support, please open an issue in the GitHub repository.

Acknowledgments πŸ™


Built with ❀️ for better loan management

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors