This repository contains the frontend of CurrentDao, a decentralized energy marketplace.
Built with Next.js, TypeScript, Tailwind CSS, and the App Router.
- User interface for energy trading
- Integration with backend APIs
- Authentication and user management
- Energy Producer Dashboard: Real-time tracking of production and earnings.
- Real-time Visualization: Live energy price charts and monthly portfolio metrics.
- WebSocket Integration: Live data updates every 5 seconds for dynamic monitoring.
- Responsive & Accessible: Fully optimized for mobile and desktop (WCAG 2.1 AA compliant).
- Dark Mode Support: Seamless theme switching for better user experience.
- Robust Error Handling: Graceful failure modes and loading skeletons.
- Responsive design with Tailwind CSS
- Mobile wallet integration with 12 supported wallet profiles
- Mobile payment rails with optimized under-5-second settlement targets
- Banking balance sync and cross-device wallet synchronization
- Mobile wallet analytics and security posture visibility
The mobile wallet dashboard now models the core requirements for energy trading checkout:
- 12 mobile wallet profiles spanning native wallets, banking apps, super-apps, and mobile DeFi
- Payment rails with 2-3 step optimized flows and sub-5-second settlement targets
- Banking app connections with synced balances, connection-health metadata, and instant-pay capability flags
- Cross-device wallet synchronization snapshots with coverage, latency, and conflict tracking
- Security audit visibility for PCI DSS, PSD2, SOC 2, biometric MFA, and device-integrity controls
- Wallet analytics for preferred rails, top wallets, usage patterns, and payment-flow reduction metrics
Core implementation files live under src/components/mobile, src/hooks/useMobileWallet.ts, src/services/mobile, and src/types/mobile-wallet.ts.
The mobile wallet dashboard now models the core requirements for energy trading checkout:
- 12 mobile wallet profiles spanning native wallets, banking apps, super-apps, and mobile DeFi
- Payment rails with 2-3 step optimized flows and sub-5-second settlement targets
- Banking app connections with synced balances, connection-health metadata, and instant-pay capability flags
- Cross-device wallet synchronization snapshots with coverage, latency, and conflict tracking
- Security audit visibility for PCI DSS, PSD2, SOC 2, biometric MFA, and device-integrity controls
- Wallet analytics for preferred rails, top wallets, usage patterns, and payment-flow reduction metrics
Core implementation files live under src/components/mobile, src/hooks/useMobileWallet.ts, src/services/mobile, and src/types/mobile-wallet.ts.
The biometric authentication dashboard now models secure mobile access and transaction approval with:
- Fingerprint verification under 1 second for device access
- Face recognition accuracy above 98%
- Voice biometric verification within 2 seconds
- Device-wide fallback coverage across PIN, passkey, hardware-key, and recovery flows
- Hardware-backed secure biometric storage aligned to FIPS 140-3 levels
- Multi-factor biometric confirmation for higher-value energy transactions
- Biometric analytics for modality adoption, success rates, and compliance posture
Core implementation files live under src/components/security, src/hooks/useBiometricAuth.ts, src/services/security, and src/types/biometric.ts.
- Node.js >= 18.x
- npm >= 11.x
git clone https://github.com/CurrentDao-org/CurrentDao-frontend.git
cd currentdao-frontend
npm installnpm run devnpm run test -- --coverage
npm run type-checkCreate a .env file based on .env.example
Please read CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License.
This project implements comprehensive performance optimizations targeting:
- Initial bundle under 1MB
- LCP < 2.5s (Largest Contentful Paint)
- CLS < 0.1 (Cumulative Layout Shift)
- FID < 100ms (First Input Delay)
- Lighthouse mobile score 90+
Components are lazy loaded to reduce initial bundle size:
| Component | File | Size | Reason |
|---|---|---|---|
| QRScanner | src/components/common/LazyQRScanner.tsx |
~60KB | Heavy html5-qrcode library, only needed on scan |
| ChartComparison | src/components/common/LazyChartComparison.tsx |
~12KB | Complex chart UI with modals, below fold |
| DrawingTools | src/components/common/LazyDrawingTools.tsx |
~11KB | Interactive SVG, only in advanced mode |
| PortfolioAnalysis | src/components/common/LazyPortfolioAnalysis.tsx |
~15KB | Multiple recharts, risk tab only |
| ChatContainer | src/components/common/LazyChatContainer.tsx |
~14KB | Full chat UI, separate page |
Usage:
import { LazyQRScanner } from '@/components/common/LazyQRScanner'
// Component loads only when rendered
<LazyQRScanner onScanSuccess={handleScan} />Webpack configuration splits bundles by vendor:
- Vendor chunks:
npm.[package-name].js - Common chunks: Shared components used across pages
- next/image with automatic WebP/AVIF conversion
- LazyImage component with intersection observer and blur placeholders
- Device-specific sizes: 640, 750, 828, 1080, 1200, 1920px
- 30-day cache TTL for optimized images
Usage:
import { LazyImage } from '@/components/common/LazyImage'
<LazyImage
src="/photo.jpg"
alt="Description"
width={800}
height={600}
blurDataURL="data:image/jpeg;base64,..."
/>| Resource Type | Cache Header |
|---|---|
Static assets (_next/static) |
public, max-age=31536000, immutable |
| Images (svg, jpg, png, etc.) | public, max-age=31536000, immutable |
| HTML pages | public, s-maxage=60, stale-while-revalidate=300 |
| API routes | no-store, must-revalidate |
Web Vitals are automatically tracked and reported:
- CLS: Cumulative Layout Shift
- LCP: Largest Contentful Paint
- FCP: First Contentful Paint
- TTFB: Time to First Byte
Manual measurement:
import { usePerformanceMark } from '@/hooks/useLazyLoading'
function MyComponent({ data }) {
usePerformanceMark('MyComponent', !!data)
return <div>{data ? <Content /> : <Skeleton />}</div>
}Analyze bundle size to identify optimization opportunities:
# Install bundle analyzer (if not already installed)
npm install --save-dev @next/bundle-analyzer
# Run analysis
npm run analyzeGenerates reports in .next/analyze/:
client.html- Client bundle visualizationserver.html- Server bundle visualization
Available in src/hooks/useLazyLoading.ts:
useIntersectionObserver- Lazy load when element enters viewportuseLazyComponent- Load component dynamically on intersectionusePerformanceMark- Track render timingusePrefetch- Prefetch routes on hover (with connection awareness)
Available in src/utils/performanceHelpers.ts:
reportWebVital- Send metrics to analyticsisSlowConnection- Detect 2G/slow connectionsgenerateBlurDataURL- Create placeholder imagespreconnect- Preconnect to originsmeasureTime- Profile code executionchunkArray- Batch render large lists
Run these checks locally:
# Build and analyze
npm run build
npm run analyze
# Verify bundle size
du -h .next/static/chunks/*.js | sort -h
# Lighthouse CI (requires Chrome)
npx lighthouse http://localhost:3000 --output=html --output-path=./lighthouse-report.htmlTargets:
- JS bundle: < 200KB gzipped (initial)
- CSS: < 50KB gzipped
- Images: Serve WebP/AVIF with proper sizing
- Fonts: Use
display: swap, preconnect to font CDN