Deploily CLI is a native Node.js command-line tool for authenticating with a Keycloak-backed Deploily environment.
- OAuth2 login flow with PKCE
- Local callback server for browser-based authentication
- Secure credential storage via
keytarwith file fallback login,logout, andwhoamicommands- TypeScript + native ESM project setup
- Node.js 20+ recommended
- pnpm
- A running Keycloak instance
-
Install dependencies:
pnpm install
-
Start Keycloak with Docker Compose:
docker compose up -d
-
Navigate to
http://localhost:8080and log in with the default admin credentials (admin/admin)- Create a new realm
- Create a new client and add
http://localhost:8976/callbackas a valid redirect URI - Create a new user and assign them to the realm
-
Configure your
.envfile with the Keycloak endpoints and client details -
Build and run the CLI:
pnpm build node dist/index.js --help
The repository includes a simple local Keycloak setup in docker-compose.yml, This starts Keycloak with the default admin credentials admin / admin on port 8080.
deploily login
deploily logout
deploily whoami
deploily --help
deploily --versionOpens your browser, starts the local callback server, and completes the OAuth2 PKCE flow against Keycloak.
Clears locally stored credentials and attempts to log out from Keycloak.
Shows the current authenticated user when credentials are available.
- The CLI generates a PKCE code verifier, code challenge, and state value.
- It opens the Keycloak authorization URL in your browser.
- Keycloak redirects back to the local callback server on port
8976. - The CLI exchanges the authorization code for tokens.
- User info is fetched from the Keycloak userinfo endpoint.
- Credentials are stored with
keytar, or in~/.config/deploily/config.jsonifkeytaris unavailable.
src/index.ts- CLI entry point and command routingsrc/commands/- CLI command handlerssrc/auth/- authentication service and callback serversrc/config/- configuration constantssrc/storage/- credential persistencesrc/utils/- PKCE helperssrc/types/- shared TypeScript types