Skip to main content

Deploy Express.js on Hostim.dev

This guide shows how to deploy a Express app on Hostim.dev from a Git repository.

Quick start: Use the "Express Demo" template to skip the setup.

πŸ‘‰ Open the Console Click "+ New Project", pick Express Demo, and you're good to go.

Want to customize or start fresh? This guide walks you through the manual setup.


0. Create a Project​

Before deploying, create a new project:

  1. Go to your Hostim.dev dashboard
  2. Click Create Project
  3. Choose from:
    • Scratch: start empty
    • Template: use a prebuilt stack like Express Demo
    • Docker Compose: paste your own Compose file
  4. For this guide, choose Scratch
  5. Name your project (e.g. express-demo) and click Create Project

1. Use the Example Express App​

We'll deploy a real Express.js app from our public repository:

πŸ”— https://github.com/hostimdev/demo-express

You only need to clone the code if you want to run it locally or check out how it works. In that case, follow the instructions in the project's README:

🐳 This project already includes a working Dockerfile and is ready to deploy out of the box.


2. Deploy on Hostim.dev​

⚠️ Order Matters: To ensure the app works correctly, create services in this order: Volume β†’ Database β†’ Redis β†’ App. This ensures that environment variables and mounts are available when the app starts.


2.1. Create a Volume for File Storage​

  1. From your project dashboard, click Create Service β†’ New Volume
  2. Name your volume (e.g., avatar-uploads)
  3. Choose a plan
  4. Click Create Volume

2.2. Add a PostgreSQL Database​

  1. From your project dashboard, click Create Service β†’ New PostgreSQL
  2. Name your database (e.g., db)
  3. Choose a plan
  4. Click Create PostgreSQL

2.3. Add a Redis Instance​

  1. From your project dashboard, click Create Service β†’ New Redis
  2. Name your Redis instance (e.g., redis)
  3. Choose a plan
  4. Click Create Redis

2.4. Create the Express App​

  1. From your project dashboard, click Create Service β†’ New App
  2. Choose Git as the deployment type
  3. Use the GitHub URL: https://github.com/hostimdev/demo-express
  4. Set a branch to main
  5. Leave Dockerfile path as Dockerfile
  6. Choose a plan and number of replicas
  7. Under Volume Mounts, click Attach Volume
    • Select the volume you created (e.g., avatar-uploads)
    • Set mount path to /app/public/uploads/avatars
  8. Check "Does this app have HTTP Service?"
  9. Set the HTTP Port to 3000
  10. Check "Is this app public?" (or leave unchecked for private access)
  11. Click Create App

2.5. Configure Environment Variables​

  1. Open your app in the dashboard
  2. Go to the Envs tab
  3. Add the following environment variables:
NODE_ENV=development
DB_HOST=$(DB_POSTGRES_HOST)
DB_USER=$(DB_POSTGRES_USER)
DB_PASS=$(DB_POSTGRES_PASSWORD)
DB_NAME=$(DB_POSTGRES_DATABASE)
REDIS_HOST=$(REDIS_REDIS_HOST)
REDIS_PORT=$(REDIS_REDIS_PORT)

These pull in values automatically from the other services you set up.

VariableDescription
DB_*Populated from the PostgreSQL service
REDIS_*Populated from the Redis service
NODE_ENVSet manually to development

Click Save Changes when done.


βœ… Next Steps​