A modern fintech web application that helps users receive stablecoins, automatically protect their savings, and prevent inflation erosion. Built with Next.js, blockchain smart contracts, and designed for African remittance users.
- Auto-Save by Default: Automatically split incoming USDC/USDT into spendable Naira and protected savings
- Inflation Protection: Keep savings in stablecoins (USDC/USDT) to protect against Naira devaluation
- Flex Mode: Optional feature to skip savings on one transfer with a 7-day cooldown
- Smart Split Engine: Configurable savings percentage (minimum 10%)
- Real-time Dashboard: View Naira balance, USD savings, and transaction history
- Insights Analytics: Track total saved, growth charts, and savings comparisons
- Blockchain-Backed: Secure smart contracts on EVM-compatible blockchains (Monad)
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: TailwindCSS + Shadcn UI
- State Management: Zustand
- Charts: Recharts
- Icons: Lucide React
- Notifications: Sonner
- Runtime: Node.js (Next.js API Routes)
- Storage: MongoDB
- Authentication: JWT + Cookies
- API: RESTful endpoints
- Smart Contracts: Solidity 0.8.19
- Framework: Foundry
- Network: Monad EVM Testnet
- Token: MockUSDC (ERC20)
/vercel/share/v0-project/
├── app/
│ ├── layout.tsx # Root layout with metadata
│ ├── page.tsx # Landing page
│ ├── globals.css # Global styles + design tokens
│ ├── (auth)/ # Auth routes (no sidebar)
│ │ ├── layout.tsx
│ │ ├── login/page.tsx
│ │ └── register/page.tsx
│ ├── (app)/ # Protected routes (with sidebar)
│ │ ├── layout.tsx # App layout with navigation
│ │ ├── dashboard/page.tsx
│ │ ├── receive/page.tsx
│ │ ├── savings/page.tsx
│ │ ├── insights/page.tsx
│ │ ├── flex-mode/page.tsx
│ │ └── settings/page.tsx
│ └── api/ # Backend API routes
│ ├── auth/
│ │ ├── register/route.ts
│ │ └── login/route.ts
│ ├── wallet/
│ │ ├── route.ts # GET wallet info
│ │ └── receive/route.ts # POST simulate transfer
│ ├── flex-mode/
│ │ └── activate/route.ts
│ ├── savings/route.ts # GET savings data
│ └── user/
│ └── settings/route.ts
├── lib/
│ ├── auth.ts # Auth utilities & JWT
│ ├── wallet.ts # Wallet logic & smart split
│ └── db/
│ └── models.ts # Database models and MongoDB collections
├── middleware.ts # Route protection & redirects
├── contracts/ # Solidity smart contracts
│ ├── src/
│ │ ├── SmartWallet.sol # Main smart contract
│ │ └── MockUSDC.sol # ERC20 test token
│ ├── script/
│ │ └── Deploy.s.sol # Foundry deployment script
│ └── foundry.toml # Foundry configuration
└── public/ # Static assets
- Node.js 18+
- pnpm or npm
- (Optional) Foundry for smart contract deployment
- Clone/Open the project
cd /vercel/share/v0-project- Install dependencies
pnpm install- Configure environment variables
cp .env.example .env.localSet MONGODB_URI to your MongoDB connection string (Atlas or local MongoDB).
- Run the development server
pnpm dev- Open in browser
http://localhost:3000
Follow these steps to test the complete NairaFlow experience:
- Open http://localhost:3000
- See the hero section with feature highlights
- Click "Get Started" or "Login"
- Email:
demo@example.com - Password:
password123 - Account is created with auto-generated wallet
- Redirects to login page
- Enter credentials
- Redirected to dashboard
- See fresh account with ₦0 and $0
- Navigate to "Receive" page
- See your wallet address
- Simulate receiving $100
- Watch the split visualization:
- ₦108,000 spendable (90%)
- $10 protected savings (10%)
- View updated dashboard
- Click "Savings" in sidebar
- See $10 in protected vault
- View savings goals and withdrawal options
- Go to "Flex Mode" page
- Read the explanation
- Click "Activate Flex Mode"
- Status changes to "Ready to Use"
- Go back to "Receive"
- Simulate $100 transfer again
- See 0% savings (Flex Mode active!)
- ₦120,000 all spendable
- 7-day cooldown starts
- Click "Insights" in sidebar
- See total received: $200
- See total saved: $10
- Growth chart shows $10 saved at day 1, flat after flex mode
- Comparison: "Without NairaFlow: $0 saved"
- Adjust savings percentage (10-100%)
- Copy wallet address
- View security info
- Change notifications
- See updated balances
- Recent transactions listed
- Quick action buttons
POST /api/auth/register- Create new accountPOST /api/auth/login- Login with email/password
GET /api/wallet- Get wallet info (Naira, USD savings, flex mode status)POST /api/wallet/receive- Simulate receiving funds (applies smart split)
GET /api/savings- Get savings data, stats, and transaction history
POST /api/flex-mode/activate- Activate flex mode for next transfer
PATCH /api/user/settings- Update savings percentage
# Terminal 1: Start local Ethereum node
anvil
# Terminal 2: Deploy contracts
cd contracts
forge script script/Deploy.s.sol:DeployScript --rpc-url http://localhost:8545 --broadcast- Setup Foundry environment
cd contracts
forge init --force- Set environment variables (create
.env)
PRIVATE_KEY=your_private_key_here
MONAD_RPC_URL=https://testnet-rpc.monad.xyz
- Deploy to Monad Testnet
forge script script/Deploy.s.sol:DeployScript \
--rpc-url https://testnet-rpc.monad.xyz \
--broadcast \
--verify- Save deployed addresses (update frontend config)
SmartWallet: 0x...
MockUSDC: 0x...
- User registers with email/password
- Password is hashed with SHA256
- Wallet address auto-generated (40 hex chars)
- JWT token created and stored in httpOnly cookie
- Requests require valid token in cookies
/app/*- All app pages require authentication- Unauthenticated users redirected to
/auth/login - Authenticated users can't access auth pages
Incoming $100 USD
├─ 10% (default) → $10 saved in vault (USDC)
└─ 90% → ₦108,000 spendable (at 1 USD = ₦1200)
Incoming $100 USD (Flex Mode active)
├─ 0% → $0 saved
└─ 100% → ₦120,000 spendable
└─ Cooldown: 7 days before Flex Mode available again
- After using Flex Mode, 7-day cooldown begins
- During cooldown, normal savings rate applies
- After cooldown expires, user can activate Flex Mode again
Currently using mock exchange rate:
- 1 USD = ₦1200 (NGN)
- In production, integrate with real API (e.g., Coingecko, Binance)
// lib/wallet.ts
export function getExchangeRate(): number {
// Mock: returns 1200 ± 10
return MOCK_EXCHANGE_RATE + Math.random() * 20 - 10
}- In-memory storage using JavaScript
Map - Data stored in
lib/db/models.ts - Data resets on server restart
Replace with:
- MongoDB (as specified in tech stack)
- Supabase, Firebase, or other managed database
- Implement database migrations
- Primary: Deep Blue (Indigo) - For CTA buttons and key elements
- Secondary: Teal/Cyan - For savings and positive actions
- Accent: Teal/Cyan gradient - For highlights
- Neutral: Grays - For backgrounds and text
Located in app/globals.css:
- CSS custom properties for consistent theming
- Dark mode support built-in
- Responsive spacing and sizing
- Image Optimization: Next.js automatic image optimization
- Code Splitting: Automatic route-based code splitting
- API Caching: SWR for data fetching (can be added)
- Debounced Updates: Toast notifications use Sonner
- Password hashing (SHA256 - use bcrypt in production)
- JWT tokens with expiration
- httpOnly cookies for token storage
- Route middleware for auth protection
- Rate limiting (TODO)
- CSRF protection (TODO)
- Input validation (TODO)
- SQL injection prevention (N/A - in-memory storage)
-
Real Blockchain Integration
- Deploy on Monad mainnet
- Use real smart contract addresses
- Implement actual fund transfers
-
Enhanced Authentication
- Web3Auth for wallet login
- Google/GitHub OAuth (UI exists, needs implementation)
- Two-factor authentication
-
Database
- Switch to MongoDB Atlas
- Implement RLS with Supabase
- Database migrations and versioning
-
Features
- Savings goals with milestone alerts
- Recurring transfers
- Multi-currency support
- Push notifications
- Mobile app (React Native)
-
Analytics
- Heatmaps and user behavior tracking
- Advanced savings projections
- Financial advice recommendations
-
Compliance
- KYC/AML integration
- Regulatory compliance for remittances
- Audit trails for all transactions
- Register new account
- Login with credentials
- View wallet address
- Simulate $100 transfer
- Verify smart split (90% Naira, 10% savings)
- Activate Flex Mode
- Simulate transfer with Flex Mode (100% Naira, 0% savings)
- Check cooldown timer
- Update savings percentage
- View insights and charts
- Copy wallet address
- Logout and login again
# Run tests (when implemented)
pnpm test# Test Solidity contracts
cd contracts
forge test# Push to GitHub and connect to Vercel
# Automatic deployments on push to main
pnpm build
pnpm start# For production, set these in Vercel:
DATABASE_URL=...
JWT_SECRET=...
NEXT_PUBLIC_API_URL=...
# Kill process on port 3000
lsof -ti:3000 | xargs kill -9
pnpm devrm -rf node_modules pnpm-lock.yaml
pnpm install- Ensure private key is set in
.env - Check Monad testnet RPC endpoint
- Verify contract syntax:
forge build - Check gas prices and balance
For questions or issues:
- Check this README first
- Review API route implementations
- Check frontend component code
- Inspect browser console for errors
- Check server logs for API errors
MIT - See LICENSE file
This is a hackathon submission. Feel free to fork and extend!
Built with ❤️ for NairaFlow
Making remittances smarter, savings automatic, and financial security accessible.