Skip to content
SaadRimehPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

JS Nexus Logo

⚑ JS Nexus

A professional, offline-first JavaScript IDE
Built with Electron Β· React Β· Monaco Editor Β· Ollama AI


Electron React Monaco Vite

TypeScript Ollama License Platform


πŸ“– Overview Β Β·Β  ✨ Features Β Β·Β  πŸ—οΈ Architecture Β Β·Β  πŸ› οΈ Installation Β Β·Β  πŸš€ Usage Β Β·Β  🧰 Tech Stack Β Β·Β  🀝 Contributing



πŸ“– Overview

JS Nexus is a professional desktop IDE engineered exclusively for JavaScript developers. It merges a VS Code–grade editor with a live variable inspector, an animated event loop visualizer, a built-in API client, full Git source control, an embedded terminal, and a 100% offline AI assistant β€” all without a single cloud dependency.

πŸ” Privacy-first by design. Every computation β€” code execution, AI inference, Git operations β€” runs locally. Nothing ever leaves your machine.


 JS Nexus = Monaco Editor + VM Sandbox + Memory Box + Event Loop + Git + AI (Ollama) + API Tester


✨ Features

πŸ–ŠοΈ Professional Code Editor

  • Monaco Editor β€” the exact engine powering VS Code
  • Multi-tab management with unsaved-change indicators (●)
  • Smart snippets: clog, fn, forof, arr, prom
  • Bracket pair colorization & live IntelliSense
  • Ctrl+Enter to run Β· Ctrl+S to save

⚑ Dual Execution Engine

Mode Description
Node.js Engine Full I/O, native modules, real filesystem
Sandbox VM node:vm isolated context, 5 s timeout

Each mode exposes a different API surface, giving you full power or safe isolation with a single dropdown switch.

🧠 Memory Box (Live Variable Inspector)

The crown jewel of JS Nexus β€” updates as you type:

  1. Static analysis β€” detects let/var/const instantly
  2. Debounced eval β€” silent sandbox run every 600 ms
  3. Final capture β€” post-run values with types & glow effects
  4. Color-coded primitives, arrays, and objects

πŸ”„ Event Loop Visualizer

Step-by-step animated walkthrough of JavaScript concurrency:

  • Call Stack β€” function frame push/pop
  • Microtask Queue β€” Promise resolution (high priority)
  • Macrotask Queue β€” setTimeout / setInterval

Watch your async code execute frame-by-frame.

πŸ€– AI Error Interceptor

Automatic AI-powered debugging on every runtime error:

  1. Captures error message, stack trace & source
  2. Sends to local Ollama model (offline, zero telemetry)
  3. Displays root cause + corrected code block
  4. One-click "Apply Fix" patches the editor instantly

πŸ”Œ Built-in API Tester

A full Postman-style HTTP client embedded in the IDE:

  • GET Β· POST Β· PUT Β· DELETE Β· PATCH
  • Custom headers + JSON body editor
  • Response viewer: status, latency, formatted body
  • Runs via Electron IPC β€” no Express, no extra port

🌿 Git Integration

Full source control panel without leaving the IDE:

  • Stage / unstage / commit changes
  • Inline diff viewer per file
  • Push, pull, branch checkout via simple-git

πŸ’» Interactive Terminal

  • Xterm.js embedded terminal in the workspace
  • Runs shell commands in your open project directory
  • Output coloring by JS type: string, number, boolean
  • Execution benchmarks: timing + heap memory usage


πŸ—οΈ Architecture

JS Nexus follows Electron's multi-process architecture with strict context isolation for maximum security and stability.

Process Diagram

