Using the CLI
How to use the various nokkio CLI commands
The nokkio CLI is an essential part of the Nokkio development loop. You’ll use it to create, develop, and deploy your applications. To get a list of the supported commands at any time, run nokkio help.
nokkio auth
The auth command authenticates the current installation of the CLI to a Nokkio account, allowing you to take actions on behalf of the authenticated user.
nokkio auth
The auth command will open your default browser and guide you through logging in to nokk.io. Once complete, you will see this message in your browser: This client should now be registered. It is then safe to close the browser window. Your CLI is now authenticated.
nokkio create
The create command initializes a new Nokkio project. You can call nokkio create with no arguments to use a wizard to configure your new project, or pass your configuration in via arguments and flags.
Using the wizard
The simplest way to get started is to call nokkio create without any arguments, and the CLI will interactively help you configure your project.
nokkio create
Without the wizard
You may also call nokkio create with a project name to skip the configuration wizard:
nokkio create hello-world
The CLI will create a new directory named hello-world, then create a new Nokkio project inside. Once complete, you can change into the hello-world directory and run nokkio dev to begin working on your project.
You can enable a variety of options by passing flags as documented below.
--tailwind
By default, Nokkio creates a new project that uses CSS modules for styling. If you’d prefer to use the TailwindCSS utility-first framework instead, provide the --tailwind flag:
nokkio create hello-world --tailwind
--typescript
If you prefer to write your project in TypeScript, provide the--typescript flag:
nokkio create hello-world --typescript
--eslint
To seed your new project with a working ESLint configuration, pass the --eslint flag:
nokkio create hello-world --eslint
nokkio dev
The dev command starts a Nokkio project on your local machine, allowing you to develop and test before deploying.
nokkio dev
Once started, your project can be accessed in a browser at http://localhost:9000. The development server will continue running until it is interrupted, which can be done in your terminal by pressingctrl-c.
nokkio deploy Requires auth
The deploy command packages your project and deploys it to nokk.io. Before deploying, make sure you have run nokkio auth.
nokkio deploy
In a few moments, your project will be available at nokk.io! You can continue to work on the project and deploy changes as many times as you like by running nokkio deploy again.
--preview
To test a deploy before exposing it to all users, use the –preview flag:
nokkio deploy --preview
The project will be deployed to a temporary subdomain using your project name and a random string suffix so that only you or the people you share the link with will be able to access it. Watch the CLI output for the temporary location once the deploy completes.
nokkio secret Requires auth
The secret command securely declares and stores secret values in your nokk.io account for use within Nokkio Endpoints. Secrets are scoped to an environment: development or production. Secrets stored in the development environment are exposed to projects that are run locally via nokkio dev, while secrets stored in the production environment are only exposed to your project when it is running in the nokk.io production environment.
The following example would create a secret named githubApiKey in the development environment:
nokkio secret create githubApiKey --environment development
The CLI will then prompt you for the value of the secret twice to ensure it is input correctly.
--file
To create a secret using the contents of a file as the value, provide the path of the file to the --file flag:
nokkio secret create githubApiKey \ --environment development \ --file github.json
Read more on how to use secrets in Nokkio Endpoints.
nokkio connect Requires auth
The connect command links the current Nokkio project with a GitHub repository. Once connected, new commits to the main branch will automatically deploy, and a preview deploy will be created for all pull requests.
Before running the connect command, the current project must be a git repository and already be pushed to GitHub, and you need to be authenticated via nokkio auth.
nokkio connect
Read more about Nokkio's GitHub integration.
nokkio typecheck-server
Nokkio's endpoints use the Deno runtime. The nokkio typecheck-server command will typecheck all your project's server-side TypeScript files, running the deno check command with the proper arguments.
nokkio typecheck-server
nokkio test-server
Nokkio's endpoints use the Deno runtime. The nokkio test-server command will execute all your project's server-side tests, running the deno test command with the proper arguments.
nokkio test-server