Stop playing the localhost lottery. Automatically assigns memorable, stable domains to your Vite projects using Caddy as a reverse proxy.
This is a faithful reimplementation of mustafa0x/vite-plugin-domain, built for the Deno runtime using Deno's standard library.
Transform this chaos:
localhost:5173→frontend.localhostlocalhost:5174→admin.localhostlocalhost:5175→api.localhost
📚 For complete usage documentation, see USAGE.md
# Start Caddy
caddy run
# Install Caddy and trust its CA (one-time setup)
caddy trust
# Add to your project
deno install jsr:@fry69/vite-plugin-localcaddyNote
macOS users: If you encounter certificate trust issues, you may need to install the nss package: brew install nss
// vite.config.ts
import { defineConfig } from "vite";
import domain from "@fry69/vite-plugin-localcaddy";
export default defineConfig({
plugins: [domain()],
});# The development server runs with necessary permissions by default
deno task devThis conversion replaces Node.js-specific APIs with Deno equivalents while maintaining 100% functional compatibility with the original.
| Category | Node.js | Deno |
|---|---|---|
| File System | import fs from 'node:fs'fs.readFileSync() |
Deno.readTextFileSync() |
| Path Operations | import path from 'node:path'path.basename(), process.cwd() |
import { basename } from "@std/path"basename(Deno.cwd()) |
| Network | import net from 'node:net'net.createConnection() |
Deno.connect() |
| Process | process.exitCode = 1 |
Deno.exit(1) |
| Terminal Colors | import pc from 'picocolors' |
import { bold, cyan, dim } from "@std/fmt/colors" |
- All functionality from the Node.js version
- Automatic domain generation from folder or package.json
- HTTPS via Caddy's internal issuer
- Port conflict detection and resolution
- Multiple projects sharing one Caddy instance
- Full type safety and IDE support
For detailed conversion notes, see CONVERSION_SUMMARY.md.
deno test -ATests validate:
- Domain generation (folder and package.json sources)
- Route management and conflict detection
- Port checking and availability
- Array comparison utilities
- Plugin configuration and structure
- USAGE.md — Complete usage guide with examples, troubleshooting, and best practices
- CONVERSION_SUMMARY.md — Detailed technical documentation of the Node.js → Deno conversion
- vite.config.example.ts — Example Vite configuration file
- mustafa0x/vite-plugin-domain — Original Node.js implementation
- npm package — Published package
- Caddy Documentation — Reverse proxy and TLS setup
- Deno Standard Library — Standard library modules used
This package is a Deno conversion of vite-plugin-domain by mustafa0x. The original Node.js implementation provided the foundation for this fully-tested Deno port.
MIT (Same as the original)