graph TB
    subgraph MAIN["πŸ–₯️ Electron Main Process (Node.js)"]
        VM["πŸ”’ node:vm\nSandbox Engine"]
        FS["πŸ“ node:fs\nFile System"]
        OLLAMA["πŸ€– Ollama Client\nlocalhost:11434"]
        HTTP["🌐 HTTP Proxy\nAPI Tester Backend"]
        GIT["🌿 simple-git\nGit Operations"]
    end

    subgraph BRIDGE["πŸ” Preload (contextBridge)"]
        API["window.api\n(contextIsolation: true)"]
    end

    subgraph RENDERER["βš›οΈ React Renderer Process (Vite)"]
        EDITOR["πŸ–ŠοΈ Monaco Editor"]
        MEMBOX["🧠 Memory Box"]
        EVLOOP["πŸ”„ Event Loop\nVisualizer"]
        APITESTER["πŸ”Œ API Tester"]
        GITPANEL["🌿 Git Panel"]
        TERMINAL["πŸ’» Terminal\n(Xterm.js)"]
        AICHAT["πŸ€– AI Chat"]
        AIERR["⚑ AI Error\nWidget"]
    end

    VM & FS & OLLAMA & HTTP & GIT --> API
    API --> EDITOR & MEMBOX & EVLOOP & APITESTER & GITPANEL & TERMINAL & AICHAT & AIERR

    style MAIN fill:#1e293b,stroke:#3b82f6,color:#e2e8f0
    style BRIDGE fill:#312e81,stroke:#818cf8,color:#e2e8f0
    style RENDERER fill:#14532d,stroke:#4ade80,color:#e2e8f0
Loading

Security Model

graph LR
    A["Renderer\n(React UI)"] -->|"window.api\n(allow-listed calls)"| B["contextBridge\nPreload"]
    B -->|"IPC invoke"| C["Main Process\n(Node.js)"]
    C -->|restricted to\nopened folder| D["File System"]
    C --> E["node:vm\nSandbox"]
    C --> F["Ollama\nlocalhost"]

    style A fill:#1d4ed8,stroke:#60a5fa,color:#fff
    style B fill:#6d28d9,stroke:#a78bfa,color:#fff
    style C fill:#065f46,stroke:#34d399,color:#fff
    style D fill:#78350f,stroke:#fbbf24,color:#fff
    style E fill:#7f1d1d,stroke:#f87171,color:#fff
    style F fill:#831843,stroke:#f472b6,color:#fff
Loading
Security Property Value
nodeIntegration false
contextIsolation true
sandbox (preload) true
File access Restricted to user-opened folder
External links Allow-listed
File deletion OS trash (reversible)

VM Variable Capture

The Memory Box appends guarded capture expressions after user code to extract final values without exposing Node.js internals:

// ── Your code ─────────────────────────────────────────────────────
let score = 0;
score = 10;
score = score * 2;

const name = "JS Nexus";
var version = 1;

// ── Internally appended capture pass ──────────────────────────────
try { __capture__.score   = typeof score   === 'undefined' ? undefined : score;   } catch {}
try { __capture__.name    = typeof name    === 'undefined' ? undefined : name;    } catch {}
try { __capture__.version = typeof version === 'undefined' ? undefined : version; } catch {}

⚠️ node:vm is a convenience boundary, not a hostile-code sandbox. For adversarial input, pair it with an OS-level sandbox.



πŸ”„ Data Flow

sequenceDiagram
    participant User
    participant Editor as Monaco Editor
    participant MemBox as Memory Box
    participant IPC as IPC Bridge
    participant VM as node:vm Sandbox
    participant AI as Ollama AI

    User->>Editor: Type code
    Editor->>MemBox: Static analysis (instant)
    Editor-->>MemBox: Debounced eval after 600ms

    User->>Editor: Ctrl+Enter (Run)
    Editor->>IPC: executeJS(code, mode)
    IPC->>VM: Run in sandbox
    VM-->>IPC: { output, variables, error }
    IPC-->>Editor: Result
    Editor-->>MemBox: Final variable values

    alt Runtime Error
        VM-->>IPC: Error + stack trace
        IPC-->>AI: explainError(code, error)
        AI-->>Editor: Root cause + fix suggestion
        Editor-->>User: AI Error Widget (Apply Fix)
    end
