Note: This is an alternative development setup using PM2 process management. The default recommended workflow is to use the integrated development server with pnpm dev, but PM2 offers additional features like automatic incognito window launching and process orchestration.
# Start integrated development server (recommended)
pnpm dev
# In a different terminal, run the sync engine
pnpm dev:sync
# Start Python runtime (get command from notebook UI)
NOTEBOOK_ID=your-notebook-id pnpm dev:runtimeThis setup uses PM2 to manage your development processes and automatically watch for changes in the schema.
Install pm2 globally. Although it's possible to use pm2 without installing, it's much more annoying. Running commands like pm2 logs or pm2 delete all are common workflows. If you don't want to use the global, you can do pnpm exec pm2 <whatever>.
pnpm add -g pm2
# or with npm
npm install -g pm2# Start all processes
pnpm dev:pm2
# Or manually start with PM2
pm2 start ecosystem.config.json
# Use different port if needed
ANODE_DEV_SERVER_PORT=5174 pnpm dev:pm2# View status of all processes
pm2 status
# View logs
pm2 logs
# View logs for specific process
pm2 logs web
pm2 logs sync
pm2 logs nb
pm2 logs watcher
# Restart all processes
pm2 restart all
# Stop all processes
pm2 stop all
# Delete all processes
pm2 delete alliframe-outputs: Runspnpm run dev:iframe(for displaying outputs in an iframe)web: Runspnpm run dev(Vite development server with integrated Cloudflare Workers on port 5173)sync: Runspnpm run dev:sync(Cloudflare Worker backend on port 8787)watcher: Monitors the schema file and triggers updates
The web process runs an integrated server that includes:
- Frontend assets (React app)
- Backend API (Cloudflare Workers runtime)
- WebSocket sync (
/livestore) - Artifact storage endpoints
No separate sync server is needed thanks to the Cloudflare Vite plugin integration.
When using PM2, you can optionally run a separate sync server:
web: Frontend only (Vite dev server on port 5173)sync: Backend API (Cloudflare Worker on port 8787)
This separation can be useful for debugging backend issues or when you need to run the backend independently.
By default, the integrated server runs on port 5173. To use a different port:
ANODE_DEV_SERVER_PORT=5174 pnpm dev:pm2- Simplified workflow: Single command to start everything
- Hot reload stability: Environment file changes are ignored to prevent crashes
- Better error handling: Unified error reporting and recovery
- Faster startup: No PM2 overhead or process coordination
- Automatic browser launching: Opens incognito windows for testing
- Schema development: Automatic restarts when schema changes
- Process isolation: Better debugging with separate process logs
- Development orchestration: Running multiple notebooks simultaneously
- Process management: Easy restart, stop, and monitoring of services
If the file watcher isn't working:
- Check if the file path exists:
ls -la ../runt/packages/schema/mod.ts - Check PM2 logs:
pm2 logs watcher - Restart the file watcher:
pm2 restart watcher
To test the file watcher manually, you can touch the watched file:
touch ../runt/packages/schema/mod.tsThis should trigger the update process and restart the development servers.
- Start development:
pnpm dev:pm2 - Make changes to
../runt/packages/schema/mod.ts - Auto-restart: The watcher automatically updates dependencies and restarts services
- Browser: Automatically refreshes with new changes
Fix: pm2 restart all
Not sure why this happens, but restarting
If you see this in the LiveStore devtools...
Something went wrong - this should never happen:
[@livestore/react:useQuery] Error running query: LiveStore.SqliteError
Close the incognito tabs and run:
pm2 stop all && pm2 delete all && pnpm dev:pm2When you have the watcher from PM2 running, and update the schema, you won't see types reflected in VSCode. For example, updating a table column name in the schema in the runt repo, you won't see VSCode show a type error for the wrong column name. Open the VSCode command palette and run "TypeScript: Restart TS Server".
Make sure you only have an incognito window (or Chrome profile) with no other anode tabs. Once you close all tabs, do a hard refresh of the notebook (press Ctrl+Shift+R or Cmd+Shift+R in your browser).
Clicking the "+ Notebook" button the browser won't work well in development. You won't get a new notebook backend and running it manually means you won't get any benefits from PM2 orchestration. To create a new notebook, it's often easier to do this:
pm2 restart all- Stop PM2 processes:
pm2 stop all && pm2 delete all - Start integrated server:
pnpm dev - Start runtime manually: Get command from notebook UI, then run
NOTEBOOK_ID=your-id pnpm dev:runtime
- Stop integrated server:
Ctrl+Cin the terminal - Start PM2:
pnpm dev:pm2 - Runtime starts automatically: PM2 handles runtime startup and browser launching
Both approaches provide the same core functionality with different management styles.