A stealthy browser automation tool built with Playwright and anti-detection plugins, featuring a modern React dashboard for managing tasks, schedules, and settings.
- Stealth Mode: Persistent Chromium browser context with
playwright-extraandpuppeteer-extra-plugin-stealthto evade bot detection - Session Persistence: Automatic cookie and session storage in
user_data/directory - Geolocation Control: Configurable browser geolocation via Web UI
- Record & Replay: Use Playwright Codegen to record tasks, then replay them headlessly
- Public/Private Tasks: Store shared tasks in
tasks/public/or private tasks intasks/private/(git-ignored) - Failure Tracking: Automatic detection of element not found, navigation failures, and timeouts with deduplication
- Cron Jobs: Schedule recurring tasks with preset or custom cron expressions
- One-Time Tasks: Execute tasks at a specific date/time (auto-removed after execution)
- Calendar View: Visualize all scheduled tasks with
react-big-calendar - Sleep Prevention: macOS
caffeinateintegration prevents system sleep during scheduled tasks
- Real-Time Logs: Live execution log streaming via Socket.io
- Focused Pages: Sidebar navigation between Overview, Tasks (run + schedule), Failures, Data, Logs, and Settings
- Calm Dark Theme: A single warm, quiet dark theme with no decorative animation
- Warnings Panel: Track task failures with color-coded error types and occurrence counts
- Info Gathering: Dashboard for viewing data collected by info-gathering tasks
| Layer | Technologies |
|---|---|
| Backend | Node.js, TypeScript, Express, Socket.io, tsx (runtime TS) |
| Frontend | React 19, Vite, TypeScript, Tailwind CSS, shadcn/ui, Radix UI |
| Automation | Playwright, playwright-extra, puppeteer-extra-plugin-stealth |
| Scheduling | node-cron, cron-parser |
| State | React Query, localStorage (dashboard layout) |
- Node.js v18+ (v20+ recommended)
- npm or compatible package manager
- macOS or Linux (Windows may work but is untested)
git clone https://github.com/vinicius741/ghost-runner.git
cd ghost-runner
npm installTo maintain persistent sessions (e.g., staying logged into Google):
npm run setup-loginA browser window opens. Log in to your desired services, then browse briefly to ensure session data is saved to user_data/.
Verify the session:
npm run verify-loginnpm run uiThis starts:
- Backend server on
http://localhost:3333 - Frontend dev server on
http://localhost:5173(with API proxy)
Open http://localhost:3333 in your browser.
- Click Record New Task in the dashboard
- Enter a task name and select public/private
- Perform your browser actions in the Codegen window
- Copy the generated code to the created task file
- Run the task from the dashboard
| Command | Description |
|---|---|
npm run ui |
Start dev environment (backend + frontend with hot reload) |
npm run ui:prod |
Build frontend and start production server |
npm run build:server |
Compile backend/core TypeScript to dist/ |
npm run build:electron |
Compile Electron main/preload to dist-electron/ |
cd frontend && npm run dev |
Start frontend dev server only |
cd frontend && npm run build |
Build frontend for production |
| Command | Description |
|---|---|
npm run electron:dev |
Build frontend/server/electron and launch desktop app |
npm run electron:start |
Launch desktop app from existing build artifacts |
npm run electron:dist |
Build a macOS distributable in release/ |
pnpm release |
Publish the next desktop release through GitHub Actions |
Desktop builds can download and install updates from GitHub Releases. See Desktop updates for the release workflow and signing setup.
When running as a desktop app, mutable runtime data is stored in the Electron app data directory (~/Library/Application Support/<App>/ghost-runner) instead of the git repository. On first launch, the app copies tasks/public and tasks/private (if present) into that runtime directory.
The app automatically handles ASAR archives for packaged builds. Since ASAR archives are read-only and cannot be used as a working directory for spawned processes, the TaskRunner detects ASAR paths and uses the parent directory for child process execution. This ensures tasks, scheduler, and setup-login processes spawn correctly in both development and packaged environments.
If you want the desktop shell to connect to an already-running Ghost Runner server instead of starting the embedded backend, set one of these environment variables before launch:
GHOST_RUNNER_SERVER_URL=http://127.0.0.1:3333GHOST_RUNNER_API_URL=http://127.0.0.1:3333(legacy fallback name)
| Command | Description |
|---|---|
npm run bot -- --task=name |
Run a specific task via CLI |
npm run record -- --name=mytask --type=private |
Launch Playwright Codegen recorder |
npm run schedule |
Run scheduler headless |
npm run setup-login |
Launch browser for manual login setup |
npm run verify-login |
Verify session persistence |
| Command | Description |
|---|---|
npm test |
Run backend tests |
cd frontend && npm run test |
Run frontend unit tests (Vitest) |
cd frontend && npm run test:ui |
Run frontend tests with UI |
cd frontend && npm run test:coverage |
Run tests with coverage |
ghost-runner/
├── src/ # Backend source
│ ├── core/ # Task runner, scheduler, recorder
│ │ ├── index.ts # CLI entry point
│ │ ├── scheduler.ts # Cron scheduler
│ │ ├── record-new-task.ts # Codegen launcher
│ │ ├── errors.ts # Structured error types
│ │ ├── pageWrapper.ts # Monitored Playwright Page
│ │ └── taskReporter.ts # Status reporting
│ ├── server/ # Express + Socket.io server
│ │ ├── index.ts # Server entry point
│ │ ├── controllers/ # API controllers
│ │ ├── routes/ # Route definitions
│ │ ├── services/ # Business logic
│ │ └── repositories/ # Data persistence
│ ├── config/ # Browser configuration
│ └── utils/ # Utility functions
├── frontend/ # React frontend
│ └── src/
│ ├── components/ # React components
│ │ ├── dashboard/ # Dashboard widgets
│ │ └── ui/ # shadcn/ui primitives
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities
│ └── types.ts # TypeScript types
├── tasks/ # Automation scripts
│ ├── public/ # Shared tasks (tracked)
│ └── private/ # Private tasks (git-ignored)
├── user_data/ # Browser profile (DO NOT DELETE)
├── schedule.json # Scheduler configuration
├── settings.json # Global settings
├── failures.json # Task failure records
└── info-gathering.json # Cached info-gathering data
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health |
Health check |
| GET | /api/tasks |
List available tasks |
| POST | /api/tasks/run |
Execute a task |
| POST | /api/record |
Start task recording |
| GET/PUT | /api/schedule |
Read/write schedule |
| GET/PUT | /api/settings |
Read/write settings |
| GET/DELETE | /api/failures |
List/clear failures |
| POST | /api/failures/:id/dismiss |
Dismiss a failure |
| GET/DELETE | /api/info-gathering |
List/clear gathered data |
| Event | Direction | Description |
|---|---|---|
task-started |
Server → Client | Task execution began |
task-completed |
Server → Client | Task finished successfully |
task-failed |
Server → Client | Task execution failed |
log |
Server → Client | Log line from task/scheduler |
scheduler-status |
Server → Client | Scheduler running status |
failure-recorded |
Server → Client | New failure recorded |
info-data-updated |
Server → Client | Info-gathering data updated |
Tasks are JavaScript modules that export a run(page) function:
// tasks/public/my-task.js
export async function run(page) {
await page.goto('https://example.com');
await page.waitForSelector('#content');
// Your automation logic here
}- Architecture Review - Detailed architecture diagrams and component interactions
ISC