@infodb/revx
v1.1.0
Published
Multi-Vite project development server - Host multiple Vite apps on a single port with unified routing
Maintainers
Readme
@infodb/revx
re-Vite eXrouter - Host multiple Vite projects on a single port with unified routing.
Perfect for monorepo development - run all your Vite apps, backend APIs, and other dev servers together with native HMR support.
Why revx?
Development in a monorepo with multiple Vite projects is painful:
- Each Vite app runs on a different port (3000, 3001, 3002...)
- Cross-app navigation requires hardcoded ports
- Cookie/session sharing is complicated
- CORS issues everywhere
revx solves this by using Vite's middleware mode to host everything on one port with path-based routing:
http://localhost:3000/app1 → Vite Project 1 (native HMR)
http://localhost:3000/app2 → Vite Project 2 (native HMR)
http://localhost:3000/api → Your Backend API
http://localhost:3000/legacy → webpack dev server (via proxy)Features
- 🎯 Primary: Multi-Vite hosting - Native Vite integration with full HMR support
- 🔌 Reverse proxy - Integrate webpack, Parcel, or any other dev server
- 📁 Static file serving - Serve built assets or documentation
- 🎨 YAML configuration - Simple, declarative routing
- ⚡ Automatic route sorting - Routes prioritized by specificity
- 🌐 CORS & environment variables - Full control over cross-origin and config
Installation
Option 1: Install as dev dependency (Recommended)
npm install -D @infodb/revx
# or
pnpm add -D @infodb/revxThen add to package.json scripts:
{
"scripts": {
"dev": "revx start",
"dev:verbose": "revx start --verbose"
}
}Option 2: Use with npx/pnpx (No installation)
npx @infodb/revx start
# or
pnpx @infodb/revx startGood for trying out revx, but slower on repeated runs.
Option 3: Global installation
npm install -g @infodb/revx
# or
pnpm add -g @infodb/revxQuick Start
- Install revx in your monorepo:
pnpm add -D @infodb/revx- Create a configuration file:
pnpm revx initThis creates a revx.yaml file with Vite multi-project configuration.
- Edit
revx.yamlto point to your Vite projects:
server:
port: 3000
maxSockets: 512 # Important for Vite performance
routes:
# Your Vite apps
- path: "/app1"
vite:
root: "./apps/app1"
base: "/app1"
- path: "/app2"
vite:
root: "./apps/app2"
base: "/app2"
# Backend API
- path: "/api/*"
target: "http://localhost:4000"
pathRewrite:
"^/api": ""- Start the unified dev server:
pnpm revx start
# or add to package.json scripts and run: pnpm devNow all your apps are available at http://localhost:3000 with full HMR! 🎉
Commands
revx start [config-file]
Start the reverse proxy server.
# Use default config file (revx.yaml)
revx start
# Use custom config file
revx start my-proxy.yaml
# Verbose output
revx start --verboserevx validate <config-file>
Validate configuration file.
revx validate revx.yaml
# Show detailed validation info
revx validate revx.yaml --verboserevx init
Create a sample configuration file.
# Create default configuration
revx init
# Create simple configuration
revx init --simple
# Specify output file
revx init --output my-config.yamlDocumentation
- Configuration Reference - Detailed configuration options and performance tuning
- Examples - Real-world configuration examples for various use cases
- Troubleshooting - Common issues and solutions
Development
# Clone the repository
git clone https://github.com/tamuto/infodb-cli
cd infodb-cli/revx
# Install dependencies
pnpm install
# Build
pnpm build
# Development mode
pnpm devLicense
MIT
Author
tamuto [email protected]
