Skip to content

Latest commit

 

History

History
263 lines (226 loc) · 14.1 KB

File metadata and controls

263 lines (226 loc) · 14.1 KB

NextCalc Pro - Roadmap

Completed Features (verified in codebase)

Core Calculator (apps/web/app/[locale]/page.tsx)

  • Basic and scientific operations
  • Calculation history with Zustand persistence
  • Keyboard shortcuts
  • LaTeX rendering via KaTeX
  • Share button component
  • Dark mode toggle -- cookie-based server-side theme persistence, no flash of wrong theme

Math Engine (packages/math-engine/)

  • Expression parser with tokenizer and AST (src/parser/)
  • Symbolic differentiation and integration (src/symbolic/)
  • Matrix operations and linear algebra (src/matrix/)
  • Equation solver -- algebraic and ODE (src/solver/)
  • Statistics functions (src/stats/)
  • Unit conversion engine (src/units/)
  • Complex number arithmetic (src/complex/)
  • Fourier analysis -- FFT, IFFT, spectral analysis, Fourier series (src/fourier/)
  • Graph theory -- MST, topological sort, SCC, coloring, max flow, TSP, cycle detection (src/graph-theory/)
  • Algorithm implementations -- ML, crypto, quantum, graph, optimization (src/algorithms/)
  • Calculus operations (src/calculus/)
  • CAS core (src/cas/)
  • Differential equations (src/differential/)
  • Knowledge base (src/knowledge/)
  • Problem generation (src/problems/)
  • Mathematical prover (src/prover/)
  • Educational content (src/content/)
  • WASM scaffolding with mock fallback (src/wasm/)

Visualization (packages/plot-engine/)

  • WebGL 2D renderer with adaptive sampling
  • Three.js 3D surface/parametric renderer (lazy-loaded)
  • HDR procedural cubemap with starfield (5 themes)
  • SSAO post-processing (GTAONode)
  • Interactive controls (pan, zoom, rotate)
  • Export (PNG, SVG, CSV)
  • 5 colormaps (viridis, inferno, coolwarm, cividis, magma, spectral)

Web App Pages (all in apps/web/app/[locale]/)

  • Calculator home page (/)
  • 2D/3D function plotter (/plot)
  • Symbolic math -- differentiation and integration (/symbolic)
  • Matrix operations (/matrix)
  • Equation solver -- algebraic (/solver)
  • ODE solver with GPU direction field (/solver/ode)
  • Unit converter (/units)
  • Statistics calculator (/stats)
  • Complex numbers (/complex)
  • Fourier analysis (/fourier)
  • PDE solver -- heat, wave, Laplace with WebGPU compute (/pde)
  • Game theory (/game-theory)
  • Chaos theory -- Lorenz attractor, bifurcation diagrams (/chaos)
  • Graph algorithms (/graphs-full)
  • Algorithm visualizations -- Transformer, ZKP, Quantum, PageRank, MAML (/algorithms)
  • ML algorithm demos (/ml-algorithms)
  • Worksheet (Jupyter-like) (/worksheet)
  • Forum (basic) (/forum)
  • Learning platform (/learn)
  • Practice problems (/practice)
  • Problem browser with number theory (/problems)
  • Settings page (/settings)
  • Sign-in page (/auth/signin)

Backend Infrastructure

  • GraphQL API with Apollo Server 5.4 + jose 6.1 JWT verification (apps/api/)
  • Prisma 7 shared database package (packages/database/)
  • NextAuth v5 with Google + GitHub OAuth
  • Upstash Redis integration (caching + rate limiting)
  • Apollo Client integration in web app
  • DataLoaders for N+1 query prevention
  • Full resolver set (user, worksheet, folder, calculation, forum, comment, upvote)
  • Cursor pagination (Relay-style connections)
  • Custom error classes (AuthenticationError, ForbiddenError, NotFoundError, ValidationError)
  • IDOR protection on profile and worksheet resolvers
  • Zod input validation on all mutations
  • Atomic view counters (forum posts, worksheets)
  • Configurable rate limiting (RATE_LIMIT_AUTH / RATE_LIMIT_ANON env vars)

Cloudflare Workers (apps/workers/)

  • CAS Service -- symbolic math on the edge (Hono + mathjs)
  • Export Service -- LaTeX to PDF/PNG/SVG (Hono + MathJax)
  • Rate Limiter -- sliding window via Cloudflare KV

WebGPU Features

  • GPU compute PDE solver (heat/wave/Laplace FTCS stencils, ping-pong buffers)
  • GPU direction field for ODE solver (compute + instanced arrows)
  • GPU sieve compute for number theory (compute shader, instanced cells)
  • Lorenz GPU particle field following attractor trajectory
  • Bifurcation diagram with cubic, Gauss, circle maps
  • Procedural space cubemap themes (5 variants)

