This is a submission for the DEV Weekend Challenge: Community
The Community
Growing up, I watched my neighborhood operate on trust. When someone needed money for medical bills or to start a small business, they didn't go to a bankβthey went to their neighbors. These informal lending circles, common across India and many developing countries, are lifelines for families who fall outside the traditional banking system.
But here's the thing: these communities are fragile. When one person defaults, it doesn't just hurt the lender, it triggers a cascade. The lender can't pay their own obligations, so they default. Then their lenders default. Like dominoes falling, one financial shock can devastate an entire network of families who were just trying to help each other.
I built Resilico for these communities, the savings clubs, lending circles, cooperative societies, and neighborhood networks that keep people afloat but lack the tools to see danger coming.
What I Built
Resilico (Community Financial Stability Simulator) is a full-stack web application that brings institutional-grade financial risk assessment to grassroots communities. Think of it as stress-testing software that central banks use to evaluate systemic riskβbut designed for groups of 10-200 people who lend to each other informally.
Core Features:
π Network Graph Visualization
See your community's lending relationships as an interactive graph. Nodes are sized by emergency reserves and color-coded by risk level (green = healthy, red = vulnerable). Instantly spot who's over-leveraged and where contagion could spread.
π Liquidity Simulation
Run week-by-week simulations tracking each member's cash flow. Watch as income arrives, expenses get paid, and loan obligations come due. The system calculates Liquidity Coverage Ratios (LCR) and flags members entering financial distress.
β‘ Default Cascade Engine
When someone defaults, see exactly how the shock propagates through your network. The cascade animation shows step-by-step contagion: who loses money, who gets pushed into default, and how deep the damage goes.
π§ͺ Stress Testing
Run "what-if" scenarios with Monte Carlo simulation:
- Income shock: What if everyone's income drops 30%?
- Expense spike: What if medical emergencies hit?
- Random defaults: What if 5 random members fail?
- Targeted shock: What if your most central member defaults?
π Stability Index (0-100)
A composite score measuring your community's financial resilience, calculated from default rates, liquidity ratios, risk concentration, and network structure.
π€ AI Powered Rules Based Policy Recommendations
Get actionable suggestions based on your data:
- "Emergency Buffer Increase: Default rate is 23.5%, exceeding the 20% threshold. Recommend mandating minimum emergency reserves of 3x monthly expenses."
- "Exposure Cap on Central Nodes: Member 42 has centrality 0.87, which is 4.2x the average. Cap single-node exposure to reduce single-point-of-failure risk."
π PDF Reports
Export professional stability reports with all metrics, stress test results, and recommendations for community leaders to review.
Demo
π Try Resilico Live
π¬ Watch Demo Video
Quick Start:
- Click "Generate Demo Community" to create 50 members with realistic data
- Explore the Dashboard to see the stability score
- Visit Network to visualize lending relationships
- Run a Simulation to see liquidity over time
- Try Stress Testing with different scenarios
- Export a PDF report
Code
Resilico
Community Financial Stability Simulator (CFSS)
A full-stack web application that simulates and stress-tests the financial stability of small communities (10-200 members). Model systemic risk similar to how central banks stress-test financial institutions.
π― Overview
Resilico helps community financial organizations, microfinance institutions, and researchers understand and mitigate systemic risk in lending networks. By modeling members as nodes and loans as edges in a directed graph, the platform simulates liquidity flows, detects cascade failures, and provides AI-powered policy recommendations.
Key Capabilities
- Network Modeling - Build detailed financial networks with member profiles and lending relationships
- Liquidity Simulation - Run week-by-week cash flow simulations tracking distress events
- Cascade Detection - Model how one default can trigger chain reactions through the network
- Stress Testing - Monte Carlo scenarios: income shocks, expense spikes, random/targeted defaults
- Stability Scoring - Composite 0-100 index measuring community financial resilience
- AI Recommendations - Intelligent policy suggestions powered by Groq AI
Project Structure
resilico/
βββ client/ # Next.js frontend
β βββ app/
β β βββ dashboard/ # Executive dashboard
β β βββ network/ # Graph visualization
β β βββ simulation/ # Liquidity simulation
β β βββ stress-test/ # Stress testing scenarios
β β βββ data/ # CRUD for members/loans
β β βββ reports/ # Policy recommendations & PDF export
β βββ components/
β β βββ graph/ # NetworkGraph, StabilityGauge, SimulationChart
β β βββ ui/ # Reusable UI components
β βββ lib/
β βββ api.ts # API client with TypeScript types
β
βββ server/ # FastAPI backend
βββ app/
β βββ routers/ # API endpoints
β βββ services/
β β βββ engines/ # Simulation, cascade, graph logic
β β βββ analysis/ # Stability scoring, policy recommendations
β βββ db/
β β βββ models.py # SQLAlchemy models
β β βββ seed.py # Demo data generator
β βββ schemas/ # Pydantic validation models
βββ main.py
Key Technical Highlights
Graph Analysis (NetworkX)
def compute_degree_centrality(G: nx.DiGraph) -> Dict[int, float]:
return nx.degree_centrality(G)
def compute_trust_propagation(G: nx.DiGraph) -> Dict[int, float]:
return nx.pagerank(G, weight='probability')
Liquidity Coverage Ratio Calculation
lcr = liquid_assets / upcoming_obligations
if lcr < 1.0:
state['is_distressed'] = True
Cascade Propagation
def propagate_default(defaulting_members, G, current_state):
queue = list(defaulting_members)
cascade_depth = 0
while queue:
for borrower_id in queue:
for lender_id in G.successors(borrower_id):
exposure = G[borrower_id][lender_id]['amount']
lender_state['liquid_assets'] -= exposure
if lender_state['liquid_assets'] < 0:
queue.append(lender_id)
cascade_depth += 1
return cascade_depth
Stability Index Formula
stability_index = (
(1 - default_rate) * 0.4 +
avg_liquidity_ratio * 0.3 +
(1 - risk_concentration_index) * 0.2 +
network_resilience_score * 0.1
) * 100
How I Built It
Tech Stack
Frontend:
- Next.js 16 with App Router for the React framework
- TypeScript for type safety
- Tailwind CSS for styling with custom design system
- Cytoscape.js for interactive network graph visualization
- Recharts for time-series charts
- Framer Motion for smooth animations
- Driver.js for interactive tutorials
Backend:
- FastAPI for high-performance Python API
- NetworkX for graph analysis algorithms
- SQLAlchemy with SQLite (easily switchable to PostgreSQL)
- Pydantic for request/response validation
- ReportLab for PDF generation
- SlowAPI for rate limiting
- Celery + Redis (optional) for async stress testing
Development Process
Day 1: Core Architecture
- Set up monorepo structure with client/server separation
- Designed database schema (members, exposures, simulation_runs, results)
- Implemented graph engine with NetworkX
- Built basic API endpoints for CRUD operations
Day 2: Simulation Logic
- Implemented liquidity simulation with weekly time steps
- Built default cascade propagation algorithm
- Added stress testing scenarios (income shock, expense spike, random defaults, targeted shock)
- Implemented Monte Carlo iteration support
Day 3: Frontend & Visualization
- Created dashboard with stability gauge and metrics
- Integrated Cytoscape for network graph
- Built simulation page with Recharts
- Added cascade animation with step-through controls
Day 4: Polish & Features
- Implemented policy recommendation engine
- Added PDF report generation
- Built data management CRUD interface
- Added animations, tutorials, and responsive design
- Deployed and tested
Challenges & Solutions
Challenge 1: Cascade Termination
Early versions had infinite loops when circular lending existed. Solution: Track processed nodes and implement max iteration limits.
Challenge 2: Graph Performance
Rendering 200+ nodes in Cytoscape was slow. Solution: Optimized layout algorithm parameters and added debouncing to interactions.
Challenge 3: Realistic Demo Data
Random data looked fake. Solution: Researched Indian income distributions and implemented weighted sampling from realistic brackets (βΉ8k-βΉ100k monthly).
Challenge 4: Making Complexity Accessible
Financial risk modeling is intimidating. Solution: Used color coding (green/yellow/red), animated cascades, and plain-language explanations in recommendations.
Why This Matters
In 2024, I read about a savings club in my city that collapsed when three members lost their jobs during an economic downturn. Thirty families lost their emergency funds. The tragedy wasn't the initial shockβit was that nobody saw the cascade coming.
Resilico won't prevent job losses or medical emergencies. But it can help community leaders ask the right questions:
- Are we too dependent on one or two wealthy members?
- Do we have enough collective reserves to survive a shock?
- What happens if our most central member defaults?
These are questions that banks and governments answer with sophisticated models. Now, communities can too.
What's Next
If this project gains traction, I'd love to:
- Add mobile app for community leaders
- Integrate real-time data feeds (if communities want to track actual transactions)
- Build AI-powered recommendations using LLMs for more nuanced policy suggestions
- Create educational content about financial resilience
- Partner with microfinance organizations to pilot in real communities
Built with β€οΈ for communities that help each other survive.
Top comments (0)