Self-hosting FlagForge lets you run a fully private CTF platform for your organization, university club, classroom, or invite-only competition. Because FlagForge is open-source under the GPL-3.0 license, you can customize the codebase, control your own data, and deploy it anywhere that runs Node.js.Documentation 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.
Prerequisites
Before you begin, make sure you have the following ready:Node.js 20+
FlagForge requires Node.js 20 or later. Download it from nodejs.org.
npm
npm is bundled with Node.js. Run
npm --version to confirm it’s available.MongoDB instance
You need a MongoDB connection string — either from MongoDB Atlas or a self-hosted cluster.
Google OAuth app
FlagForge uses Google OAuth for sign-in. Create OAuth credentials in the Google Cloud Console.
You need a MongoDB connection string before you can start the server. If you don’t have a MongoDB instance yet, see the database setup guide for step-by-step instructions.
Installation
Clone the repository
Clone the FlagForge repository from GitHub:Then change into the project directory:
Install dependencies
Install all required Node.js packages:This installs Next.js, Mongoose, NextAuth, and all other dependencies listed in
package.json.Configure environment variables
Create a If no
.env file in the project root and populate it with your configuration values:.env.example exists, create a .env file manually. See the environment variables reference for the full list of required and optional variables.At minimum, you must set:Run in development mode
Start the development server with hot reloading:The platform will be available at
http://localhost:3000. The first user to sign in with the email matching NEXT_PUBLIC_ADMIN_EMAIL will receive admin privileges.Production deployment
For production use, Vercel is the recommended platform because FlagForge is a Next.js application and Vercel provides zero-configuration deployments, automatic SSL, and edge caching. To deploy to Vercel:- Push your repository to GitHub.
- Import the repository in your Vercel dashboard.
- Add your environment variables in the Environment Variables section of the project settings.
- Click Deploy.
When deploying to Vercel, set
NEXTAUTH_URL to your production domain (for example, https://ctf.yourdomain.com). Omitting or misconfiguring this variable will break Google OAuth callbacks.npm start.