This is the backend server for managing and validating license keys for CS2 ESP application.
- ✅ RESTful API for key validation
- ✅ Admin panel for key management
- ✅ Support for multiple key types (Day, Week, Month, Lifetime)
- ✅ Hardware ID (HWID) binding to prevent key sharing
- ✅ Automatic expiration tracking
- ✅ SQLite database (easy and portable)
-
Install Node.js (if not already installed):
- Download from https://nodejs.org/
- Use version 16 or higher
-
Install dependencies:
cd key-backend npm install -
Configure server (optional):
- Edit
config.jsto change port, admin credentials, or key durations - IMPORTANT: Change the default admin password!
- Edit
npm startThe server will start on http://localhost:3000 by default.
- Open your browser to
http://localhost:3000 - Log in with credentials from
config.js:- Default username:
admin - Default password:
changeme123(CHANGE THIS!)
- Default username:
- Log in to the admin panel
- Select key type (DAY, WEEK, MONTH, LIFE)
- Enter quantity
- Click "Generate"
- Copy the generated keys
The admin panel allows you to:
- View all generated keys
- See activation status and expiration dates
- Search keys by key value, type, or HWID
- Delete keys
- View statistics (total, active, expired keys)
Validates a key and binds it to a hardware ID.
Request:
{
"key": "CS2-DAY-ABC-123",
"hwid": "hardware-id-string"
}Response (Success):
{
"valid": true,
"message": "Key is valid",
"expiresAt": 1234567890000,
"type": "DAY"
}Response (Failure):
{
"valid": false,
"message": "Error description"
}All admin endpoints require Basic Authentication with username and password.
POST /api/admin/login- Verify credentialsPOST /api/keys/generate- Generate new keysGET /api/keys- List all keysDELETE /api/keys/:key- Delete a keyGET /api/stats- Get statistics
- Day key:
CS2-DAY-XXX-XXX - Week key:
CS2-WEEK-XXX-XXX - Month key:
CS2-MONTH-XXX-XXX - Lifetime key:
CS2-LIFE-XXX-XXX
Where XXX represents 3 random alphanumeric characters.
The server uses SQLite with a file named keys.db in the backend directory.
Schema:
key(TEXT, PRIMARY KEY) - The license keytype(TEXT) - Key type (DAY, WEEK, MONTH, LIFE)created_at(INTEGER) - Unix timestamp of creationexpires_at(INTEGER) - Unix timestamp of expirationactivated_at(INTEGER) - Unix timestamp of first use (NULL if not activated)hwid(TEXT) - Hardware ID bound to this key (NULL if not activated)is_active(INTEGER) - Whether key is active (1) or deactivated (0)
username(TEXT, PRIMARY KEY)password_hash(TEXT) - Bcrypt hash of password
For production deployment:
- Change admin credentials in
config.js - Use a process manager like PM2:
npm install -g pm2 pm2 start server.js --name cs2-key-server pm2 save
- Set up a reverse proxy (nginx) with HTTPS
- Update the C++ client code to point to your production URL
- Consider using environment variables for sensitive config
- Keys are validated server-side, preventing client-side tampering
- HWID binding ensures keys can't be shared between computers
- Admin panel uses Basic Authentication (use HTTPS in production!)
- SQLite is fine for small-to-medium scale; consider PostgreSQL for high traffic
Server won't start:
- Make sure port 3000 is not already in use
- Check that Node.js is installed (
node --version)
Can't log in to admin panel:
- Verify credentials in
config.js - Check browser console for errors
- Ensure server is running
Key validation fails from C++ app:
- Ensure server is running and accessible
- Check firewall settings
- Verify the URL in C++ code matches server address
- Check server logs for errors
MIT License
MIT License
Copyright (c) 2026 Cilliain7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.