Docs · quickstart
Your first function
This guide takes you from nothing to a live HTTPS URL. You’ll need Node.js 20 or newer to run the CLI and a free Liusha account.
1. Install the CLI
$ npm install -g @liusha-com/cliCheck that it works:
$ liusha --version2. Sign in
This opens your browser to authorize the CLI. A scoped API key is stored locally — revoke it any time from the console.
$ liusha login3. Create a function
$ liusha init hello --template node $ cd hello
Templates are plain HTTP servers — no Liusha SDK required. The Node.js template uses index.js:
import { createServer } from 'node:http';
const port = process.env.PORT || 8080;
createServer((_req, res) => {
res.setHeader('content-type', 'application/json');
res.end(JSON.stringify({ message: 'hello from liusha' }));
}).listen(port);8080 is only the local fallback. In production, do not hard-code a port or set PORTyourself; always listen on the PORTenvironment variable supplied by Liusha.
4. Deploy
$ liusha deployYour source is packaged and built in the cloud, then released as a new revision. First builds take about a minute; later ones are faster thanks to layer caching. When it finishes you get your URL:
✓ Deployed → https://hello.liusha.app5. Watch it run
Stream logs live while you send requests:
$ liusha logs hello --followLeave it alone for a while and it scales to zero — checkliusha status hello to see it sleeping. The next request wakes it automatically.
6. Check your setup
If deploys or custom domains feel stuck, run the built-in diagnostics. It checks the API, login session, project config, latest deployment, and function URL from the current directory.
$ liusha diagnose7. Clean up
Delete the function when you no longer need it. This removes the Knative service and keeps your project ready for a fresh deploy.
$ liusha functions delete helloNext steps
- Pick another language with
liusha init api --template pythonor read the template guide. - Set encrypted runtime values with
liusha secrets set KEY=value, then redeploy to bind the new version. - Roll back with
liusha rollback DEPLOYMENT_ID— every deploy is an immutable revision. - Invite your team from the console and give CI a deploy-only API key.