DOCS LLMs

Quickstart (15 Minutes)

The main goal of RailsFast is getting you to put something online as fast as humanly possible.

I've worked really hard to make something that takes, literally, only 15 minutes to production.

While it won't be your finished product just yet, it will be something that at least is out there and people can visit. Something that proves your entire RailsFast workflow from development to production works fine. Something to build upon so you can start charging money as soon as possible.

IMPORTANT

This guide assumes you've already installed everything described in the Prerequisites section. Please make sure everything is installed and configured before continuing.

[TODO: Video of me doing all this tutorial actually in under 15 minutes]

Kick off your RailsFast project

Start by accessing the main RailsFast repository railsfast/railsfast-base, to which you should have gotten access upon purchasing, and clone it:

git clone --origin railsfast https://github.com/railsfast/railsfast-base.git myapp
TIP

Replace myapp in the command above with the name of your app.

Open the myapp folder that has been created in Cursor. This is your very own RailsFast project now!

Push your project to GitHub

Right now you already have a working codebase, so let's save it to GitHub.

Open up your GitHub account and create a PRIVATE, empty repository (no template, no README, no .gitignore, no license).

WARNING

Make sure the repository you create is private! RailsFast doesn't allow public repositories.

Point your local project’s origin to your new repo:

git remote add origin https://github.com/YOUR-USERNAME/myapp.git

And push the code:

git branch -M main
git push -u origin main

Run the project setup script

Now open up your project in Cursor and run this in the terminal:

bin/railsfast init

This will start the interactive RailsFast setup script.

First, it will ask you to name your project. Then, it'll generate secure encryption files, a sample encrypted credentials file template, the right deployment config, and essentially get your project ready for deployment.

At the end, if everything went right, you should see a success message telling you the project is now ready to deploy.

Deploy your project

We're now ready to deploy the RailsFast project to production! We only need a server to deploy to.

INFO

A server may also be called a VPS (Virtual Private Server).

Spin up a server (VPS)

Go to Hetzner and log in to your dashboard.

Create a project if you don't have one (a "project" in Hetzner is just a named folder under which resources like servers are grouped).

Then, inside the Hetzner project, click on the [ Create Resource ] button, and then click on the [ Servers ] button.

Select a server type and size

