πΊπΈ νκ΅μ΄
EarlyRetireSim β FIRE Calculator for the 2030s
A mobile-first early retirement (FIRE) calculator for the Toss app. Enter your age, monthly income, expenses, and current net worth to instantly see when you can retire and compare savings rate scenarios.
Designed for the Toss mini-app platform (App-in-Toss) with native TDS components and optimized for users curious about financial independence. Calculates retirement age using the 4% rule, simulates monthly compound growth, and visualizes asset accumulation trajectories.
Features
- π FIRE Input β Age, monthly income, expenses, net worth, and expected return rate (4%, 6%, 8%)
- π― Retirement Age Calculation β Monthly compound simulation up to 50 years; shows feasibility or barrier insights
- π Asset Growth Visualization β Year-by-year asset curve with target line (in-app SVG, no charting library)
- π Scenario Comparison β Current vs. savings rate +10%p side-by-side; time saved breakdown
- π Result Sharing β Copy summary text to clipboard or share via native Toss app
- πΎ Persistent Input β Auto-save last calculation to localStorage for quick re-runs
- π¬ Reward Ad Gating β Results unlock after watching optional ad; fallback UI ensures non-blocking UX
Tech Stack
- Framework: React 18 + Vite 6
- Routing: React Router 7
- Design System: Toss Design System (
@toss/tds-mobile) + TDS Colors - Platform SDK: App-in-Toss (
@apps-in-toss/web-framework) - Styling: Emotion (React CSS-in-JS)
- Icons: Lucide React
- Language: TypeScript 5
- Testing: Vitest (unit), Playwright (visual)
- Build: Vite (CSR/SSG, no SSR)
Getting Started
Install Dependencies
npm install
Verify TypeScript
npx tsc --noEmit
Run Tests
npx vitest run # Unit tests
npm run test:visual # Visual regression tests (Playwright)
Production Build
npx vite build
Creates a static bundle in dist/ ready for deployment to Toss CDN.
Toss Deployment
npx ait build # Bundle for Toss platform
npx ait deploy --api-key <YOUR_API_KEY> # Deploy via Toss developer console
(Requires registration in μ±μΈν μ€ μ½μ and valid API key.)
Environment Variables
| Variable | Description | Required |
|---|---|---|
VITE_TOSS_AD_GROUP_ID |
Toss reward/banner ad group ID from μ±μΈν μ€ μ½μ | No* |
*If omitted, ads simply don't render; app functionality is unaffected.
Project Structure
src/
βββ pages/
β βββ Home.tsx # FIRE input form (age, income, expenses, net worth, rate chip)
β βββ Result.tsx # Results: retirement age, asset chart, scenario comparison, sharing
βββ components/
β βββ ScreenScaffold.tsx # Page SafeArea + header/footer layout
β βββ SummaryHero.tsx # Hero card: headline number (retirement age)
β βββ Card.tsx # Generic card wrapper (results, charts)
β βββ Amount.tsx # Formatted currency display (nowrap, tabular)
β βββ MiniBar.tsx # Progress bar (0..1 ratio)
β βββ AssetChart.tsx # Inline SVG: asset growth curve + goal line
β βββ ScenarioCompare.tsx # Side-by-side scenario cards + difference text
β βββ RewardGate.tsx # Ad gate: blocks results until ad watched/timeout
β βββ BottomCTA.tsx # Sticky footer buttons (SubmitFooter, ButtonStack)
β βββ StateView.tsx # Empty / Loading states
β βββ FloatingTabBar.tsx # Bottom tab navigation
β βββ AdSlot.tsx # Banner ad wrapper
β βββ TossRewardAd.tsx # Reward ad gate wrapper
βββ lib/
β βββ types.ts # FireInput, ScenarioResult, RouteState, CompareMode
β βββ fire.ts # Core FIRE math: simulation, target asset, scenario
β βββ validation.ts # Input validation (range, format, business rules)
β βββ analytics.ts # Screen/click/impression logging (Toss SDK only)
β βββ storage.ts # localStorage helpers with error handling
β βββ share.ts # Share and clipboard APIs
β βββ review.ts # App Store/Play Store review prompt
β βββ utils.ts # formatCurrency, formatNumber
β βββ contract.ts # Data validation contracts
βββ __tests__/
β βββ __helpers__/ # Shared test mocks and utilities
β βββ packet-*.test.ts # Component/function tests
βββ App.tsx # React Router setup (routes: /, /result)
βββ main.tsx # React 18 root (TDSMobileAITProvider, BrowserRouter)
Deployment
Prerequisites
- Registered in μ±μΈν μ€ μ½μ with matching app ID
- Valid developer API key
apps-in-toss.config.tsconfigured with correctappName(case-sensitive; deploy fails if mismatch)
Workflow
- Local build:
npm run buildβ createsdist/ - Toss bundle:
npx ait buildβ prepares for platform - Deploy:
npx ait deploy --api-key <KEY>β uploads to Toss CDN - Review: Toss review team checks for compliance (19+, zero console errors, zero CORS errors, no outlinks, TDS components only)
- Release: Appears in Toss app after approval
Build Output Constraints
- Static CSR only (no SSR, no dynamic routes)
- Android 7+, iOS 16+ compatible Web APIs
- Bundle must be under 100MB
- No external fonts (Toss Products Sans auto-applied by platform)
- No hardcoded HEX colors (use
var(--tds-color-*)CSS variables for dark mode support)
License
MIT
Built with Claude Code Β· Mini-app for the Toss platform
