- Installation
- Getting Started
- Front-end Support
- Usage
- Serverless Functions
- Migrate To v2
- Dependencies
- Community
- Check your current CLI version by running
nhost version
- If your version is less than
v0.5.0
, then download the latest version by executing the following in your terminal:
- Remove the installed CLI:
npm uninstall nhost
ornhost uninstall
- Install the new one:
sudo curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
If your installed version is >= v0.5.0
, then your CLI version already supports the upgrade
command to automatically check the latest available version of the CLI and install it depending on your operating system and architecture. To use this, run the following:
sudo nhost upgrade
If you have curl
and Windows Subsytem for Linux
in your windows environment, you can safely use the above command, and it should download the .exe
variant of the binary in your current working directory.
However, if you do not have the above dependencies, then you can manually download the latest release binary depending on your platform architecture from here.
- Linux
- MacOS (including Apple Silicon)
- Windows
To get the list of all the supported commands, use:
nhost --help
Complete documentation for all commands is available here.
The single nhost
command will optionally offer you the option of cloning frontend templates for framework of your choice (NuxtJs, NextJs, ReactJs, etc.) in the {app_root}/web
directory, which will be preinstalled with all the Nhost libraries and plugins required to allow you to immediately start developing your frontend app.
Just one command:
nhost
- On first run in an empty directory, since the directory is not initialized for an Nhost app, it will do so, and launch the development environment.
- From second run onward, it will start app.
You can also execute the aforementioned actions using their specific commands:
nhost init
- to intialize a blank local app in current working directory. Ornhost init --remote
to clone an existing app from Nhost console.nhost dev
- to start your app.
If you do not have an already existing app on Nhost console, and you wish to create a new app on Nhost console and link it automatically to the local environment, then use:
nhost link
Note: ability to create new apps on Nhost console directly from your local environment is only available in CLI v0.5.0
or above.
If you have CLI version less than v0.5.0
, then you need to have an already existing app on Nhost console.
To upgrade your CLI to latest version, check this out.
If you already have a remote app for which you would like to setup a local development environment for, use the following:
nhost init --remote
This will present you with a list of apps, across all the workspaces, available on Nhost console, and you can select any one of those to set up a local environment for.
- Default file for environment variables is
{app_root}/.env.development
. - All variables inside
.env.development
are accessible inside both containers, and functions.
For more detailed information on runtime variables, including how to add environment variables only to specific service containers, and the list of dynamically generated runtime variables, check this out.
If you wish to trace the output and check verbose logs for any command, use the global flag --debug
or -d
Example:
nhost dev -d
This will print the debug logs along with the standard information, warnings and errors.
You can parallely run nhost logs
to check real time logs of any service container of your choice, while your local environment is already running. And you can also save it's output, by using --log-file
flag.
All functions must be stored inside the {app_root}/functions
directory.
When you launch the development environment using nhost
or nhost dev
, it will automatically also start your functions server, and display the URL on your terminal, in the following format:
http://localhost:1337/v1/functions/{function_name}
If you want to call your functions/hello.js
function, you can call the following route:
http://localhost:1337/v1/functions/hello
Nhost CLI currently supports functions in following runtimes:
- NodeJS (Both Javascript and Typescript)
- Golang
For more detailed information on Serverless Functions, like hello-world templates, understanding how speed up testing of functions, and some Pro-Tips, check this out.
CLI (>= v0.5.0) produces the nhost/config.yaml
file in your app root in a different format than the legacy CLI, and not to mention reads the same during nhost dev
command.
Now, if you already have existing Nhost apps initialized in multiple directories, and you upgrade to CLI v0.5.0
globally, the new CLI may not be able to read the nhost/config.yaml
files saved in older formats, hence breaking your local development environment.
For versions >= v0.5.0
:
For versions less than v0.5.0
:
- To report bugs, or request new features, please open an issue.
- For urgent support from our team, connect with us on Discord.