# Fiscal Clone 3.0 (Turbopack Rebuild) Ground-up rebuild into a single Next.js 16 application that runs with Turbopack and internal API routes. ## What changed - Removed hard runtime dependency on the external backend for core app workflows. - Added internal `app/api/*` services for watchlist, portfolio, filings, tasks, and health. - Added durable local data store at runtime (`frontend/data/store.json`). - Added async task engine with retry support for: - `sync_filings` - `refresh_prices` - `analyze_filing` - `portfolio_insights` - Added OpenClaw integration through OpenAI-compatible `/v1/chat/completions`. - Enforced Turbopack for both development and production builds. ## Architecture - `frontend/`: full app (UI + API + task engine) - `frontend/app/api/*`: route handlers - `frontend/lib/server/*`: storage, task processors, SEC/pricing adapters, OpenClaw client - `frontend/data/store.json`: generated local runtime state (git-ignored) The legacy `backend/` folder is retained in-repo but no longer required for the rebuilt local workflow. ## Run ```bash cd frontend npm install npm run dev ``` Open: [http://localhost:3000](http://localhost:3000) ## Build (Turbopack) ```bash cd frontend npm run build npm run start ``` ## OpenClaw setup Set in environment (for example `frontend/.env.local`): ```env OPENCLAW_BASE_URL=http://localhost:4000 OPENCLAW_API_KEY=your_key OPENCLAW_MODEL=zeroclaw SEC_USER_AGENT=Fiscal Clone ``` If OpenClaw is not configured, the app falls back to local analysis responses so task flows remain testable. ## API surface - `GET /api/health` - `GET /api/me` - `GET|POST /api/watchlist` - `DELETE /api/watchlist/:id` - `GET|POST /api/portfolio/holdings` - `PATCH|DELETE /api/portfolio/holdings/:id` - `GET /api/portfolio/summary` - `POST /api/portfolio/refresh-prices` - `POST /api/portfolio/insights/generate` - `GET /api/portfolio/insights/latest` - `GET /api/filings` - `POST /api/filings/sync` - `POST /api/filings/:accessionNumber/analyze` - `GET /api/tasks` - `GET /api/tasks/:taskId`