Comment on page
Deploying Your Experiment
How to deploy your experiment.
This tutorial describes how to deploy Empirica using any server or VM provider. Empirica is a single command and uses an embedded database, so there is only one executable to install.
Bundling your experiment is the task of building all the code you've created for your experiment and packaging it, along with the configuration, into a compressed "bundle" file.
To do so, run at the root of your experiment:
This should create a file like
[name-of-your-experiment].tar.zst. This is your bundled experiment. This is what you will deploy to your server. You should not add this to your code repository.
You will need the empirica binary:
curl https://install.empirica.dev | sh -s
Just so you know, you will need to send your experiment bundle to the server. For example, using
And finally, on the server, run the experiment with:
empirica serve myexperiment.tar.zst
Your experiment will be available at the address of that machine on port 3000.
You will need a domain name to use HTTPS (encrypted connections). We will not go into much detail here, but you can find many registrars online, such as Google Domains, Cloudflare Registrar, Namecheap, or Hover.
Then you will need to configure your domain name to point to your server. This is also beyond the scope of this guide. Still, you should be able to look up the documentation of your hosting provider (e.g., Digital Ocean) and your Registrar (e.g., Google Domains) to figure out how to point your domain name to your server using either an A Record or CNAME Record.
Once your domain name is set up (we will use
www.example.comin our example), you can run:
caddy reverse-proxy --from www.example.com --to localhost:3000
This will set up the HTTPS certificate and redirect all incoming traffic to empirica.
The data in empirica will be stored in
.empirica/local/tajriba.json. Copy that file to a safe place after running your experiment. You can take as many snapshots of your data as you wish by copying that file every so often.