CodeMath: An Interactive Math Learning Platform

CodeMath: An Interactive Math Learning Platform ๐งฎ
Iโm excited to introduce my latest open-source project โ CodeMath, an interactive math learning platform built with modern web technologies.
The Inspiration
Mathematics is the foundation of computer science, but traditional learning methods often make it feel abstract and intimidating. I wanted to create something different โ a platform where mathematical concepts come alive through interaction and visualization.
CodeMath is inspired by the book โMathematics for Programmersโ (็จๅบๅ็ๆฐๅญฆ) by Hiroshi Yuki. The chapter topics and learning path follow the bookโs structure, while all code implementations, interactive components, and visualizations are original work.
Core Features
๐ฎ Interactive Chapters
Each chapter features hands-on interactive content that helps you understand concepts by doing:
- Chapter 1: The Story of Zero โ Base converter, bitwise visualization
- Chapter 2: Logic โ Logic gate playground, truth table generator
- Chapter 3: Remainders โ Day calculator, chess magic trick
- Chapter 4: Mathematical Induction โ Domino simulator
- Chapter 5: Permutations & Combinations โ Card lab, Venn diagrams
- Chapter 6: Recursion โ Tower of Hanoi, fractals
- Chapter 7: Exponential Explosion โ Paper folding, binary vs linear search
- Chapter 8: Unsolvable Problems โ Halting problem simulator
- Appendix: Machine Learning โ Perceptron training ground
๐ Smart Localization
- Bilingual support (Chinese/English)
- Auto-detects your preferred language
- Easy language switching
๐ Developer Experience
- One-command startup โ
./start.shhandles everything - Auto-install dependencies on first run
- Background server mode with PID management
- Comprehensive logging to
logs/startup.log - Smart registry โ Auto-switches to Taobao npm registry in China
Tech Stack
Frontend
- React 19 โ Latest features and performance
- TypeScript โ Type-safe development
- Vite โ Lightning-fast build tool
- Tailwind CSS โ Utility-first styling
- shadcn/ui โ Beautiful, accessible components
Animation & Visualization
- GSAP โ Professional-grade animations
- Three.js โ 3D rendering and effects
- KaTeX โ Fast, beautiful math typesetting
- Lenis โ Smooth scroll experience
Quick Start
Clone and Run
git clone https://github.com/hugcosmos/CodeMath.git
cd CodeMath
./start.sh
The script will:
- Ask if youโre in mainland China (auto-configure npm registry)
- Auto-install dependencies on first run
- Start the dev server in background
- Log all output to
logs/startup.log
Visit: http://localhost:5173/
Manual Setup
cd app
npm install
npm run dev # Start dev server
npm run build # Build for production
npm run preview # Preview production build
Live Demo
Try it online: https://codemath.pages.dev/
Project Structure
CodeMath/
โโโ app/ # Main application
โ โโโ src/
โ โ โโโ components/ # Reusable components
โ โ โโโ sections/ # Page sections
โ โ โโโ chapters/ # Chapter interactives
โ โ โโโ hooks/ # Custom hooks
โ โ โโโ lib/ # Utilities
โ โ โโโ i18n/ # i18n configuration
โ โโโ package.json
โ โโโ vite.config.ts
โโโ logs/ # Logs directory
โโโ start.sh # Start script โญ
โโโ stop.sh # Stop script โญ
โโโ README.md # Project README
โโโ tech-spec.md # Tech specification
FAQ
Q: What if port 5173 is occupied?
A: Run ./stop.sh to stop existing process, or manually change port in app/vite.config.ts.
Q: How to switch npm registry? A: Script auto-detects environment. Manual switch:
npm config set registry https://registry.npmmirror.com # Taobao
npm config set registry https://registry.npmjs.org # Official
Q: Dependency installation failed?
A: Delete app/node_modules and app/package-lock.json, then re-run ./start.sh.
Philosophy
๐ก Math shouldnโt be just formulas and theorems โ it should be tangible and explorable.
CodeMath embodies this philosophy by making abstract concepts visual, interactive, and fun.
License
MIT License โ Completely open-source. Contributions welcome!
Links
- GitHub: github.com/hugcosmos/CodeMath
- Live Demo: https://codemath.pages.dev/
Made with ๐ by Nicky & AI
๐ฌ Discuss on GitHub