This guide explains how to deploy Zapp to production on your domain zapp.devchauhan.in using Vercel for the frontend and Hugging Face Spaces for the WebSocket signaling server.
Both parts of the application are hosted on free tiers optimized for their specific runtime:
┌──────────────────────┐
│ zapp.devchauhan.in │
└──────────┬───────────┘
│ (Served by Vercel)
▼
┌─────────────────┐
│ Vite Frontend │
└─────────────────┘
│
P2P Handshake (wss://devchauhann-zapp.hf.space)
│
▼
┌───────────────────────────┐
│ Hugging Face Docker Space │
└─────────────┬─────────────┘
│ (Persistent WebSockets + Health Checks)
▼
┌────────────────────┐
│ Signaling Server │
└────────────────────┘
Since the frontend is a static React Single Page Application (SPA), Vercel is the ideal option:
- Connect GitHub Repo: Import your repository to Vercel.
- Set Root Directory: Choose the
frontenddirectory as the root. - Configure Build Settings:
- Framework Preset:
Vite - Build Command:
npm run build - Output Directory:
dist
- Framework Preset:
- Custom Domain:
- Add
zapp.devchauhan.inin Vercel project settings. - Point your domain's CNAME/A records to Vercel via your DNS provider (e.g. Cloudflare).
- Add
Hugging Face Spaces supports running custom Docker applications persistently:
- Create Docker Space:
- Create a new Space on Hugging Face (e.g.
devchauhann/zapp). - Select Docker as the SDK.
- Create a new Space on Hugging Face (e.g.
- Repository Sync:
- Clone the Space repository:
git clone https://huggingface.co/spaces/devchauhann/zapp
- Place the following files inside the Space directory:
server.js(refactored Node.js WebSocket code wrapped in an HTTP server)package.json(definingwsdependency and Node engine)Dockerfile(installs dependencies, exposes port7860, and runs the server)
- Clone the Space repository:
- Health Probes:
- Hugging Face requires the container to bind to port
7860(injected viaPORT). - The server must respond to standard HTTP GET requests (on
/healthor/) with a200 OKstatus, which keeping the Space in the "Running" state.
- Hugging Face requires the container to bind to port
- WSS Endpoint:
- Once pushed, the Space starts building. The secure WebSocket connection is exposed directly at:
wss://devchauhann-zapp.hf.space - The client hook
useWebRTC.tsis configured to automatically connect to this Space address when running in production.
- Once pushed, the Space starts building. The secure WebSocket connection is exposed directly at: