- Clean API Key management interface
- Key balance detection/validation
- Bulk imported keys
- Vast per-site permission system
- Instance-only API Keys
- Passkey/WebAuthn Login
- Global admin configuration
- Simple user management
- Install Bun
- Clone the repo:
git clone https://github.com/VillainsRule/Drain && cd Drain - Prepare for production:
bun prep - Start the production server:
bun start
Note
Bun is required, thanks to the fast file streaming APIs and built-in proxy support.
To enable passkeys, you can additionally run bun initpk and edit the file onscreen.
The core administrator account is named "admin" with the user ID "1". admin has access to all sites and all users. admin cannot be demoted or deleted. Only admin can change the admin account password. admin has access to all sites, forever. It is worth nothing that admin's access derives from its user ID (1) as opposed to the username, which can be changed with bun cli/tools/renameAdmin.
admin's default password is "admin". Change it immediately after your first login in the users button at the top right. If you accidentally forget the "admin" password, run bun cli/tools/resetAdmin to reset it back to "admin".
If you manually change any database files while Drain is running, Drain will automatically overwrite your changes. Turn off Drain to do any manual database changes.
There are two main concepts in Drain: users and sites. Users are people who can log into the Drain instance. Sites are collections of API keys with specific permissions.
Users are manually assigned to individual sites by site admins. Users start with no site access.
Users can have 3 levels of access to Drain:
- normal - their access to sites is managed per-site by admins
- site admin - they can see all sites and manage user access on all sites, as well as create users, change their passwords, delete them, and change their site access level. (admins can only change their own passwords or delete themselves)
- "admin" user - they are immune to the above management by "site admins", and have full access to everything. they are the ONLY admin that cannot be demoted by other admins or have its password changed by other admins.
This implementation is amazing for those with trust issues.
