Skip to content

Quick Setup

After installation, run the interactive setup wizard to configure your NextDNS credentials.

Before running the wizard, you’ll need:

  1. Go to my.nextdns.io/account
  2. Scroll to the “API” section
  3. Click to reveal and copy your API key
  1. Go to my.nextdns.io
  2. Select your profile
  3. Copy the ID from the URL: https://my.nextdns.io/abc123/setupabc123
Terminal window
nextdns-blocker init

The wizard will prompt for:

NextDNS Blocker Setup
━━━━━━━━━━━━━━━━━━━━━
Enter your NextDNS API Key: ********
Enter your NextDNS Profile ID: abc123
Validating credentials... ✓
Detecting timezone... America/New_York ✓
Configuration saved to:
~/.config/nextdns-blocker/.env
~/.config/nextdns-blocker/config.json
Run 'nextdns-blocker config edit' to configure domains.
FilePurpose
.envAPI credentials (API key, profile ID)
config.jsonDomain schedules and settings

Both files are created in your platform’s config directory:

  • macOS/Linux: ~/.config/nextdns-blocker/
  • Windows: %APPDATA%\nextdns-blocker\

Open the configuration editor:

Terminal window
nextdns-blocker config edit

This opens config.json in your default editor. Add your first domain:

{
"version": "1.0",
"settings": {
"timezone": "America/New_York",
"editor": null
},
"blocklist": [
{
"domain": "reddit.com",
"description": "Social media",
"unblock_delay": "30m",
"schedule": {
"available_hours": [
{
"days": ["monday", "tuesday", "wednesday", "thursday", "friday"],
"time_ranges": [
{"start": "12:00", "end": "13:00"},
{"start": "18:00", "end": "22:00"}
]
},
{
"days": ["saturday", "sunday"],
"time_ranges": [
{"start": "10:00", "end": "23:00"}
]
}
]
}
}
],
"allowlist": []
}

Save and exit the editor.

Check that your configuration is valid:

Terminal window
nextdns-blocker config validate

Expected output:

Configuration valid ✓
Blocklist: 1 domain
Allowlist: 0 domains
Timezone: America/New_York

For automatic syncing every 2 minutes:

Terminal window
nextdns-blocker watchdog install

This creates platform-specific scheduled tasks:

  • macOS: launchd job
  • Linux: cron entry
  • Windows: Task Scheduler task

Verify it’s running:

Terminal window
nextdns-blocker watchdog status

Run a manual sync to verify everything works:

Terminal window
nextdns-blocker config push --verbose

You should see output like:

Syncing domains...
reddit.com: BLOCKED (outside available hours)
Sync complete: 1 blocked, 0 unblocked

Ready-to-use templates are available in the examples/ directory:

TemplateDescription
minimal.jsonQuick-start with one domain
work-focus.jsonProductivity-focused rules
gaming.jsonGaming platforms scheduling
social-media.jsonSocial networks management
parental-control.jsonProtected content blocking
study-mode.jsonStudent-focused scheduling

Copy a template:

Terminal window
cp examples/work-focus.json ~/.config/nextdns-blocker/config.json
nextdns-blocker config edit # Customize as needed

Timezone is auto-detected during setup. To change it:

Terminal window
nextdns-blocker config set timezone America/Los_Angeles

See the Timezone guide for more details.