A beautiful, feature-rich scientific calculator with exact form detection, persistent history, and comprehensive reference tables.
Calculator Pro combines the reliability of a hardware calculator with the elegance of a modern web app. Whether you need quick arithmetic or advanced trigonometric computations โ it delivers instant, accurate results with a gorgeous dark-themed interface.
| Feature | Description |
|---|---|
| ๐ฏ Exact Form Detection | sin(30ยฐ) โ 1/2, โ(8) โ 2โ2/1 โ returns symbolic results, not just decimals |
| โจ๏ธ Full Keyboard Support | Type expressions directly โ digits, operators, functions, Enter, Escape all mapped |
| ๐ 17 Scientific Functions | sin, cos, tan (and inverses), log, ln, xยฒ, xยณ, โx, โx, x!, eหฃ, 10หฃ, 1/x, |x| |
| ๐พ Persistent History | SQLite-powered storage via Prisma โ calculations survive reloads and restarts |
| ๐ 5 Reference Tables | Trig values, logarithms, constants, powers, and conversions โ all at your fingertips |
| ๐ Glassmorphism UI | Dark theme with backdrop blur, ambient glow orbs, noise texture, and smooth animations |
| ๐ฑ Fully Responsive | Optimized for desktop and mobile โ sheets adapt to screen size |
| ๐ข Live Expression Preview | See your expression build in real time as you type |
| Mode | Description |
|---|---|
| Basic | Clean 4-function layout with AC/CE toggle, ยฑ, %, and full keyboard support |
| Scientific | Extended layout with 20 scientific buttons, DEG/RAD toggle, and parenthesized expressions |
| History | Scrollable panel with search, copy-to-clipboard, mode badges (BAS/SCI), and relative timestamps |
| Reference Tables | Five tabbed sheets with trig values (exact forms highlighted), logarithms, constants, powers, and unit conversions |
| # | Feature | Details |
|---|---|---|
| 1 | Basic & Scientific Modes | Seamless animated tab switching between streamlined and full layouts |
| 2 | Live Expression Preview | Real-time rendering of your expression as you build it |
| 3 | Exact Form Detection | Custom reverse-mapping engine: decimals โ fractions, radicals, trig values, constants. Supports 1/2, โ2/2, โ3, (โ6โโ2)/4, and more |
| 4 | Full Keyboard Support | All keys mapped: 0-9, +-*/.=%(), Enter/=, Backspace, Delete, Escape |
| 5 | Smart AC / CE Toggle | AC resets everything; after first input becomes CE to clear current entry only |
| 6 | DEG / RAD Toggle | Instant angle unit switch โ all trig functions and exact form detection respect the selected mode |
| 7 | Parentheses | Auto-nested with visual depth tracking via an animated counter badge |
| 8 | Copy to Clipboard | One-click copy with animated Check/Copy feedback (both display and history) |
| 9 | Mathematical Constants | Quick-insert ฯ and e with proper symbolic display |
| 10 | 17 Scientific Functions | sin, cos, tan, sinโปยน, cosโปยน, tanโปยน, log, ln, xยฒ, xยณ, โx, โx, x!, eหฃ, 10หฃ, 1/x, |x| |
| 11 | Gamma Function | Lanczos approximation for non-integer factorials (up to 170!) |
| 12 | Implicit Multiplication | 2(3) โ 2ร(3), )( โ )ร(, )2 โ )ร2 |
| 13 | Error Handling | Graceful shake animation on errors โ division by zero, invalid operations, overflow |
Five tabbed reference sheets accessible via the Tables button:
| Tab | Contents |
|---|---|
| ๐ Trig | Common sin, cos, tan values for 14 angles (0ยฐโ360ยฐ) with exact forms highlighted in amber |
| ๐ Log | logโโ, ln, logโ, nยฒ, and โn for 17 common values |
| ฯ Const | 12 mathematical constants (ฯ, e, โ2, ฯ, etc.) with copy-to-clipboard values |
| โฌ Powers | nยฒ, nยณ, โn, โn, and n! for n = 1 to 20 |
| ๐ Conv | Degrees โ radians, temperature (ยฐC / ยฐF / K), and common fractions with percentages |
Every calculation is saved to a local SQLite database via Prisma ORM:
- ๐ Scrollable history panel with expression, result, exact form badges, and mode indicator
- ๐ Search through past calculations (appears when >3 entries)
- ๐ One-click copy of any history entry
โ ๏ธ Double-confirm clear button to prevent accidental deletion- ๐พ Up to 50 most recent calculations stored and persisted across sessions
- Dark theme with emerald and amber accent palette
- Glassmorphism cards with backdrop blur, inner highlights, and layered shadows
- Framer Motion animations throughout: mode transitions, button presses, sheet slides, result reveals
- Ambient glow orbs with gentle floating animations
- Dot grid + noise texture background for visual depth
- Keyboard shortcut badges in the footer for quick reference
- Animated text shimmer on the BrutalTools branding
- Custom SVG logo with lightning bolt, gradient glow, and corner sparkle
- Fully responsive โ optimized for desktop and mobile viewports
| Key | Action |
|---|---|
0 โ 9 |
Enter digit |
. |
Decimal point |
+ - * / |
Add, Subtract, Multiply, Divide |
Enter or = |
Evaluate expression |
Escape |
Clear all (AC) |
Delete |
Clear entry (CE) |
Backspace |
Delete last character |
( ) |
Open / close parentheses |
% |
Percent |
| Category | Technology | Purpose |
|---|---|---|
| Framework | Next.js 16 (App Router) | React framework with server components and file-based routing |
| UI Library | React 19 | Latest React with concurrent features |
| Language | TypeScript 5 | Static type checking across the entire codebase |
| Runtime | Bun | Fast JavaScript runtime and package manager |
| Styling | Tailwind CSS 4 | Utility-first CSS with JIT engine |
| Components | shadcn/ui (New York) | 50 accessible Radix UI primitives (Sheet, Tabs, ScrollArea, Dialogโฆ) |
| State | Zustand 5 | Lightweight global state management for calculator logic |
| Database | Prisma 6 + SQLite | Typed database access with zero-config local storage |
| Animation | Framer Motion 12 | Declarative spring and gesture animations |
| Icons | Lucide React | Consistent, tree-shakeable icon set |
| Fonts | Geist Sans + Mono | Modern typeface designed by Vercel |
calculator/
โโโ src/
โ โโโ app/
โ โ โโโ layout.tsx # Root layout (theme, fonts, providers)
โ โ โโโ page.tsx # Home page โ renders CalculatorApp
โ โ โโโ globals.css # Tailwind directives, OKLCH theme, custom utilities
โ โ โโโ api/
โ โ โโโ route.ts # Health check: GET โ {"message":"Hello, world!"}
โ โ โโโ calculations/
โ โ โโโ route.ts # GET / POST / DELETE calculation history API
โ โ
โ โโโ components/
โ โ โโโ calculator/
โ โ โ โโโ calculator-app.tsx # Main app shell (header, footer, layout, keyboard events)
โ โ โ โโโ calculator-display.tsx # Expression preview + result readout + copy button
โ โ โ โโโ calculator-keyboard.tsx # BasicCalculator + ScientificCalculator + Btn/SciBtn
โ โ โ โโโ history-panel.tsx # Scrollable calculation history with search
โ โ โ โโโ reference-tables.tsx # 5 reference table panels (Trig, Log, Const, Powers, Conv)
โ โ โโโ ui/ # 50 shadcn/ui primitives (new-york style)
โ โ
โ โโโ stores/
โ โ โโโ calculator-store.ts # Zustand store โ expression evaluator, history, mode, angle unit
โ โ
โ โโโ hooks/
โ โ โโโ use-mobile.ts # Mobile breakpoint detection (768px)
โ โ โโโ use-toast.ts # Toast notification system
โ โ
โ โโโ lib/
โ โโโ db.ts # Prisma client singleton
โ โโโ exact-values.ts # Exact form lookup engine (trig, fractions, radicals, constants)
โ โโโ utils.ts # cn() helper and shared utilities
โ
โโโ prisma/
โ โโโ schema.prisma # Calculation model definition (SQLite)
โ
โโโ public/ # Static assets (logos, robots.txt)
โโโ package.json
โโโ tsconfig.json
โโโ next.config.ts
โโโ README.md
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Browser (Client) โ
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Components โ โ Zustand โ โ
โ โ (React 19) โโโโโ Store โ โ
โ โ + Framer โ โ (285 lines) โ โ
โ โ Motion โ โ โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโผโโโโโโโโ โ
โ โ shadcn/ui โ โ Next.js API โ โ
โ โ (50 comps) โ โ Routes โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโผโโโโโโโโโ
โ Prisma ORM โ
โ + SQLite โ
โ (Calculation) โ
โโโโโโโโโโโโโโโโโโโ
Data Flow:
- User interacts with calculator buttons or keyboard โ Zustand store updates state
- On
calculate(), the store evaluates the expression using the built-in math engine - The result is displayed and simultaneously POSTed to
/api/calculations - On page load, history is fetched from
GET /api/calculations - Prisma ORM manages all database operations with full type safety
| Requirement | Minimum Version |
|---|---|
| Node.js | >= 18 |
| Bun | latest stable |
# 1. Clone the repository
git clone https://github.com/brutal-45/Calculator.git
cd Calculator
# 2. Install dependencies
bun install
# 3. Generate the Prisma client and create the SQLite database
bunx prisma generate
bunx prisma db pushbun run devThe app will be available at
http://localhost:3000
bun run build
bun startContributions are welcome! To keep the codebase consistent, please follow these guidelines:
- Fork the repository and create a feature branch:
git checkout -b feat/your-feature
- Write clean, typed TypeScript. Run lint before committing:
bun run lint
- Test your changes locally:
bun run dev
- Commit using Conventional Commits format:
feat: add natural-log reference tab fix: correct parentheses count in scientific mode docs: update README with new keyboard shortcuts - Open a pull request against
mainwith a clear description of the change.
If you find a bug or have a feature request, please open an issue and include:
- A clear title and description
- Steps to reproduce (for bugs)
- Expected vs. actual behavior
- Screenshots if applicable
This project is released under the MIT License.
MIT License
Copyright (c) 2024 BrutalTools
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Developed under BrutalTools
Made with โค๏ธ ยท โก Powered by Next.js, React, and Tailwind CSS