About

Overview

GeniusCalc is a simple, efficient, and lightweight calculator that performs all calculations entirely in the web browser. I built this because there's a surprising lack of good calculators on the web that offer simple calculations with history and variables - most are either bloated with unnecessary features or have poor user experience requiring button-pushing instead of natural math expression input.

The mathematical expression parser and evaluator was written from scratch - no external math libraries or dependencies are used. All calculations are performed entirely in the browser, with no data sent to servers. Your calculation history and variables are stored locally in your browser's local storage for privacy and offline functionality.

Try it out:

Key Features

  • Advanced expression parsing - Handles complex mathematical expressions with proper operator precedence using a custom Pratt parser
  • Variable management - Define and persist variables across sessions with automatic type inference
  • Built-in functions - Built-in mathematical functions including trigonometric, logarithmic, and conversion utilities
  • Built-in constants - Built-in mathematical and scientific constants
  • Calculation history - Track all calculations with timestamps and formatted expressions
  • Error handling - Comprehensive error reporting with helpful messages for debugging expressions

Technical Details

This project showcases modern web development practices with a focus on type safety, performance, and maintainable code architecture.

Frontend Architecture

  • React - Latest React with concurrent features and improved performance
  • TypeScript - Full type safety throughout the codebase with strict configuration
  • Vanilla Extract - CSS-in-JS with compile-time CSS generation for optimal performance
  • Polished - A lightweight toolset for writing styles in JavaScript
  • Vite - Lightning-fast build tool with hot module replacement

Mathematical Engine

The heart of GeniusCalc is its custom mathematical expression parser and evaluator that runs in the browser:

  • Pratt Parser - Handles operator precedence and associativity correctly
  • AST-based Evaluation - Parses expressions into abstract syntax trees for efficient evaluation
  • Function System - Extensible function library with categories for arithmetic, trigonometric, logarithmic, and conversion functions
  • Variable Scope - Proper variable scoping with persistent storage

Development Tools

  • Biome - Fast linter and formatter replacing ESLint and Prettier
  • pnpm - Efficient package manager with workspace support
  • Vitest - Fast unit testing framework
  • Monorepo Structure - Organized with TypeScript project references

Deployment

Deployed on Cloudflare Pages with automated deployment scripts. The build process creates optimized static assets that are served globally with minimal latency.

Development Journey

This project evolved through multiple iterations. An earlier prototype was built withBolt.new to explore design and functionality. Once the overall design was finalized a new version was built from scratch.

The code for this application was mostly written inCursor. While I did leverage the Agent features of Cursor, the prompts were carefully prompted and scoped to a minimal set of files. BothAnthropic ClaudeandChatGPT were also used to accelerate the development via research and questions.

Author

Built by Phil Gates-Idem.

Connect:

  • LinkedIn- Feel free to reach out with questions or feedback
  • GitHub- Check out other projects and experiments

Questions, feedback, or just want to chat about the technical implementation? I'd love to hear from you on LinkedIn!

© 2025 Phil Gates-Idem. All rights reserved.