@authrim/setup
v0.1.141
Published
CLI tool for setting up Authrim OIDC Provider on Cloudflare Workers
Readme
@authrim/setup
CLI and Web UI for deploying Authrim OIDC Provider to Cloudflare Workers.
Quick Start
# Web UI (recommended)
npx @authrim/setup
# CLI mode
npx @authrim/setup --cli
# Manage existing environments only
npx @authrim/setup manageSupported Languages
The setup tool supports the following 11 languages:
| Code | Language | Native Name |
|------|----------|-------------|
| en | English | English |
| ja | Japanese | 日本語 |
| zh-CN | Chinese (Simplified) | 简体中文 |
| zh-TW | Chinese (Traditional) | 繁體中文 |
| es | Spanish | Español |
| pt | Portuguese | Português |
| fr | French | Français |
| de | German | Deutsch |
| ko | Korean | 한국어 |
| ru | Russian | Русский |
| id | Indonesian | Bahasa Indonesia |
Language is automatically detected from your system locale or browser settings. You can also specify a language manually:
# CLI: Use --lang option
npx @authrim/setup --lang=ja
# Web UI: Use ?lang query parameter
# http://localhost:3456/?lang=jaRequirements
- Node.js >= 20.0.0
- Wrangler CLI installed and authenticated
- Cloudflare Workers Paid plan
Commands
init (default)
npx @authrim/setup [options]
Options:
--cli CLI mode instead of Web UI
--lang <code> Language (en, ja, zh-CN, etc.)
--config <path> Load existing configuration
--env <name> Environment name (prod, staging, dev)manage
Manage existing environments (no source code required):
npx @authrim/setup managedeploy
npx @authrim/setup deploy [options]
Options:
-c, --config <path> Config file path
-e, --env <env> Environment name
--component <name> Deploy single component
--dry-run Preview without deploying
--skip-secrets Skip secrets upload
-y, --yes Skip confirmation (CI/CD)delete
npx @authrim/setup delete [options]
Options:
--env <name> Environment to delete
-y, --yes Skip confirmation (CI/CD)
--no-workers Keep Workers
--no-d1 Keep D1 databases
--no-kv Keep KV namespacesinfo
npx @authrim/setup info [options]
Options:
--env <name> Environment name
--json JSON output (for scripting)
--d1 D1 info only
--workers Worker info onlyconfig
npx @authrim/setup config [options]
Options:
--show Show configuration
--validate Validate configuration
--json JSON outputConfiguration Structure
Authrim uses a unified directory structure for each environment:
project/
└── .authrim/
└── {env}/ # e.g., prod, staging, dev
├── config.json # Environment settings
├── lock.json # Provisioned resource IDs
├── version.txt # Setup tool version
├── keys/ # Cryptographic keys (gitignored)
└── wrangler/ # Generated wrangler configsConfiguration Files
| File | Description |
|------|-------------|
| .authrim/{env}/config.json | Environment settings |
| .authrim/{env}/lock.json | Provisioned resource IDs |
| .authrim/{env}/keys/ | Cryptographic keys (gitignored) |
Components
| Component | Description |
|-----------|-------------|
| api | Core OIDC API (required) |
| loginUi | Login/consent UI |
| adminUi | Admin dashboard |
| saml | SAML 2.0 IdP |
| async | Email, webhooks |
| vc | Verifiable Credentials |
| bridge | Social login (Google, GitHub, etc.) |
| policy | ReBAC Policy Engine |
Resource Naming
| Type | Pattern | Example |
|------|---------|---------|
| Workers | {env}-ar-{component} | prod-ar-auth |
| D1 | {env}-authrim-{type}-db | prod-authrim-core-db |
| KV | {env}-{NAME} | prod-CLIENTS_CACHE |
CI/CD
# Deploy without prompts
npx @authrim/setup deploy --env prod --yes
# Delete environment
npx @authrim/setup delete --env staging --yes
# Get info as JSON
npx @authrim/setup info --env prod --json | jq '.d1[0].databaseSize'Environment variables:
CLOUDFLARE_API_TOKEN- API tokenCLOUDFLARE_ACCOUNT_ID- Account IDAUTHRIM_LANG- Default language (e.g.,ja,en)
Troubleshooting
Wrangler not installed
npm install -g wrangler
wrangler loginLock file not found
npx @authrim/setup init --env prodService Bindings error
Deploy missing components first, or disable them in configuration. The ar-router must be deployed last.
License
Apache License 2.0
