An intelligent, AI-powered calculator that recognizes handwritten mathematical expressions and solves them in real-time. Draw equations on the canvas, and let AI handle the computation!
- Freehand Drawing: Draw mathematical expressions naturally with mouse or touch
- Touch Support: Fully responsive with native touch device support
- Custom Brush Sizes: Adjustable brush size (1-30px) for precise writing
- Color Selection: Multiple color swatches for different expressions
- Eraser Tool: Clean eraser functionality with adjustable size
- Custom Cursor: Dynamic cursor that follows your drawing color
- Grid Background: Professional grid canvas for better alignment
- Handwriting Recognition: Powered by Google Gemini AI for accurate expression recognition
- Multi-Expression Support: Solve multiple equations in one drawing
- Variable Assignment: Support for variable declarations and assignments
- Real-Time Results: Instant calculation with animated LaTeX rendering
- Context-Aware: Remembers previously assigned variables
- LaTeX Rendering: Beautiful mathematical notation using MathJax
- Draggable Results: Move and position calculation results anywhere on canvas
- Expression History: Multiple results displayed with automatic positioning
- Complex Calculations: Handles arithmetic, algebra, calculus, and more
- Responsive Design: Optimized for desktop, tablet, and mobile devices
- Loading States: Smooth loading animations during calculations
- Error Handling: User-friendly error messages with toast notifications
- Hide/Show Controls: Collapsible toolbar to maximize canvas space
- Reset Functionality: Clear canvas and start fresh with one click
- React 18 with TypeScript
- Vite - Lightning-fast build tool
- Tailwind CSS v4 - Utility-first CSS framework
- shadcn/ui - High-quality UI components
- Mantine - Color swatches and UI utilities
- MathJax - LaTeX math rendering
- Axios - HTTP client
- Node.js with Express
- Google Gemini AI - Handwriting recognition and calculation
- CORS - Secure cross-origin requests
- dotenv - Environment variable management
- Node.js (v18 or higher)
- npm or yarn
- Google Gemini API key
git clone https://github.com/yourusername/skbr.ai.git
cd skbr.ai- Navigate to the backend directory:
cd backend- Install dependencies:
npm install- Create a
.envfile:
PORT=4000
GEMINI_API_KEY=your_gemini_api_key_here- Start the backend server:
npm startThe backend will run on http://localhost:4000
- Navigate to the calculator directory:
cd calculator- Install dependencies:
npm install- Create a
.envfile:
VITE_API_URL=http://localhost:4000- Start the development server:
npm run devThe frontend will run on http://localhost:5173
skbr.ai/
โโโ backend/ # Express backend
โ โโโ config/ # Configuration files
โ โ โโโ cors.js # CORS settings
โ โ โโโ gemini.config.js # Gemini AI setup
โ โโโ controllers/ # Request handlers
โ โ โโโ calculate.controller.js
โ โโโ routes/ # API routes
โ โ โโโ calculate.route.js
โ โโโ services/ # Business logic
โ โ โโโ calculate.prompt.js
โ โ โโโ gemini.service.js
โ โโโ utils/ # Helper functions
โ โ โโโ cleanUp.js
โ โ โโโ prompt.js
โ โโโ index.js # Entry point
โ
โโโ calculator/ # React frontend
โโโ public/ # Static assets
โโโ src/
โ โโโ components/ # React components
โ โ โโโ ui/ # shadcn/ui components
โ โ โโโ Cursor.tsx
โ โ โโโ DraggableLatex.tsx
โ โ โโโ Loader.tsx
โ โ โโโ Toast.tsx
โ โโโ pages/ # Page components
โ โ โโโ home/
โ โ โโโ index.tsx
โ โโโ lib/ # Utilities
โ โโโ App.tsx
โ โโโ main.tsx
โ โโโ index.css
โโโ constants.ts # App constants
โโโ vite.config.ts # Vite configuration
- Draw: Click and drag (or touch and draw) on the canvas to write mathematical expressions
- Select Color: Choose from the color palette to differentiate expressions
- Adjust Brush: Use the slider to change brush size for better precision
- Erase: Click the eraser icon to remove mistakes
- Calculate: Click the "Calculate" button to process your drawing
- View Results: Results appear as draggable LaTeX expressions
- Reset: Clear everything and start fresh with the "Reset" button
Processes handwritten mathematical expressions from canvas image.
Request Body:
{
"image": "data:image/png;base64,...",
"variables": {
"x": "5",
"y": "10"
}
}Response:
[
{
"expr": "2 + 2",
"result": "4",
"assign": false
}
]Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m 'Add some amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Gemini AI for powerful handwriting recognition
- shadcn/ui for beautiful components
- Tailwind CSS for styling
- MathJax for LaTeX rendering
For questions or suggestions, feel free to open an issue or reach out!
Frontend: https://skrb-ai.vercel.app/
Made with โค๏ธ