Hosting n8n using huggingface space

If you don’t have a cloud instance or domain, self hosting n8n may be a bit difficult.

I just wanted to share an incredibly easy and completely free way to deploy your own n8n instance, complete with a free, user-friendly domain name! If you’ve been looking for a cost-effective and straightforward solution for your automation workflows, this is it.

I’ve been experimenting with a combination of Huggingface Spaces for hosting and Supabase for the database, and the results are fantastic. It’s surprisingly simple to get up and running, even if you’re not a deployment wizard.

Why this combo is awesome:

  • Free Hosting (Huggingface Spaces): You can leverage their generous free tier for running your n8n instance. It’s built on Gradio, but it works perfectly for web apps like n8n, giving you a your-username-your-space-name.hf.space URL.

  • Free Database (Supabase): Supabase provides a robust PostgreSQL database with a very generous free tier, more than enough for most personal and small-scale n8n deployments.

  • Easy Setup: No complex server configurations or Docker deployments needed if you follow the right steps. It’s more about configuring services than managing infrastructure.

What you’ll need (all free accounts):

  1. A Huggingface account
  2. A Supabase account

Using Supabase for database

According to huggingface space documentation , Space will “go to sleep” and stop executing after a period of time if unused. To avoid this, we can use Supabase for the database.

  1. Sign up for a free account at https://supabase.com/dashboard/sign-up

  2. Create a new project and fill the form. Save the database password for later use.

    supabase create project
    supabase project setting

  3. View the database connection info by click the Connect button on the top left nav bar.

    supabase project

  4. Select SQLAlchemy as Connection String and find the Transaction pooler section.

    supabase connection
    supabase connection transaction pooler

  5. Save the connection info for later use: host, port, user, dbname.

Deploying n8n using huggingface space

Huggingface space provide a free tier with 16GB RAM, 2 CPU cores and 50GB of (not persistent) disk space. This is enough for hosting n8n.

HardwareGPU MemoryCPUMemoryDiskHourly Price
CPU Basic-2 vCPU16 GB50 GBFree!

Using space https://huggingface.co/spaces/tomowang/n8n to duplicate and deploy n8n in the easy way.

  1. Sign up for a free account at https://huggingface.co/join and pick a profile name.tomowang is the profile in https://huggingface.co/tomowang as an example. Remember the profile name for later use.

  2. Access https://huggingface.co/spaces/tomowang/n8n and click the menu drop down in top right corner and select Duplicate this space.

    hf duplicate space

  3. Fill or change the variable and secrets in pop-up form and click Duplicate.

    hf space env

    VariableValue
    DB_POSTGRESDB_PASSWORDsupabase db password
    DB_POSTGRESDB_USERsupabase db connection user
    DB_POSTGRESDB_HOSTsupabase db connection host
    DB_POSTGRESDB_PORT6543
    N8N_ENCRYPTION_KEYRandom string. Use openssl rand -base64 32 to generate
    WEBHOOK_URLExample https://<profile>-n8n.hf.space/
    N8N_EDITOR_BASE_URLExample https://<profile>-n8n.hf.space/
    GENERIC_TIMEZONEConfig by requirement
    TZConfig by requirement
  4. Click Duplicate Space and wait for the deployment to finish. You can find the logs as following

    hf space deploy start

  5. Once the deployment is finished, you can find the URL as configured in theN8N_EDITOR_BASE_URL variable.

    hf space deploy done

Now you can access n8n using the URL.

n8n use helmet for security headers. In production mode, it will set X-Frame-Options to sameorigin, which causes the n8n site to be blocked by the iframe in the Huggingface Space (code https://github.com/n8n-io/n8n/blob/master/packages/cli/src/server.ts#L401-L402 ).