Loading


πŸ› οΈ Installation

Prerequisites

Requirement Version Link
Node.js v20.19+ nodejs.org
Git Any git-scm.com
Ollama (optional) Latest ollama.com

Quick Start

# 1. Clone the repository
git clone https://github.com/SaadRimeh/Js-Nexus.git
cd Js-Nexus

# 2. Install all dependencies
npm install

# 3. Launch the IDE in development mode
npm run dev

The Electron window opens automatically with Vite hot-reload enabled.

AI Setup (Optional β€” Fully Offline)

# Install Ollama from https://ollama.com, then pull a coding model:
ollama pull codellama      # Recommended for code tasks
# or
ollama pull llama3         # General purpose
# or
ollama pull deepseek-coder # Specialized code model

πŸ’‘ JS Nexus can also auto-download models from within the IDE β€” no terminal needed after the initial Ollama install.

Build for Distribution

# Compile TypeScript + bundle React, then package the installer
npm run dist
# Output: dist/ directory with .exe (Windows) / .dmg (macOS) / .AppImage (Linux)


πŸš€ Usage

Keyboard Shortcuts

Shortcut Action
Ctrl + Enter Run current code
Ctrl + S Save current file
Ctrl + Z Undo last change
Ctrl + Shift + Z Redo
Ctrl + / Toggle line comment
F11 Toggle fullscreen

Memory Box Workflow

stateDiagram-v2
    [*] --> Typing: User opens editor
    Typing --> StaticAnalysis: Any keystroke
    StaticAnalysis --> VariableDetected: let / var / const found
    VariableDetected --> DebouncedEval: Wait 600ms (idle)
    DebouncedEval --> LiveValues: Silent sandbox run
    LiveValues --> Typing: User continues typing
    Typing --> RunCode: Ctrl+Enter
    RunCode --> FinalCapture: Sandbox executes
    FinalCapture --> [*]: Final values + output displayed
Loading

Try this example:

let score = 0;
score = 10;
score = score * 2;

for (let i = 0; i < 5; i++) {
  score = score + i;
}

const name = "JS Nexus";
var version = 1;

Watch the Memory Box panel on the right update live as you type, showing score β†’ 30, name β†’ "JS Nexus", version β†’ 1.

Execution Mode Switch

Use the dropdown in the editor toolbar to switch engines:

Engine Use Case
Node.js Engine File I/O, native modules, npm packages, shell interop
Sandbox VM Safe isolated execution, Memory Box live inspection


πŸ“ Project Structure