For a low-traffic app (an app that's just starting, or a hobby project) pretty much any size will do. You can even fit multiple RailsFast apps in the same server to save costs.

For now, let's choose a good cheap-yet-powerful server with 2vCPUs and 2GB RAM:

  • For type, choose: Regular Performance under Shared Resources (x86)
  • For size, choose: CPX11 or CPX22 (the actual model number depends on the location)

A server like this will be more than enough and only costs around $5/mo.

There are other cost-optimized options for about $3/mo you can experiment with, but their location availability may vary.

You can also choose a server a bit more expensive like CPX31 or CPX32 (4vCPUs and 8GB RAM) for ~$20/mo if you expect your app to have more traffic / load, if you expect to fit multiple apps in the same server, or if you'd just like to have some extra room to grow from the start.

Select a server location

Make sure to choose a location physically close to your customers (if your users are mainly in America, spin up the server in the US; if most of them are in Europe, choose one of the European locations, etc.)

Keep the rest of the config as default (Ubuntu OS image, public IPv4 and IPv6 addresses, etc.) Scroll down until the SSH section.

Create or choose a SSH key to access your server

To access your server and deploy code to it you'll need an SSH key. Create one if you don't have one:

ssh-keygen -t ed25519 -f ~/.ssh/my_hetzner_ssh_key
TIP

Replace my_hetzner_ssh_key with the name you want to give your SSH key.

Add your SSH key to your SSH agent so your terminal can actually connect to the server in the next steps:

ssh-add ~/.ssh/my_hetzner_ssh_key

Then display and copy your public key:

cat ~/.ssh/my_hetzner_ssh_key.pub

And paste the contents into the "Add an SSH key" box in Hetzner. Give it an identifiable name, like my_hetzner_ssh_key or whatever you named it in the previous step.

Add backups to your server

Now, optionally, you may want to add backups to your Hetzner server. It's just a checkbox: if you check it, Hetzner will make a daily copy of your server so you can easily recover things in case things go wrong. RailsFast already offers a different database backup mechanism, but it's always a good idea to have contingency plans in case, so if you're a bit paranoid like me just check it and Hetzner will have your back in case things go really wrong.

Run the initial server setup

To finish setting up our server, let's run the RailsFast setup script to harden the security of the server and install dependencies. It's all streamlined, you just need to paste this into the "Cloud Config" text box:

#cloud-config
runcmd:
  - bash -lc 'set -euo pipefail; wget -qO /root/railsfast-setup.sh https://setup.railsfast.com; chmod +x /root/railsfast-setup.sh; /root/railsfast-setup.sh 2>&1 | tee -a /var/log/railsfast-setup.log && reboot'

This will use Cloud-init to run the RailsFast server setup script upon creation, and get the server ready to deploy apps to.

NOTE

This Cloud-init snippet runs the server setup script you can find at setup.railsfast.com. If you prefer, you can do the initial setup manually to check the contents of the script. First, ssh into your server after it's created, then wget the setup script at setup.railsfast.com, inspect it, chmod +x it, and then execute it as root.

You can explore the remaining server configuration options or just leave them as-is.

Finish the process by giving a name to your server (like "railsfast-production" or something that helps you keep things organized), and then click the [ Create & Buy Now ] button. Your server will now start being created and initialized.

Wait for the server to initialize

We now need to wait for the server to boot up and the setup to complete (usually ~5 minutes)

You can check the status of the initialization Cloud-init setup by sshing as root into your server and running:

tail -f /var/log/cloud-init-output.log

Wait until you see a success message like πŸ‘½ SUCCESS: Setup complete! and the system restarts. If you go and see the logs again after restarting, you'll now see cloud-init confirmation: Cloud-init... finished at...

You can keep going with the next quickstart steps while you wait, just make sure your server is all ready before you actually deploy!

Configure things for deployment

Let's get ready to actually deploy your RailsFast project to your server!

Point your domain's DNS to the server

First, go to wherever you manage your domain's DNS, and point your domain to the server's public IP address you can find in Hetzner.

For me, since I'm using Cloudflare to register and manage my domains, I navigate to my Domain, click on DNS > Records, and click the [ + Add record ] button to add a new record. Make the record of type A where the name is @ (root) and the IP address is the server's IPv4 address from Hetzner. Leave the proxy status active (Proxied).

Select the right SSL encryption mode

Then, still in Cloudflare, go to SSL/TLS > Overview and click on the [ Configure ] button. Select Full (Strict) encryption mode and click Save.

NOTE

If you don't do set the right SSL mode in Cloudflare, even if your deployment succeeds, your server will complain about weird redirect errors like this: "The page isn’t redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies."

Edit deploy.yml to let Rails know where to deploy to

After the A DNS record is set and the Full SSL encryption mode is set, go back to your RailsFast project in Cursor and edit the deploy.yml file you can find at config/deploy.yml.

The deploy.yml is where we'll add all the details about your server and domain name so the app actually knows where to deploy to.

Change the following things:

  • IP: Replace the placeholder IP of your server. The placeholder IP is 1.2.3.4: search and replace, or replace manually in:
    • servers > web
    • accessories > postgres > host
    • accessories > pg-backup > host
  • Domain: Replace the placeholder domain for your actual domain name in:
    • proxy > host
  • SSH: Replace the placeholder SSH key path for the actual path of your Hetzner SSH private key in (example: ~/.ssh/my_hetzner_ssh_key):
    • ssh > keys

Now, optionally (but recommended):

NOTE

RailsFast uses Kamal for deployments. If you want to understand more about the deploy.yml file and what you can do re: deployments, check out the Kamal docs

Hit the deploy button

We're ready to deploy! Let's boot up the database and its scheduled backups:

kamal accessory boot all

If you're not using a container registry, launch the Docker Desktop app (to run Docker engine).

Then, run this to set up and boot the local registry (and confirm your container registry credentials are okay if you're not using a local registry):

kamal registry setup

And then, finally, deploy your project with:

kamal deploy

βœ… Success! This gets your RailsFast app live. Visit your domain name on a web browser and you'll see the live demo page.

TIP

This is a good time to share your project online! If you use X (formerly Twitter), please post about it and tag me so I can see it!

πŸš€ That's it! Your project is now running and living on the internet for about $5/mo, ready for full production usage, fully secured, on your own VPS that you fully control, where you own all your code and users' data, with no surprise $10k Vercel monthly bills! Welcome to freedom!

What you just got

I think it's worth repeating and making explicit everything you already have up and running now, because it's remarkable. Other templates require you several external dependencies, subscriptions to different services, and configuration headaches for something we've achieved here in under 15 minutes.

You now own:

  • βœ… A full-stack web application (not just a frontend decoy: both front and back-end) fully ready for production traffic
  • βœ… Running on your own domain
  • βœ… Secured with a SSL certificate (automatically issued on deployment and auto-renewed before expiration) which makes all client-server communications secure and strictly encrypted
  • βœ… A fully secure, production-ready database, DB schema, and migrations; all this with no external dependencies: you own all your user's data, nothing leaves your server, nobody can nuke your business by banning your Supabase account (because you don't need one!)
  • βœ… User authentication / login working by default, without any external dependencies either
  • βœ… Billing + payments: everything ready to start charging real money as soon as you configure your Stripe credentials in the next sections
  • βœ… You're running your entire business on your own server for a flat fee of less than $10/mo, without having to worry about getting traffic spikes (unlike Vercel!)
  • βœ… You can even fit multiple RailsFast projects in the same server, without having to pay more!
  • βœ… Your project is now ready to support thousands of users, right out of the box
  • βœ… Easily scalable to millions of users as your app grows (and even then, you won't be paying a fortune because servers are cheap!)
  • βœ… Plus all the features you can find in the features section of the docs, ready to go!

This quickstart may feel like a lot of steps, but it's only a one-time setup! Moving on, every time you want to deploy your app, you just need to run kamal deploy

You're now ready to start developing (or vibe coding) your app! Your next step is customizing the base project to start making your app actually look like your own app.