FlagForge reads its configuration from environment variables at startup. You define these variables in aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/flagForgeCTF/flagForge/llms.txt
Use this file to discover all available pages before exploring further.
.env file at the root of the project. Some variables are required for the platform to start at all; others unlock optional integrations like Discord notifications, a Notion-powered blog, or Statsig feature flags.
Create your .env file
Create a.env file in the project root:
Required variables
MONGO_URL
The MongoDB connection string used by Mongoose to connect to your database.
NEXTAUTH_URL
The full canonical URL of your FlagForge deployment, including the scheme. NextAuth uses this to construct OAuth callback URLs.
/api/auth/callback/google.
NEXTAUTH_SECRET
A random secret string used by NextAuth to sign and verify JWT session tokens. Generate one with:
GOOGLE_CLIENT_ID
The OAuth 2.0 client ID from your Google Cloud Console project. FlagForge uses Google as its sole authentication provider.
- Go to APIs & Services → Credentials in the Google Cloud Console.
- Create an OAuth 2.0 Client ID for a web application.
- Add
{NEXTAUTH_URL}/api/auth/callback/googleas an authorized redirect URI.
GOOGLE_CLIENT_SECRET
The OAuth 2.0 client secret paired with GOOGLE_CLIENT_ID.
GOOGLE_CLIENT_ID in the Google Cloud Console.
NEXT_PUBLIC_ADMIN_EMAIL
The email address of the initial admin user. When a user signs in with Google for the first time and their email matches this value, FlagForge assigns them the Admin role in the database.
Because this variable is prefixed with
NEXT_PUBLIC_, it is embedded in the client-side bundle at build time. Set it to a real admin email before building for production. After the admin account is created in the database, you can manage admin roles directly from the admin dashboard.Optional variables
NEXT_PUBLIC_ADMIN_PASSWORD
An optional admin password field. This is read at the application level and may be used for additional admin verification flows in certain configurations.
FLAG_SALT
A secret salt string used when generating TEAM_HASH dynamic flags. FlagForge computes per-user flags as SHA256(FLAG_SALT + userId + questionId), so this value must be kept secret to prevent players from predicting other users’ flags.
TEAM_HASH. It has no effect on GUID, LEET, or CLEET flag types or on static flags.
DISCORD_WEBHOOK_URL
A Discord incoming webhook URL. When set, FlagForge posts a notification to the specified channel when new challenges are published.
NOTION_API_KEY
A Notion integration API key, used to pull blog posts or resources content from a Notion database into FlagForge.
NOTION_DATABASE_ID
The ID of the Notion database that contains your blog or resources content. You can find the database ID in the URL when you open the database in Notion:
NOTION_API_KEY and NOTION_DATABASE_ID must be set for Notion integration to work.