feat: support multiple API keys (profiles) for managing multiple Dokploy organizations
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 152
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
Problem
The CLI currently stores a single {url, token} credential pair (via dokploy auth, env vars, or .env). There is no way to manage multiple organizations or multiple Dokploy instances without manually swapping credentials each time.
Current workaround: re-run dokploy auth -u <url> -t <token> or swap DOKPLOY_API_KEY / DOKPLOY_URL environment variables every time you need to target a different organization or server.
This is painful for users who:
- Manage multiple Dokploy instances (e.g., staging vs production, or different clients)
- Belong to multiple organizations within the same Dokploy instance (where API keys are org-scoped via the
metadata.organizationIdfield inuser.createApiKey) - Work in CI/CD pipelines that deploy to different environments
Proposed Solution
Introduce a profile system (similar to aws-cli profiles, kubectl contexts, or gcloud configurations).
CLI interface
# Save a named profile
dokploy auth --profile prod -u https://panel.example.com -t <api-key>
dokploy auth --profile staging -u https://staging.example.com -t <api-key>
dokploy auth --profile client-acme -u https://panel.example.com -t <org-scoped-key>
# List profiles
dokploy profiles list
# * prod https://panel.example.com
# staging https://staging.example.com
# client-acme https://panel.example.com
# Switch active profile
dokploy profiles use staging
# Show current profile
dokploy profiles current
Config file (~/.dokploy/config.json)
{
"currentProfile": "prod",
"profiles": {
"prod": {
"url": "https://panel.example.com",
"token": "<api-key>"
},
"staging": {
"url": "https://staging.example.com",
"token": "<api-key>"
},
"client-acme": {
"url": "https://panel.example.com",
"token": "<org-scoped-api-key>"
}
}
}
Key changes
-
client.ts—readAuthConfig()resolves credentials in this order:--profile <name>global flag (highest priority)DOKPLOY_PROFILEenv varDOKPLOY_URL+DOKPLOY_API_KEYenv vars (backward compatible)- Active profile from config (stored in
~/.dokploy/config.jsonor similar) - Legacy
config.jsonnext to the package (backward compatible)
-
commands/auth.ts— Add optional--profile <name>flag. When omitted, saves to adefaultprofile for backward compatibility. -
New
profilescommand group —list,use,current,remove. -
Global
--profileflag — Allow overriding the active profile on any command:dokploy --profile staging project list.
Benefits
- Backward compatible: existing single-key usage continues to work unchanged
- No credential juggling: switch contexts with one command instead of re-authenticating
- CI/CD friendly: use
DOKPLOY_PROFILE=staging dokploy project listor--profile staging - Aligns with server capabilities: the Dokploy server already supports org-scoped API keys; the CLI just needs a way to use them conveniently
Related
- The server API already supports organization-scoped API keys via
user.createApiKeywithmetadata.organizationId - 22 CLI commands already accept
--organizationIdflags, meaning the server is multi-org aware but the CLI auth layer is not
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in client.ts at readAuthConfig() and in commands/auth.ts, then inspect the existing command registration and global-flag entry points. Trace current credential storage and environment-variable handling before designing profile resolution and the profiles list/use/current/remove commands. Done means named profiles, profile selection and backward-compatible credential sources work through the documented CLI and CI/CD flows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100