When to use multiple organizations
Use separate organizations for each environment when:- You need isolated wallets, users, and policies per environment
- You want to test policy changes without affecting production
- Different team members should have access to different environments
- You need to prevent accidental production operations during development
Each Dfns organization is fully isolated. Wallets, users, policies, and configurations in one organization cannot access or affect another organization.
Setting up your organizations
Contact Dfns support to create organizations for each environment. We recommend a naming convention that clearly identifies each environment:| Environment | Organization name | Purpose |
|---|---|---|
| Development | Acme Corp - Dev | Local development and testing |
| Staging | Acme Corp - Staging | Pre-production testing, QA |
| Production | Acme Corp - Production | Live application |
Service accounts per environment
As for the rest of the configuration, you will need to create separate service accounts for each environment. We recommend to use separate keys for each one of them. This provides:- Isolation: Compromised development credentials can’t affect production
- Audit trails: Clear attribution of which environment performed actions
- Different permissions: Broader permissions in dev, restricted in production
Recommended setup
Create service accounts in each organization
In each organization’s dashboard:
- Navigate to Settings > Developers > Service Accounts
- Create a service account with the corresponding public key
- Save the authentication token securely
Assign appropriate permissions
Consider granting broader permissions in development for easier testing, while restricting production to the minimum required:
| Environment | Recommended approach |
|---|---|
| Development | Broader permissions for rapid iteration |
| Staging | Match production permissions to catch issues |
| Production | Minimum required permissions only |
Configuration management
Environment variables
Structure your configuration to switch between environments:config.ts
Secrets management
Store credentials securely using a secrets manager:| Environment | Recommended storage |
|---|---|
| Development | Local .env file (gitignored) |
| Staging/Production | AWS Secrets Manager, HashiCorp Vault, or similar |
.env structure:
.env.development
Policies and permissions
Policies and permissions must be configured separately in each organization. Consider:Development environment
- Simpler policies or no policies for rapid iteration
- Broader permissions for all developers
- Use testnet chains only
Staging environment
- Mirror production policies to catch issues before release
- Test policy changes here before applying to production
- Use testnet chains for most testing
Production environment
- Strict policies with appropriate approval requirements
- Minimum necessary permissions
- Mainnet chains for real transactions
Webhooks
Configure webhooks separately for each environment to send events to the appropriate endpoints:| Environment | Webhook URL |
|---|---|
| Development | https://dev.example.com/webhooks/dfns or local tunnel |
| Staging | https://staging.example.com/webhooks/dfns |
| Production | https://api.example.com/webhooks/dfns |
