Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ CIRCLE_USDC_TOKEN_ID=15dc2b5d-0994-58b0-bf8c-3a0501148ee8

# Misc
ADMIN_EMAIL=admin@admin.com
ADMIN_PASSWORD=your-secure-admin-password
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ ADMIN_EMAIL=admin@admin.com

### Admin Account

On first startup, an admin user is automatically created with the following credentials:
On first startup, an admin user is automatically created using the credentials
defined in your `.env.local` file:

- **Email:** `admin@admin.com`
- **Password:** `123456`
- **Email:** The value of `ADMIN_EMAIL` (defaults to `admin@admin.com`)
- **Password:** The value of `ADMIN_PASSWORD` (**required** — the app will not
create the admin account if this is not set)

The admin account has access to the **Admin Dashboard**, which provides an overview of all users, wallets, and transactions in the system.

Expand Down
13 changes: 10 additions & 3 deletions lib/supabase/initialize-admin-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ const createAdminUserIfNotExists = async () => {
return;
}

const adminEmail = "admin@admin.com";
const adminPassword = "123456";
const adminEmail = process.env.ADMIN_EMAIL ?? "admin@admin.com";
const adminPassword = process.env.ADMIN_PASSWORD;

if (!adminPassword) {
console.error(
"❌ ADMIN_PASSWORD environment variable is not set. Skipping admin user creation."
);
return;
}

// We call our custom database function via RPC (Remote Procedure Call).
// This is a single, fast, and scalable database query.
Expand Down Expand Up @@ -112,4 +119,4 @@ const createAdminUserIfNotExists = async () => {

// This is the key: we call the function immediately.
// When this file is imported, this function will run.
createAdminUserIfNotExists();
createAdminUserIfNotExists();