Deploy a Hono App
Hono is a lightweight, ultrafast web framework built for any JavaScript runtime, including Node.js, Bun, Deno, and Cloudflare Workers.
This guide covers how to deploy a Hono app on Railway in three ways:
Note: You can also choose from a variety of Hono app templates created by the community.
Deploy from a GitHub repo
To deploy a Hono app on Railway directly from GitHub, follow the steps below:
- Create a Hono app that uses the Node.js adapter (
@hono/node-server).- If you already have a GitHub repo you want to deploy, you can skip this step.
- Make sure your app reads the port from
process.env.PORTwith a fallback (e.g.,3000).
- Create a New Project.
- Click Deploy from GitHub repo.
- Select your Hono GitHub repo.
- Railway requires a valid GitHub account to be linked. If your Railway account isn't associated with one, you will be prompted to link it.
- Click Deploy Now.
Once the deployment is successful, a Railway service will be created for you. By default, this service will not be publicly accessible.
To set up a publicly accessible URL for the service, navigate to the Networking section in the Settings tab of your new service and click on Generate Domain.
Note: Railpack will detect your Node.js app and build it automatically. If you need more control over the build, you can also use Nixpacks or a Dockerfile.
Deploy from the CLI
- Install and authenticate with the CLI.
- Navigate to your Hono app directory.
- You can skip this step if you already have an app directory or repo on your machine that you want to deploy.
- Run
railway initwithin the app directory to create a new project. - Run
railway upto deploy.- The CLI will now scan, compress and upload your Hono app files to Railway's backend for deployment.
Use a Dockerfile
-
Navigate to your Hono app directory.
- You can skip this step if you already have an app directory or repo on your machine that you want to deploy.
-
Create a
Dockerfilein the app's root directory. -
Add the content below to the
Dockerfile: -
Either deploy via the CLI or from GitHub.
Railway automatically detects the Dockerfile, and uses it to build and deploy the app.
Note: Railway supports also deployment from public and private Docker images.
Next steps
Explore these resources to learn more about Railway: