Jump to content

1. Database Setup

If you’re hosting on a Pterodactyl panel:
Go to your bot’s panel.

Navigate to Databases → Create New Database.
After it’s created, copy the JDBC Connection String.

Example provided:

jdbc:mysql://host:3306/database?user=username&password=password

Important: Remove the jdbc: prefix.

Modified example:

mysql://username:password@host:3306/database

2. Environment Variables

Step 1: Rename Example File
Rename .env.example → .env

Step 2: Required Variables
Inside .env (or .env.local for local dev), add:

# Database
DATABASE_URL="mysql://username:password@host:3306/database"
# Authentication
NEXTAUTH_SECRET="your_generated_secret"
NEXTAUTH_URL="http://localhost:3000"
# API Keys
API_KEY="your_generated_api_key"
NEXT_PUBLIC_API_KEY="your_generated_api_key"
# Steam API
STEAM_API_KEY="your_steam_api_key"

Step 3: Generate Keys
Run this twice in your terminal:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

First value → NEXTAUTH_SECRET
Second value → both API_KEY and NEXT_PUBLIC_API_KEY

Save your API key separately you’ll need it for your Rust plugin.

Step 4: Steam API Key
Go to Steam Web API Key.
Enter your domain (localhost:3000 for dev).
Copy your API key → STEAM_API_KEY.

3. Database Initialization

Run the following in your project root:

npx prisma generate npx prisma db push node prisma/seed.js

This sets up schema, tables, and default data.

4. Add Your First Admin

Method 1: Prisma Studio (Recommended)

Get your SteamID64 from steamid.io.

Open Prisma Studio:
npx prisma studio

In Admins table → Add:
steamId: your SteamID64
displayName: your display name
ownerId: same as SteamID64
In AdminPermissions table → Add:
adminSteamId: your SteamID64
permissionId: the ID for owner_access

5. Hosting (Vercel)

Go to Vercel → Import Git Repository.
Select your repo → Import.
Under Build & Output Settings → toggle Build Command → set to:

prisma generate && next build

Add your Environment Variables in Vercel dashboard (same as .env). <- do this before you Deploy.
Now Deploy

6. Rust Plugin Setup (Stats.cs)

Copy Stats.cs to your server’s oxide/plugins/ or carbon/plugins folder.

Edit oxide/config/Stats.json:

{

"Web API URL": "https://yourdomain.com",
"Web API Key": "your_api_key_from_env_file",
"Server ID": "your_server_id",
"Batch Interval": 5.0

}

Make sure Web API Key matches the one in your .env.

7. Permissions Reference

Available permissions:

owner_access – full access
view_stats – view player data
manage_admins – manage admins
manage_permissions – manage permissions
view_admin_panel – access admin panel
edit_player_stats – modify stats
delete_player_stats – delete stats
server_management – manage servers
manage_themes – manage themes

8. Troubleshooting

  • Connection errors: ensure you removed jdbc: from DB URL.
  • No admin access: add your SteamID manually in Prisma Studio.
  • Schema mismatch: run
    npx prisma db push
    .
  • No Rust data: verify API URL (don’t include /api/stats) and API Key match.

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
3.1m
Total downloads
Customers
12.1k
Customers served
Files Sold
171.2k
Total sales
Payments
3.7m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.