Configuration Overview
NextDNS Blocker uses two main configuration files:
.env: API credentials and environment settingsconfig.json: Domain schedules, blocklist, and allowlist
Configuration Locations
Section titled “Configuration Locations”| Platform | Location |
|---|---|
| macOS/Linux | ~/.config/nextdns-blocker/ |
| Windows | %APPDATA%\nextdns-blocker\ |
Quick Reference
Section titled “Quick Reference”.env (Credentials)
Section titled “.env (Credentials)”# RequiredNEXTDNS_API_KEY=your_api_keyNEXTDNS_PROFILE_ID=abc123
# OptionalAPI_TIMEOUT=10API_RETRIES=3DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...DISCORD_NOTIFICATIONS_ENABLED=trueconfig.json (Domains)
Section titled “config.json (Domains)”{ "version": "1.0", "settings": { "timezone": "America/New_York", "editor": null }, "categories": [...], "blocklist": [...], "allowlist": [...]}Configuration Sections
Section titled “Configuration Sections”| Section | Guide | Description |
|---|---|---|
| Environment | Environment Variables | API keys, timeouts, notifications |
| Structure | config.json | File structure and fields |
| Schedules | Schedules | Time-based access rules |
| Categories | Categories | Group domains with shared settings |
| Blocklist | Blocklist | Domains to manage |
| Allowlist | Allowlist | Domain exceptions |
| Delays | Unblock Delay | Friction-based protection |
| Timezone | Timezone | Schedule evaluation timezone |
Managing Configuration
Section titled “Managing Configuration”View Current Config
Section titled “View Current Config”nextdns-blocker config showEdit Configuration
Section titled “Edit Configuration”nextdns-blocker config editValidate Configuration
Section titled “Validate Configuration”nextdns-blocker config validateSet Specific Values
Section titled “Set Specific Values”nextdns-blocker config set timezone America/Los_Angelesnextdns-blocker config set editor vimConfiguration Best Practices
Section titled “Configuration Best Practices”Security
Section titled “Security”- Never commit
.envto version control - Keep API credentials private
- Use environment variables in CI/CD
Organization
Section titled “Organization”- Use descriptive
descriptionfields - Group related domains with similar schedules
- Document protected domains clearly
Testing
Section titled “Testing”- Use
config validatebefore syncing - Use
sync --dry-runto preview changes - Test schedule logic at boundary times
Example Configurations
Section titled “Example Configurations”Ready-to-use templates in the examples/ directory:
| Template | Use Case |
|---|---|
minimal.json | Quick start |
work-focus.json | Productivity |
gaming.json | Gaming platforms |
social-media.json | Social networks |
parental-control.json | Protected blocking |
study-mode.json | Student focus |
Copy a template:
cp examples/work-focus.json ~/.config/nextdns-blocker/config.jsonnextdns-blocker config edit # Customize