Infrastructure

  • CI/CD pipeline (GitHub Actions) -- multi-job CI + worker deploy workflow
  • Structured JSON logging across API and web app
  • Apollo Server request/error logging plugin
  • Next.js instrumentation hooks (register + onRequestError)
  • Sentry stub configs (activate with DSN + @sentry/nextjs)
  • Content Security Policy (CSP) headers -- Nosecone with nonces, HSTS, permissions policy
  • Rate limiter wired to GraphQL SSE stream endpoint
  • next-intl configured with 1274 translation keys across 40+ pages (en, ru, es, uk, de, fr, ja, zh)
  • Vercel Analytics + Speed Insights
  • Dependabot for dependency vulnerability scanning
  • Bookmarks store (Zustand + localStorage persistence)
  • Comprehensive security audit with IDOR, JWT, and XSS fixes (March 2026)
  • Performance audit: BigInt math, iterative DFS, lazy loading, stack overflow prevention

Recently Completed

Math Engine Completeness (all done)

  • General variable exponent differentiation (f^g) -- logarithmic differentiation
  • Unary minus parser fix
  • Partial fraction decomposition -- real/complex pole handling
  • Series expansion for limits -- ratio/root/comparison tests
  • Bernoulli numbers for exact Taylor coefficients
  • LaTeX AST serialization
  • Logic formula parser (AND, OR, NOT, IMPLIES)
  • CAS pattern matching with recursive simplifyChildren
  • Proof search (BFS, DFS, iterative deepening)

v1.1.3 -- Codebase Audit (March 2026)

  • Comprehensive codebase audit -- performance (DataLoaders, lazy KaTeX, typed arrays), security (timing-safe comparison, CORS hardening, query complexity), and code quality (50+ type fixes, exactOptionalPropertyTypes compliance)

Feature Integration (all done)

  • Calculation sharing backend -- short code generation + /share/[code] pages
  • Export to PDF/LaTeX -- export menu wired to export-service Worker
  • Thousands separator formatting -- Zustand store + Intl.NumberFormat
  • Sentry observability -- client/server configs, instrumentation, global error handler
  • CAS solver rewrite -- polynomial root finding with Durand-Kerner method
  • AI-generated translations for ru, es, uk, de, fr, ja, zh (1200+ keys each)
  • User profile dashboard -- edit dialog, stats grid, activity feed, quick actions
  • Variable sliders (Desmos-style) -- interactive parameter sliders on plots
  • Formula library -- 70+ formulas across 7 categories, search/filter, KaTeX rendering
  • Calculation templates -- 20 interactive templates across 5 categories
  • Learning bookmarks -- topic cards with bookmark toggle

Remaining Work

Phase 1: Data Persistence & Grading (all done)

  • Worksheet DB persistence -- save/load/delete server actions with autosave + version conflict detection
  • Problem submission & grading -- test case validation, hint deduction, attempt recording, topic progress
  • Practice metrics persistence -- session tracking, per-attempt saving, completion finalization

Phase 2: Visualization & UX Polish

  • Graph annotations -- text labels + arrow annotations with placement toolbar
  • Polar plot drag-to-pan -- center offset added to Plot2DPolarConfig
  • Tree/graph visualization renderers -- SVG-based binary tree + circular graph layouts
  • Step-by-step solutions expansion -- SymbolicPanel with Show Steps toggle, category badges, collapsible cards
  • KaTeX rendering -- MathRenderer component with MathML accessibility, display/inline modes
  • My Worksheets listing page -- grid/list view with search, sort, and delete

Phase 3: Testing & Quality

  • Playwright E2E tests -- 27 spec files covering calculator, navigation, plots, accessibility, forum, solver, stats, units, matrix, symbolic, mobile, settings
  • Expand math-engine tests for untested modules -- 296 new tests across 5 modules

Phase 4: Deployment

  • Set up Neon production database -- schema pushed to ep-cool-dew-aex6zq7t (US East 2)
  • Configure production environment variables on Vercel -- DATABASE_URL, OAuth, Redis, AUTH_SECRET, NEXTAUTH_URL
  • Deploy web app to Vercel -- live at https://nextcalc.io
  • Create Cloudflare R2 buckets -- 4 buckets (public/private + dev) in ENAM region
  • Register workers.dev subdomain (albert-r-badalov.workers.dev)
  • Set ADMIN_KEY secret via wrangler secret put ADMIN_KEY
  • Deploy 3 Cloudflare Workers to production -- cas.nextcalc.io, ratelimit.nextcalc.io, export.nextcalc.io
  • Configure custom domain + SSL -- nextcalc.io (Vercel), worker subdomains (Cloudflare)
  • Configure Google + GitHub OAuth for production (redirect URIs on nextcalc.io)

Technical Debt (All Resolved)

All technical debt items have been addressed as of v1.0.0:

  • Export SVG: Dual rendering (foreignObject for browsers, Unicode text for rasterization)
  • Canvas 2D fallback: Canvas2DRenderer added; factory selects WebGPU > WebGL2 > Canvas2D
  • Test mocks: Updated to React 19 ref-as-prop pattern
  • API type safety: as any replaced with typed assertions (4 biome-ignore for adapter type mismatch)
  • PubSub: Hybrid Upstash Redis Streams + in-memory; graceful degradation

