Reflex DevTools is a powerful debugging toolkit for applications built with the @flexsurfer/reflex
library. It provides real-time inspection of your application's state, events, and traces through an intuitive web-based dashboard.
- π Database State Inspection - Visualize your entire application state in real-time
- π Real-time Event Tracing - Watch events and state changes as they happen
- π₯ Real-time Reactions and Render Tracing - Watch all reactions being created and run, and rendering processes
- β± Performance Profiling - Analyze events and reactions times and bottlenecks in real-time
- π¨ Beautiful Dashboard - Clean, modern UI with dark/light theme support
- π± React & React Native Support - Works seamlessly with both platforms
- β‘ Zero Configuration - Get started with just two lines of code
npm install --save-dev @flexsurfer/reflex-devtools
# or
yarn add -D @flexsurfer/reflex-devtools
# or
pnpm add -D @flexsurfer/reflex-devtools
Add these lines to your app's entry point (e.g., main.tsx
or App.tsx
):
import { enableTracing } from '@flexsurfer/reflex';
import { enableDevtools } from '@flexsurfer/reflex-devtools';
// Enable tracing for Reflex events
enableTracing();
// Connect to devtools server
enableDevtools({
serverUrl: 'localhost:4000' // Optional: defaults to localhost:4000
});
npx reflex-devtools
Or with custom configuration:
npx reflex-devtools --port 3000 --host 0.0.0.0
Navigate to http://localhost:4000 in your browser to see the DevTools dashboard.
// main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import { enableTracing } from '@flexsurfer/reflex';
import { enableDevtools } from '@flexsurfer/reflex-devtools';
import App from './App';
enableTracing();
enableDevtools();
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
enableDevtools({
serverUrl: 'localhost:3001',
enabled: process.env.NODE_ENV === 'development'
});
interface DevtoolsConfig {
serverUrl?: string; // Default: 'localhost:4000'
enabled?: boolean; // Default: true
}
npx reflex-devtools [options]
Options:
-p, --port <port> Port number (default: 4000)
-h, --host <host> Host address (default: localhost)
--help Show help message
Reflex DevTools consists of three main components:
βββββββββββββββββββ WebSocket/HTTP βββββββββββββββββββ
β Your App β ββββββββββββββββββββΆ β DevTools β
β β β Server β
β - Reflex SDK β β β
β - DevTools SDK β β - Express API β
β β β - WebSocket β
βββββββββββββββββββ βββββββββββββββββββ
β
β HTTP
βΌ
βββββββββββββββββββ
β Web Dashboard β
β β
β - React UI β
β - Real-time β
β Updates β
βββββββββββββββββββ
- Client SDK (
/client
) - Lightweight SDK that integrates with your app - DevTools Server (
/server
) - Express server with WebSocket support - Web Dashboard (
/ui
) - React-based debugging interface
We welcome contributions! Here's how to get started:
- Node.js 18+
- pnpm (recommended) or npm/yarn
# Clone the repository
git clone https://github.com/flexsurfer/reflex-devtools.git
cd reflex-devtools
# Install dependencies
pnpm install
# Start development servers
pnpm dev
This will start:
- DevTools server on
localhost:4000
- UI development server with hot reload on
localhost:5173
- Test app on
localhost:3000
packages/
βββ reflex-devtools/ # Main package (client SDK + server)
β βββ src/client/ # Client SDK for apps
β βββ src/server/ # DevTools server
β βββ src/cli.ts # CLI entry point
βββ reflex-devtool-ui/ # Web dashboard
β βββ src/ # React components
βββ reflex-test-app/ # Example app for testing
# Build all packages
pnpm build
# Run tests
pnpm test
# Start only the UI in development
pnpm dev:ui
# Start only the server
pnpm dev:server
# Start only the test app
pnpm dev:testapp
# Clean all builds
pnpm clean
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Test with the test app:
pnpm dev:testapp
- Commit using conventional commits:
git commit -m 'feat: add amazing feature'
- Push and create a Pull Request
- TypeScript for all code
- ESLint + Prettier for formatting
- Conventional Commits for commit messages
- Component-based architecture for UI
MIT License - see LICENSE file for details.
Built with β€οΈ for the Reflex community. Special thanks to all contributors and the open-source projects that make this possible.
Happy Debugging! πβ‘οΈβ¨
Made by @flexsurfer