Deploy your app
Learn how to deploy your NuxtFast application

Lorenzo
Author
Git and GitHub
Git is a version control system that allows you to track changes to your code. GitHub is a web-based hosting service for Git repositories.
You should already have your project on GitHub. If not, check this section of the guide.
Railway
Railway is a great platform for deploying all kinds of applications. It's like a modern version of Heroku.
Create a new project on Railway.
The build command is npm run build
The start command is node .output/server/index.mjs
Make sure to add all the necessary environment variables, like SUPABASE_URL and SUPABASE_API_KEY.
If the project is failing, check the logs. Most of the time is because of a missing environment variable.
Health Check
You can add a health check to the project to make sure it's running.
There is an health check endpoint at /api/health that returns a 200 status code.
Domain
When the project is building successfully, you can add a custom domain to see your app live.
Create a custom domain on Railway.
It will look like this:
https://your-project-name-production.up.railway.app
If it's asking you for a port, leave the default one of 8080 for a node project.
Go to that url and you should see your app live.
Great! Time to celebrate! 🎉
Getting a domain
Use domainr.com to find a good domain name. You can buy from any domain registrar.
I can recommend Cloudflare itself, but it does not have all the TLDs.
Once you find a domain, and you have bought it, you can add it to your Cloudflare project.
We will use Cloudflare to manage our DNS and proxy our app.
On the registrar we need to set the nameservers to Cloudflare ones. You can find them on the Cloudflare dashboard. It will look like this:
ns1.cloudflare.com
ns2.cloudflare.com
Once you have done that, Cloudflare will take over the DNS management and we will not need to do anything on the registrar side anymore.
On Railway, let's add a custom domain.
We need to add the domain to the project.
Adding a Root Domain With www Subdomain to Cloudflare
Source: Railway Docs
If you want to add your root domain (e.g., mydomain.com) and the www. subdomain to Cloudflare and redirect all www. traffic to the root domain:
- Create a Custom Domain in Railway for your root domain (e.g., mydomain.com). Copy the value field. This will be in the form: abc123.up.railway.app.
- Add a CNAME DNS record to Cloudflare:
- Name → @.
- Target → the value field from Railway.
- Proxy status → on, should display an orange cloud. Note: Due to domain flattening, Name will automatically update to your root domain (e.g., mydomain.com).
- Add another CNAME DNS record to Cloudflare:
- Name → www.
- Target → @
- Proxy status: → on, should display an orange cloud. Note: Cloudflare will automatically change the Target value to your root domain.
- Enable Full SSL/TLS encryption in Cloudflare:
- Go to your domain on Cloudflare.
- Navigate to SSL/TLS -> Overview.
- Select Full. Not Full (Strict) Strict mode will not work as intended.
- Enable Universal SSL in Cloudflare:
- Go to your domain on Cloudflare.
- Navigate to SSL/TLS -> Edge Certificates.
- Enable Universal SSL.
- After doing this, you should see Cloudflare proxy detected on your Custom Domain in Railway with a green cloud.
- Create a Bulk Redirect in Cloudflare:
- Go to your Cloudflare dashboard.
- Navigate to Bulk Redirects.
- Click Create Bulk Redirect List.
- Give it a name, e.g., www-redirect.
- Click Or, manually add URL redirects. Add a Source URL: https://www.mydomain.com. Add Target URL: https://mydomain.com with status 301. Tick all the parameter options: (Preserve query string, Include subdomains, Subpath matching, Preserve path suffix) Click Next, then Save and Deploy. Note: DNS changes may take some time to propagate.
Cloudflare
Cloudflare can be used to deploy your app or as a CDN, DNS provider, and proxy.
CDN means Content Delivery Network. Basically it means that every static asset in your data will be cached and served from Cloudflare instead of your Railway server.
This is great for performance and scalability. And also keeps the cost down. As Cloudflare is free.
You can use Cloudflare to manage your DNS as well.
And finally, you can use Cloudflare to proxy your app. This means that you can block traffic to your app from certain countries, or to certain IP addresses. And respond to DDOS attacks and other threats.
Deploying to Cloudflare
If you already deployed your app on Railway, no need to do anything. Skip to the next section.
Go to Workers and Pages.
Create a new project on Cloudflare.
The build command is npm run build