A modern, full-stack loan monitoring and risk management platform built with Next.js 14+, TypeScript, Supabase, and shadcn/ui.
- π 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)
- π 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
- 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
- Node.js 18+ and npm
- Supabase account (free tier available)
- Git
- Clone the repository
git clone <your-repo-url>
cd loanguard- Install dependencies
npm install- 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_keyGet these values from your Supabase Dashboard β Project Settings β API
- 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
- Run the development server
npm run dev- Open your browser
Navigate to http://localhost:3000
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)
| Route | Description | Access |
|---|---|---|
/ |
Landing page | Public |
/login |
User login | Public |
/signup |
User registration | Public |
/dashboard |
Main dashboard | Protected |
/loans/[id] |
Loan details | Protected |
- profiles - User profiles with roles (lender/borrower)
- loans - Loan records with risk scores and payment tracking
- alerts - System alerts and notifications
- esg_metrics - ESG performance metrics (optional)
See DEPLOYMENT.md for complete SQL schema.
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter
npm run lint- TypeScript: Strict mode enabled
- ESLint: Configured with Next.js recommended rules
- Path Aliases: Use
@/for absolute imports
# Add a new shadcn/ui component
npx shadcn@latest add <component-name>See DEPLOYMENT.md for detailed deployment instructions to Vercel.
Required Environment Variables:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEY
- 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
- Full loan information display
- Payment history table
- Add payment functionality
- Update loan status
- Delete loan with confirmation
- Alerts accordion
- ESG metrics (if available)
- Slide-out panel with all alerts
- Real-time notifications
- Mark as read/unread
- Delete alerts
- Navigate to related loans
- Overall ESG score
- Individual scores (Environmental, Social, Governance)
- Carbon footprint tracking
- Add custom or mock data
- β 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
- 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
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
For support, please open an issue in the GitHub repository.
- Next.js - React framework
- Supabase - Backend platform
- shadcn/ui - UI components
- Vercel - Deployment platform
- Tailwind CSS - Styling framework
Built with β€οΈ for better loan management