How do I deploy from my terminal with the Hodifly CLI?
The Hodifly command line deploys your sites from your own terminal, from a script, or from your CI. It does everything the Hodifly page in cPanel does: create a project, deploy, roll back, read build logs, manage environment variables. It also creates the databases your apps need.
It is one file with no dependencies. You need Node 18 or newer, and it runs on macOS, Linux and Windows.
It works on Hodi shared hosting and on a dedicated server or VPS running Hodifly. On shared hosting, an AI assistant (Claude, ChatGPT, Cursor...) can also do all of this for you without the command line: see How do I connect Claude, ChatGPT or Cursor to my hosting?. The assistant then needs no API token, and you choose what it may do. On a dedicated server, the command line is the way.
Install it
Use whichever package manager you already have:
pnpm add -g hodiflynpm i -g hodiflyyarn global add hodifly
Sign in
In cPanel, open Hodifly and click API. Press Create an API token and you are given a complete command to paste:
hodifly login --host server.example.com --user myaccount --token ...That saves your credentials in ~/.hodifly/config.json, readable only by you. You only do this once per hosting account.
The token is an ordinary cPanel API token. cPanel only issues full-access tokens, so it can do anything you can do in cPanel: keep it to yourself, never paste it into a chat with an AI assistant, and remove it under Manage API Tokens when you no longer need it.
If you would rather not paste a token on the command line, run hodifly login with no options and it will ask for the three values, without showing the token as you type.
Everyday commands
Command | What it does |
|---|---|
| Your projects, and how the last build went |
| Build and publish the current head of the branch |
| The deployments you can roll back to |
| Point the site back at an earlier build |
| Build output, newest deployment by default |
| The project's environment variables (names only) |
| The account's MySQL and PostgreSQL databases |
| Delete the project (the files on disk are kept) |
A deployment is one build. hodifly ls gives you their ids, and a rollback takes one of them:
hodifly ls my-site --prod
hodifly rollback my-site 812308420affa006
A rollback is instant. The release is already on the server, so nothing is rebuilt.
Create a project
hodifly projects add \
--repo my-org/my-site \
--domain example.com \
--build-command "npm run build" \
--output-directory dist
The repository has to be one you have already connected under Manage GitHub in the Hodifly page. Run hodifly --help to see every option.
If --domain names a subdomain of your main domain that does not exist yet, it is created for you before the first build, so there is no need to add it in cPanel first:
hodifly projects add --repo my-org/blog --domain blog.example.comThat applies to subdomains of your main domain only. Any other domain has to be registered and pointed at the server, so add it in cPanel > Domains first and then run the command.
Push straight to Hodi, with no GitHub or GitLab
For a small project, a prototype or an AI-generated site, the project can start from nothing: Hodifly hosts an empty Git repository on git.hodifly.app, and you push to it. The first push detects the framework and deploys; every later push to the branch deploys too.
hodifly projects add --push --domain example.com
git remote add hodifly https://git.hodifly.app/<id>.git
git push hodifly main
git asks for credentials: any username, and the push token as the password. It is shown once, by projects add --push or by hodifly token my-site; hand it to git's credential helper. --name names the project (by default, after the domain).
Command | What it does |
|---|---|
| The repository address and the live push tokens (never their values) |
| A new token, shown once |
| Revoke a token: pushes using it stop at once |
If you already have GitHub or GitLab, stay there: you keep the history with a third party, reviews and pull request previews. The Hodifly repository is a deploy mirror, not a backup; it is capped at 1 GB and 30 pushes an hour, and force pushes are accepted.
Needs version 1.4 or newer.
Change a setting on a project
projects set edits a project you already have, without opening cPanel:
hodifly projects set my-api --startup dist/main.js
hodifly projects set my-site --build-command "npm run build"
hodifly projects set my-site --branch production
It is a patch: only what you name changes, everything else stays as it is. Give a switch a value to turn it off (--previews 0), and an empty value to clear a field (--build-command ""). Nothing is rebuilt, so follow it with hodifly deploy my-site when the change should take effect now.
It takes the same options as projects add, plus --autodeploy, --notify-success, --notify-failed, --notify-email and --persist. What it will not change is what belongs to the hosting account rather than to the project: the domain, the folder on the account and the repository itself. Move a project to another domain by creating a second project.
Needs version 1.1 or newer: npm i -g hodifly to update, hodifly --version to check.
Manage environment variables
hodifly env manages the same variables as the Environment variables section of the Hodifly page: they are stored encrypted on your server, and your app's .env file is rebuilt from them on every deploy.
That is why you should not edit the .env on the server by hand (File Manager, SSH): the next deploy overwrites it. Change the variable, then redeploy.
Command | What it does |
|---|---|
| The names, set or empty, without the values |
| Add or change one or more variables (the others are kept) |
| Remove one or more variables |
| Load a |
| Get every variable back in |
| Print a single raw value |
| Open the variables in your editor, review the changes, then save |
A change applies at the next deploy. Add --deploy to deploy right away:
hodifly env set APP_ENV=production APP_DEBUG=false my-site --deployFor a secret, write KEY=-: the value is read from standard input (or asked for without being shown), so it never appears in your shell history or in the process list.
hodifly env set STRIPE_SECRET=- my-siteA few details:
--build-onlykeeps a variable for the build: it is available while the build runs but never reaches the app in production. Handy for a private npm registry token.import --replacemakes the file the complete set: any variable missing from the file is removed. You are asked to confirm.export,getand--showprint your secrets in clear: redirect their output to a file rather than leaving it on screen, and never paste it into a ticket or a chat.
Needs version 1.2 or newer.
Create a database
hodifly db create makes a MySQL or PostgreSQL database, a user with a generated password, and gives that user every right on the database, in one command. Name the project that uses it, and the connection settings go straight into its environment variables:
hodifly db create shop --project my-site --deploy
hodifly db create blog --engine postgresql --project my-blog
The project receives DATABASE_URL and DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD, whatever the framework: Laravel, Symfony, Rails, Django or Prisma each find the form they read. The password is never shown.
Without --project, the same lines are printed so you can keep them in a file:
hodifly db create crm >> .envA few details:
- Your account's prefix (
myaccount_) is added to the name when you leave it out:shopbecomesmyaccount_shop. --usergives the user another name than the database.hodifly dblists the databases and their users. Delete a database in cPanel: the command line never deletes one.
Needs version 1.3 or newer.
Import a Docker project
Does your project have a Dockerfile or a docker-compose.yml? hodifly import reads them and prepares the matching Hodifly project, without the container: Hodifly already brings the web server, the SSL certificate, the runtime and the dependency install.
cd my-project
hodifly import --dry-run
Nothing is built or run, and no sign-in is needed: the command reads your files and prints the plan. The mode (static, PHP, Node, Python, Ruby), the runtime version, the build command, the output folder, the startup file, the folders to keep across deploys, the environment variables (names only, never their values) and the database replacing a MySQL, MariaDB or PostgreSQL service.
It also says what does not carry over, rather than guessing: a language Hodifly does not run (Go, Java, Rust, .NET), system packages and PHP extensions installed in the image, other services (Redis, Elasticsearch...), workers, variables pointing at another container and development values (APP_DEBUG=true).
Without --dry-run, it also writes a hodifly.json next to your code (never over an existing file): commit it. To create the project, add the domain and where the code comes from:
hodifly import --domain example.com --repo my-org/my-app --deploy
hodifly import --domain example.com --push
The project, its variables and its database are created, and the database settings go into DATABASE_URL and DB_*. Your data stays in the container: export it (docker compose exec db mysqldump ... or pg_dump) and import it with phpMyAdmin or phpPgAdmin in cPanel.
A few details:
- Folders of your machine mounted into the container (
./src:/app/src) are never kept: they are often your code itself. Named volumes and the Dockerfile'sVOLUMEs are. ${VARIABLE}in the compose file is read from the.envnext to it, never from your terminal.--servicepicks the web service when several are built from the folder,--targetthe Dockerfile stage, and--mode,--runtime,--build-command,--startup... correct what was read.
To find out whether Hodifly suits your project, see Hodifly or Docker?
Needs version 1.5 or newer.
If you have sites on more than one server
Each hosting account lives on its own server, so sign in to each one. Hodifly remembers which projects and domains belong to which account, and works out the rest from the name you type:
hodifly deploy blog.example.comThat finds the account, the server and the project on that domain. If a name exists on two of your accounts, Hodifly tells you rather than guessing, and you add --profile:
hodifly deploy my-site --profile workCommand | What it does |
|---|---|
| The accounts you are signed in to |
| Choose the default account |
| Re-read what each account has |
| Forget an account on this machine |
In a script or in CI
Add --json to any command to get the raw response instead of a table. Credentials can come from the environment instead of the saved file, which is what you want on a build server:
export HODIFLY_HOST=server.example.com
export HODIFLY_USER=myaccount
export HODIFLY_TOKEN=...
hodifly deploy my-site --json
Environment variables update the same way, with no interactive terminal. Name the project with --project so it cannot be mistaken for a variable name:
printf %s "$STRIPE_SECRET" | hodifly env set STRIPE_SECRET=- --project my-site
hodifly env import .env.production --project my-site --deploy
Only hodifly env edit needs a terminal. In a script, import --replace needs --yes, so no variable is removed by accident.
Keep the token in your CI provider's secret store, never in the repository.
If something does not work
Message | What to do |
|---|---|
| The API is on port 2083. Some office and airport networks block it. |
| The token was removed, or the username is wrong. Create a new one from the API page and run |
| Add |
| Two projects share that name: use the id shown instead. |
Updated on: 02/12/2026
Thank you!