js-nexus/
β”œβ”€β”€ πŸ“ electron/
β”‚   β”œβ”€β”€ main.ts                   # Main process: VM engine, FS, Ollama, HTTP proxy, Git IPC
β”‚   β”œβ”€β”€ preload.ts                # contextBridge: exposes window.api to renderer
β”‚   └── electron-env.d.ts        # Electron type declarations
β”‚
β”œβ”€β”€ πŸ“ src/
β”‚   β”œβ”€β”€ πŸ“ main/                  # Electron entry types
β”‚   β”œβ”€β”€ πŸ“ preload/               # Preload type declarations
β”‚   └── πŸ“ renderer/
β”‚       β”œβ”€β”€ App.jsx               # Root layout, tabs, sidebar, state management
β”‚       β”œβ”€β”€ main.jsx              # React entry point
β”‚       └── πŸ“ components/
β”‚           β”œβ”€β”€ Editor.jsx        # Monaco Editor wrapper + snippets + shortcuts
β”‚           β”œβ”€β”€ MemoryBox.jsx     # Live variable inspector (static + runtime)
β”‚           β”œβ”€β”€ Terminal.jsx      # Xterm.js terminal + type-colored output
β”‚           β”œβ”€β”€ EventLoopVisualizer.jsx  # Animated call stack / queue viewer
β”‚           β”œβ”€β”€ FileExplorer.jsx  # File tree: create, rename, delete, open folder
β”‚           β”œβ”€β”€ GitPanel.jsx      # Stage, diff, commit, push, pull, branch
β”‚           β”œβ”€β”€ ApiTester.jsx     # HTTP client (GET/POST/PUT/DELETE/PATCH)
β”‚           β”œβ”€β”€ AiChat.jsx        # Ollama chat with code context injection
β”‚           β”œβ”€β”€ AIErrorWidget.jsx # Auto-triggered AI debugger + Apply Fix
β”‚           └── BrandLogo.jsx     # App logo component
β”‚
β”œβ”€β”€ πŸ“ public/
β”‚   └── πŸ“ branding/             # Logo assets (PNG 32px – 1024px, ICO, ICNS)
β”‚
β”œβ”€β”€ πŸ“ scripts/
β”‚   β”œβ”€β”€ generate-icons.cjs       # Icon generation utility
β”‚   └── smoke-electron.cjs       # Smoke test runner
β”‚
β”œβ”€β”€ πŸ“ docs/
β”‚   └── branding.md              # Brand guidelines
β”‚
β”œβ”€β”€ electron-builder.json5        # Installer / packaging configuration
β”œβ”€β”€ vite.config.ts                # Vite + Electron plugin configuration
β”œβ”€β”€ tsconfig.json                 # TypeScript project config
└── package.json                  # Scripts, deps, entry point


🧰 Tech Stack

graph LR
    subgraph Frontend["βš›οΈ Frontend"]
        R["React 18"]
        M["Monaco Editor 0.57"]
        X["Xterm.js 6"]
        V["Vite 8"]
    end

    subgraph Desktop["πŸ–₯️ Desktop Layer"]
        E["Electron 42"]
        EB["electron-builder 26"]
    end

    subgraph Backend["βš™οΈ Main Process"]
        SG["simple-git 3"]
        VM["node:vm"]
        FS["node:fs"]
    end

    subgraph AI["πŸ€– AI Layer"]
        OL["Ollama\n(local LLM)"]
    end

    Frontend --> Desktop
    Desktop --> Backend
    Backend --> AI

    style Frontend fill:#1e40af,stroke:#60a5fa,color:#fff
    style Desktop fill:#3730a3,stroke:#a78bfa,color:#fff
    style Backend fill:#065f46,stroke:#34d399,color:#fff
    style AI fill:#7c2d12,stroke:#fb923c,color:#fff
Loading
Technology Version Role
Electron 42 Desktop application framework
React 18 UI rendering & state management
Monaco Editor 0.57 VS Code editor engine
Xterm.js 6 Embedded terminal emulator
Vite 8 Bundler & hot-reload dev server
TypeScript 5 Type-safe development
simple-git 3 Git operations via IPC
node:vm Built-in Sandboxed JS execution context
Ollama Latest Offline local AI model runner
electron-builder 26 Cross-platform packaging & installer


🀝 Contributing

Contributions, issues, and feature requests are welcome! Here's how to get started:

gitGraph
   commit id: "Fork repo"
   branch feature/your-feature
   checkout feature/your-feature
   commit id: "Make changes"
   commit id: "Add tests"
   checkout main
   merge feature/your-feature id: "Pull Request"
Loading
  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'feat: add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request on GitHub

Commit Convention

Follow Conventional Commits:

Prefix Use for
feat: New features
fix: Bug fixes
docs: Documentation changes
refactor: Code restructuring
style: Formatting only
chore: Build / tooling changes


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

MIT License β€” free to use, modify, and distribute with attribution.


JS Nexus

Built with ❀️ by Saad Rimeh


GitHub Stars GitHub Forks GitHub Issues


⭐ If JS Nexus helped you β€” drop a star, it means a lot! ⭐

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages