Boolean Synth is a high-performance, interactive tool for designing, simplifying, and visualizing Boolean logic circuits. It bridges the gap between algebraic expressions and physical logic gate diagrams with real-time bidirectional synchronization.
- Real-time Synthesis: Instantly convert complex Boolean expressions into clean, auto-layout logic diagrams.
- Bidirectional Sync: Modify the algebraic expression to update the graph, or manipulate the graph to update the expression.
- Advanced Parsing: Supports implicit multiplication (
ab), common operators (+,',^), and functions likeNAND(a,b). - Expression Simplification: One-click simplification of Boolean expressions using algebraic reduction.
- Interactive Circuit Board: Powered by React Flow, offering a smooth, zoomable, and draggable interface for exploring logic structures.
- Modern Aesthetics: A premium glassmorphism UI built with Tailwind CSS 4 and Framer Motion, optimized for dark mode.
- Framework: React 19
- Build Tool: Vite
- Diagram Engine: React Flow
- Styling: Tailwind CSS 4
- Animations: Framer Motion
- Icons: Lucide React
- Language: TypeScript
- Package Manager: pnpm
Ensure you have Node.js installed and pnpm configured.
-
Clone the repository:
git clone https://github.com/your-username/boolean-synth.git cd boolean-synth -
Install dependencies:
pnpm install
-
Start the development server:
pnpm dev
| Operation | Syntax | Example |
|---|---|---|
| AND | ab or a*b |
abc |
| OR | a+b |
a+b+c |
| NOT | a' |
(a+b)' |
| XOR | a^b |
a^b |
| NAND | NAND(a,b) |
NAND(a, b) |
- Standard:
(a+b)c' - Complex:
(ab)(a'b+ab')+(ab)'(a'b+ab')' - Implicit:
abc + def'
The core logic is divided into:
parser.ts: Tokenizes and parses strings into an Abstract Syntax Tree (AST).simplifier.ts: Applies Boolean algebra rules to reduce expression complexity.layout.ts: Computes node positions and edge connections for the logic gates.generator.ts: Reconstructs algebraic expressions from the graph state.
| Command | Description |
|---|---|
pnpm test |
Watch mode — re-runs on file changes |
pnpm test:run |
One-shot run — exits with code 0/1 |
pnpm test:coverage |
One-shot run + coverage report |
pnpm test:ui |
Open the Vitest browser UI |
Tests live colocated with the source they cover (e.g. src/logic/parser.test.ts, src/components/TruthTable.test.tsx).
The workflow at .github/workflows/test.yml automatically runs tests on every push and pull request that touches:
src/**ortests/**package.jsonorpnpm-lock.yamlvite.config.tsor anytsconfig*.json
The job is named "Run Tests" — this is the status check name you'll reference in branch protection.
What it does:
- Checks out the code
- Sets up Node 20 + pnpm 10 with a warm store cache
- Runs
pnpm install --frozen-lockfile - Runs the full test suite (
pnpm test:run) - Generates a coverage report (
pnpm test:coverage)
A failing test fails the entire workflow and blocks merges.
To enforce that CI passes before any merge into main:
- Go to Settings → Branches in your GitHub repo
- Click Add branch protection rule for
main - Enable "Require status checks to pass before merging"
- Search for and select:
Run Tests - Enable "Require branches to be up to date before merging"
- Save
Once set, GitHub will block any PR merge if the Run Tests job fails.
A Husky pre-push hook runs pnpm test:run locally before every git push. If tests fail, the push is aborted automatically — no broken code reaches the remote.
The hook is installed automatically when you run pnpm install (via the prepare script).
Note for CI environments: Husky skips itself when
CI=trueis set, so it won't interfere with GitHub Actions.
This project is inspired by my first Computer Science class in college and is currently serving as a test of the capabilities of the Google Antigravity editor.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for logic enthusiasts.