DEV Community

Rohit Mahto
Rohit Mahto

Posted on

I deployed a MERN app for the first time free for 30 days, here's exactly what I clicked

Full disclosure: I built DormHost.dev.

I wrote up the code for shrtn in an earlier post, a small real link shortener: MongoDB, Express, React, Node. This post is the other half, aimed at anyone who's never deployed a full-stack app before. Every screenshot below is the real dashboard, not a mockup, and the app is actually live at the end of it.

1. Sign in

dash.dormhost.dev

No signup form, no password to invent, no email to verify. One button.

Sign in page with Continue with GitHub and Continue with Google buttons

2. Create the app

dash.dormhost.dev/apps/new

Give it a name, paste your GitHub repo URL, pick a region near you. That's the whole form. You don't need to know what a Dockerfile is, it reads your repo and figures out how to build it.

New app form filled in with the shrtn repo, name, plan and region

Press create and it builds right away, no separate "now deploy" step.

3. Add a database

Open the Database section on your app's page. If your app needs one, pick MongoDB, click once.

Database section showing a provisioned MongoDB with connection details

You don't copy a connection string anywhere. It shows up inside your app as an environment variable, MONGODB_URI, already pointed at a real database. Your code just reads process.env.MONGODB_URI. More on how this works for a MERN project specifically in the DormHost MERN guide.

4. One thing that will trip you up (it tripped me up)

If your app connects to the database in code that runs at startup, and you deploy before adding the database, the first deploy will crash. Mine did, with an error about 127.0.0.1:27017, the address for a database running on your own laptop, not this one.

Nothing was wrong with the code. The database just didn't exist yet when that first build ran. Fix: add the database, then hit deploy again. One click, not a bug to chase. The docs cover this and the other usual first-deploy snags.

5. It's live

The deployed shrtn app, a working link shortener form with two real shortened links

That's a real, working app, with a real database behind it, and I never touched a terminal to get it there. 30 days free to try it yourself, no card needed.

Code: github.com/rohit267/shrtn
Live: shrtn-rohitmahto267.dormhost.app
Try it: dormhost.dev

Top comments (0)