Self-hosting
Run your own copy of Casharks Bot on a Windows VPS: the Discord bot, its dashboard and these docs. Every feature is included and it costs nothing; you only pay for the VPS. There are no files to edit and no code: your bot is connected from the browser.
What you need
| Server | Windows VPS: Windows Server 2019+ or Windows 10/11 |
| Memory / disk | 2 GB RAM minimum (4 GB recommended), about 3 GB free disk |
| Software | Node.js 20 LTS or newer from nodejs.org. The database (PostgreSQL) and Redis are set up for you. |
| Discord | A free application in the Discord developer portal |
| Optional | A domain, for an HTTPS address like https://bot.example.com |
1. Download and unzip
Download the zip from the Self-host page of the Casharks Bot website, copy it to your VPS and extract it to a folder such as C:\Casharks. Install Node.js if it isn't there yet.
2. Run install.bat
Double-click install.bat. It checks Node.js, offers to install a portable Redis (no admin rights needed), sets up a project-local PostgreSQL, creates the database tables and builds the dashboard. It also asks how you'll open the dashboard:
| Option | Address | Best for |
|---|---|---|
| Your own domain | https://your.domain | Production. Free HTTPS through Cloudflare Tunnel, no ports to open. |
| Server IP | http://SERVER-IP:3000 | Quick testing. Opens ports 3000 and 4000 in Windows Firewall. Traffic isn't encrypted. |
| This machine only | http://localhost:3000 | Using the dashboard from inside the VPS (RDP). |
Own domain: add the domain to a free Cloudflare account (change its nameservers to Cloudflare's) first. install.bat, or connect-domain.bat later, creates the tunnel and points the domain at it. www. redirects to the bare domain.
Server IP: also allow TCP ports 3000 and 4000 in your VPS provider's firewall or security group, if it has one.
It's safe to run install.bat again at any time.
3. Run start.bat and connect your bot
Double-click start.bat. The first time, no bot is connected yet, so it starts the website in setup mode, shows a setup code and opens the setup page in your browser (or open your dashboard address followed by /setup).
- In the Discord developer portal, press New Application and give it your bot's name.
- Bot tab → Reset Token → copy the bot token.
- OAuth2 tab → Reset Secret → copy the client secret.
- On the setup page, enter the setup code from the start.bat window, paste the token and secret, and press Connect bot.
Casharks Bot checks both values with Discord, reads the client ID from the token, turns on the Server Members and Message Content intents for you, saves everything on your server and starts the bot. The owner of the Discord application (or its team) becomes the instance's admin.
Keep the token and secret private. Anyone who has them can control your bot.
4. Two clicks in Discord
The setup page then shows:
- The login redirect with a copy button. Discord requires you to add this one yourself: open OAuth2 → Redirects, press Add Redirect, paste it and save. It's your address followed by
/api/auth/callback, for examplehttps://your.domain/api/auth/callback. - Add to Discord to invite your bot to a server.
- Open dashboard once the bot is online. Sign in with Discord and turn on the modules you want.
Keep the start.bat window open. Closing it (or running stop.bat) stops the bot.
| Script | What it does |
|---|---|
| install.bat | First-time setup; safe to re-run |
| start.bat | Starts the database, Redis, bot, worker, API, dashboard (and tunnel) |
| stop.bat | Stops everything cleanly |
| update.bat | Installs packages, applies database changes and rebuilds |
| health-check.bat | Checks every part and tells you what's wrong |
| connect-domain.bat | Connects your domain; connect-domain.bat --local undoes it |
Owner settings
Signed in as the bot's owner, open Account to:
- replace the bot token or client secret (for example after resetting them in the developer portal),
- add optional keys under Advanced (each platform lists its steps). You don't need any for Twitch or YouTube messages; they only unlock extras such as subscriber roles.
Values are checked with Discord where possible, stored only on your server and never shown again. Casharks Bot restarts the bot to apply them, which takes about ten seconds.
Run on boot
To start the bot automatically after the VPS restarts, open Task Scheduler → Create Task: trigger At startup, action Start a program → your start.bat, with Start in set to the Casharks folder, and tick Run whether user is logged on or not.
Updating
- Run stop.bat.
- Download the latest zip and extract it over your Casharks folder. Your settings (the
.envfile) and thedatafolder (database, uploads) aren't in the zip, so they're kept. - Run update.bat, then start.bat.
Backups
Everything your bot stores is in the data folder plus the .env file. To back up, run stop.bat and copy both somewhere safe. Server-level backups (roles, channels, settings) are also available per server under Backups in the dashboard.
Linux
The package includes a Docker Compose setup with a reverse proxy and automatic HTTPS. See docs/DEPLOYMENT.md inside the zip. The .bat files are Windows-only.
Troubleshooting
- health-check.bat shows which part is failing and why. Logs for each service are in the
logsfolder. - Lost the setup code: it's also saved in
.casharks/setup-codein the Casharks folder. Restarting start.bat creates a new one. - Login fails / "invalid redirect_uri": the redirect in the developer portal must exactly match your address +
/api/auth/callback. - Bot online but commands missing: global slash commands can take a few minutes after the first start. Invite the bot with the Add to Discord button so it has the
applications.commandsscope. - "Couldn't turn on the intents automatically": bots in 100+ servers need Discord's verification for this. Turn on Server Members and Message Content in Developer Portal → Bot → Privileged Gateway Intents.
- The address isn't port 3000: another program already used it, so Casharks Bot picked the next free one. start.bat shows the address and opens it. Use that address for the login redirect in Discord.
- Two copies on one computer: each copy gets its own ports, database and Redis. Connect each one to a different Discord bot.
- Dashboard unreachable by IP: check ports 3000 and 4000 are open in both Windows Firewall and your provider's firewall.