Complete installation and deployment guide for judges and developers.
- Node.js 18+ (Download)
- npm 9+ (comes with Node.js)
- Git (optional, for version control)
node --version # Should be 18.0.0 or higher
npm --version # Should be 9.0.0 or higher# Install root dependencies
npm install
# Install all workspace dependencies (frontend + backend)
npm run install:all# Start both frontend and backend concurrently
npm run devThis will start:
- ✅ Frontend: http://localhost:5173
- ✅ Backend: http://localhost:3000
Navigate to http://localhost:5173 and you'll see the FinGuard dashboard!
cd frontend
npm install
npm run devFrontend runs on: http://localhost:5173
cd backend
npm install
npm run devBackend runs on: http://localhost:3000
npm run buildOutput will be in frontend/dist/
cd frontend
npm run preview- Open http://localhost:5173
- Check:
- ✓ Total net worth displayed
- ✓ Risk meter showing score
- ✓ Asset allocation donut chart
- ✓ Sector allocation bars
- ✓ Portfolio alerts
- Click "Crash Simulator" tab
- Select a scenario (e.g., "2008-Style Financial Crisis")
- Click "Simulate Market Crash"
- Check:
- ✓ Red overlay appears
- ✓ Portfolio value drops
- ✓ Drawdown percentage shown
- ✓ Hardest hit assets displayed
- Click "Auto-Rebalance" tab
- Select risk profile (Conservative/Moderate/Aggressive)
- Adjust rebalance intensity slider
- Click "Auto-Rebalance Portfolio"
- Check:
- ✓ Before/after comparison
- ✓ Risk score improvement
- ✓ Volatility reduction
- ✓ Summary metrics
- Click "Action Plan" tab
- Check:
- ✓ Phased execution plan (3 phases)
- ✓ Buy/sell recommendations
- ✓ Reasons for each action
- ✓ Priority badges
-
Start at Dashboard
- Point out: Red risk score (70+)
- Show: Concentrated holdings
- Highlight: Portfolio alerts
-
Simulate Market Crash
- Navigate to Crash Simulator
- Select "2008-Style Financial Crisis"
- Click simulate
- Show: -35% to -45% drawdown
- Emphasize: Educational value
-
Fix the Portfolio
- Navigate to Rebalancing
- Select "Moderate" risk profile
- Set intensity to 40%
- Click rebalance
- Show: Risk score drops from 70 → 45
- Show: Volatility reduces by 30%
-
Review Action Plan
- Navigate to Action Plan
- Walk through Phase 1 recommendations
- Explain: Why each buy/sell makes sense
- Highlight: Clear explanations, not black box
- Go to Crash Simulator
- Note current portfolio value
- Simulate crash → Show -40% drop
- Reset simulation
- Go to Rebalancing → Rebalance portfolio
- Go back to Crash Simulator
- Simulate same crash on rebalanced portfolio → Show only -25% drop
- Key message: Diversification reduced crash impact by 15%!
DU Hacks/
├── frontend/ # React + Vite app
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── ui/ # Basic components (Card, Button, etc.)
│ │ │ ├── RiskMeter.jsx
│ │ │ ├── AssetAllocationChart.jsx
│ │ │ └── SectorAllocationChart.jsx
│ │ ├── lib/ # Core business logic
│ │ │ ├── portfolioNormalizer.js # Data normalization
│ │ │ ├── riskEngine.js # Risk calculations
│ │ │ ├── crashSimulator.js # Market crash logic
│ │ │ ├── rebalancer.js # Rebalancing algorithm
│ │ │ └── utils.js # Helper functions
│ │ ├── pages/ # Main screens
│ │ │ ├── Dashboard.jsx
│ │ │ ├── CrashSimulator.jsx
│ │ │ ├── Rebalancing.jsx
│ │ │ └── ActionPlan.jsx
│ │ ├── data/
│ │ │ └── mockData.js # Demo portfolio data
│ │ ├── App.jsx # Main app component
│ │ ├── main.jsx # Entry point
│ │ └── index.css # Global styles
│ ├── index.html
│ ├── package.json
│ └── vite.config.js
│
├── backend/ # Express API (minimal)
│ ├── server.js # Backend server
│ ├── package.json
│ └── README.md
│
├── package.json # Root workspace config
├── README.md # Project overview
└── SETUP.md # This file
Frontend (5173):
# Kill process on port 5173 (Windows)
netstat -ano | findstr :5173
taskkill /PID <PID> /F
# Then restart
npm run dev:frontendBackend (3000):
# Kill process on port 3000 (Windows)
netstat -ano | findstr :3000
taskkill /PID <PID> /F
# Then restart
npm run dev:backend# Clean install
rm -rf node_modules frontend/node_modules backend/node_modules
rm package-lock.json frontend/package-lock.json backend/package-lock.json
npm run install:allcd frontend
rm -rf node_modules dist
npm install
npm run buildEdit frontend/src/data/mockData.js:
export const MOCK_PORTFOLIO_CONCENTRATED = [
{
symbol: 'YOUR_STOCK',
name: 'Your Company Name',
type: 'EQUITY',
value: 100000,
quantity: 40,
currentPrice: 2500,
},
// Add more assets...
];Edit frontend/src/lib/rebalancer.js:
export const RISK_PROFILES = {
CONSERVATIVE: {
maxStockWeight: 0.15, // Change to 0.10 for 10% max
maxSectorWeight: 0.25, // Change as needed
// ...
},
};Edit frontend/src/lib/crashSimulator.js:
FINANCIAL_CRISIS: {
name: '2008-Style Financial Crisis',
impacts: {
[ASSET_TYPES.EQUITY]: { min: -0.45, max: -0.35 }, // Adjust impact
// ...
},
}| Layer | Technology | Purpose |
|---|---|---|
| Frontend Framework | React 18 | UI components & state management |
| Build Tool | Vite | Fast development & optimized builds |
| Styling | Tailwind CSS | Utility-first styling |
| Charts | Recharts | Data visualization |
| Icons | Lucide React | Beautiful icons |
| Backend | Express.js | API server (minimal) |
| Language | JavaScript (ES6+) | Modern JavaScript features |
- HHI calculation:
Σ(wi²)for concentration - Portfolio volatility:
σp = √(wᵀΣw) - Risk score: Weighted composite (45% vol + 35% conc + 20% top)
- Zero server-side storage: All calculations client-side
- No API calls needed: Fully functional offline
- Data never leaves browser: True privacy
- Every metric is explained
- Clear reasons for recommendations
- Transparent algorithms (no black box)
- Historical crash data (2008, 2020)
- Modular architecture
- Reusable components
- Type-safe utilities
- Error handling
- Responsive design
cd frontend
npm install -g vercel
vercelcd frontend
npm run build
# Upload dist/ folder to Netlify# Coming soon - Dockerfile included in production versionFor issues during judging:
- Check troubleshooting section above
- Ensure Node.js 18+ is installed
- Try clean reinstall:
npm run install:all
Remember: This is a client-side app. Backend is optional!
Before presenting:
- Frontend runs on port 5173
- Dashboard loads successfully
- Risk meter displays correctly
- Charts render properly
- Crash simulation works
- Rebalancing shows before/after
- Action plan displays recommendations
- No console errors
- Responsive on different screen sizes
Built with ❤️ for DU Hacks 2026
🛡️ FinGuard - "We don't predict markets. We prepare portfolios to survive them."