Configuration
Configure your application for Node.js deployment inresolid.config.ts:
resolid.config.ts
Configuration Options
Set to
"node" for Node.js deploymentNode.js runtime version (18, 20, 22, or 24)
Additional files to include in the server bundle (e.g., templates, static assets)
Server Setup
Create your server entry file usingcreateHonoNodeServer:
src/server.ts
Server Options
Port number for the server to listen on
Enable request logging (automatically disabled in production)
Function to configure the Hono server instance with custom middleware
Function returning context object available in React Router loaders and actions
Cleanup function called when the server shuts down
Callback function invoked when the server starts listening
Build Process
Build the application
Run the build command to create a production bundle:This command:
- Compiles client assets to
build/client - Bundles server code to
build/server - Generates
package.jsonwith production dependencies - Optimizes and minifies code for production
Environment Variables
Configure your application using environment variables:Application environment mode
Port for the server to listen on
Base path for the server (e.g.,
/api)Static File Serving
The Node.js server automatically serves static files:- Production: Assets from
build/clientwith cache headers- Assets directory (
/assets/*): Cached for 1 year (immutable) - Other static files: Cached for 1 hour
- Assets directory (
- Development: Assets from
publicdirectory
Process Management
For production deployments, use a process manager like PM2:/etc/systemd/system/my-app.service
Docker Deployment
ExampleDockerfile for containerized deployment:
Dockerfile
Client IP Detection
Get client IP addresses withnodeClientIpGetter:
src/server.ts
Request Origin
Get request origin information:src/server.ts
Health Checks
Add health check endpoints for load balancers:src/server.ts