Security & Performance Audit (March 2026)

  • JWT WebSocket auth: replaced base64 decode with jose.jwtVerify() signature verification
  • IDOR fixes: worksheet queries enforce ownership, unshareWorksheet validates worksheetId
  • Profile resolver: fixed authorIduserId field reference
  • Forum post views: atomic update({ data: { views: { increment: 1 } } }) replaces read-then-write
  • Worksheet views: existence check before increment
  • Worker error responses: internal err.message no longer leaked to clients
  • Rate limiter: unlimited tiers skip KV entirely (no unbounded arrays)
  • Math engine: modPow/lucasLehmer rewritten with BigInt (overflow-safe for all inputs)
  • RSA: randomBigIntBelow() helper replaces unsafe Number(bigint) conversion
  • Limits: fixed copy-paste bug (v1v2), infinite recursion guard via _skipAlgebraic
  • Graph theory: tarjanSCC converted to iterative DFS (no stack overflow on large graphs)
  • Graph theory: topologicalSortKahn uses index pointer instead of Array.shift() (O(V+E) vs O(V²))
  • Web: Lorenz3DRenderer lazy-loaded with next/dynamic + ssr: false
  • Web: Math.min/max(...largeArray) replaced with .reduce() (no stack overflow)
  • Web: dangerouslySetInnerHTML removed for plain-text problem statements
  • Web: PDE toggleAnimation stale closure fixed with functional state update
  • Bifurcation renderer: stale gpuParams closure fixed
  • isFinite()/isNaN()Number.isFinite()/Number.isNaN() across 12 files
  • Node.js builtins: node: import protocol added to 4 files
  • Prisma schema: removed redundant @@index([shortCode]) (already @unique)
  • Database: FavoriteType enum exported from @nextcalc/database
  • Turbo: Sentry env vars added to build cache keys, test depends on ^build

v1.2.1 -- Performance, CI/CD Pipeline Fixes & Comprehensive Audit (March 2026)

  • Dynamic-import SymbolicPanel (~300KB deferred) via next/dynamic + ssr: false
  • Replace Framer Motion orb/entry animations with CSS @keyframes on /symbolic
  • IntersectionObserver-gated requestAnimationFrame loop on TransformerVisualizer
  • Replace Framer Motion pulsing overlays with CSS @keyframes on /algorithms/transformers
  • Remove staggered entry delay from 64 heatmap cells (eliminates 64 animation timers)
  • Cache KaTeX dynamic import at module level in MathRenderer
  • Fix 54 test failures across all packages (API, web, export-service, rate-limiter)
  • Fix Biome formatting across 170+ files
  • Upgrade CI actions: actions/checkout@v4@v6, actions/setup-node@v4@v6
  • Add AUTH_SECRET env var to CI build step (NextAuth build-time requirement)
  • Add @graphql-codegen/cli and @graphql-typed-document-node/core devDependencies for typecheck
  • Update deploy-workers workflow: v6 actions, pnpm-lock.yaml trigger, workflow_dispatch
  • New DataLoaders: hasUpvoted, commentCountByPostId — eliminates N+1 queries
  • Redis invalidateByPrefix cache method using SCAN
  • Path traversal guard in getTopicPath, GraphQL redirect sanitization
  • 78 audit issues fixed across entire monorepo (25 HIGH, 47 MEDIUM, 6 LOW)

v1.2.0 -- Auth, Forum, Level System & Icons (March 2026)

  • Fix signIn redirect from /dashboard (404) to /
  • Fix signOut to use CSRF token (NextAuth v5 requirement)
  • Add onError fallback to navbar avatar (broken image → initials/level icon)
  • Sync OAuth provider name/image on every sign-in
  • Add commentCount field to GraphQL ForumPost type + resolver
  • Fix forum post listing and detail pages showing 0 comments
  • Remove hardcoded fake top contributors, show empty state
  • Extract HeroAvatar component with onError image fallback
  • RS3-style XP formula: sum(floor(i + 300 * 2^(i/7)) / 4) — exponential curve, 100 levels
  • 10 named tiers (Novice → Transcendent) + admin-only Architect (L101)
  • OKLCH color progression per level, XP formatting helpers
  • Programmatic crystal SVG component (LevelIcon) with 10 visual tiers
  • Pre-generated 103 SVG files via Node.js script (generate-level-icons.ts)
  • Static SVG loader component (LevelIconStatic)
  • 3 L101 special variants: Prismatic Crown, Cosmic Nexus, Phoenix Crystal
  • Level icon as default avatar in navigation and profile
  • XP bar with tier name display in profile HeroCard

Future Ideas

  • WASM arbitrary precision (Emscripten build for native performance)
  • Collaborative worksheets (real-time multiplayer via WebSocket)
  • Plugin system for custom math modules
  • Mobile app (React Native or PWA enhancements)
  • AI-powered step-by-step explanations
  • LaTeX document editor with live preview
  • API key system for third-party integrations