A modern Capture The Flag (CTF) competition platform built with Next.js, Supabase, and Tailwind CSS. Designed for hosting cybersecurity competitions, training sessions, and workshops with real-time scoring, multi-event support, and team management.
TDCTF provides a complete platform for running Jeopardy-style CTF competitions. It handles challenge distribution, real-time flag verification, dynamic scoring, and live scoreboards for both individual and team participation.
- Challenge Engine: Multi-category challenges (Web, Reverse, Binary Exploitation, Cryptography, Forensics, OSINT, etc.) with dynamic score decay based on solve count.
- Real-Time Scoreboard: Instant leaderboard updates powered by Supabase real-time channels, supporting both individual competitors and team rankings.
- Multi-Event Management: Create and isolate multiple CTF events on a single platform instance with individual timelines and scoreboards.
- Team Collaboration: Team creation, invite links, join approvals, and member role management.
- Dynamic Challenge Services: Integration with TDCTL for provisioning ephemeral on-demand challenge containers.
- Administration & Moderation: In-app management for challenges, announcements, audit logging, first-blood alerts, and user roles.
- Authentication: Email/password authentication and Google OAuth support with optional Cloudflare Turnstile verification.
- Framework: Next.js 14 (App Router / Pages)
- Database & Auth: Supabase (PostgreSQL, Row Level Security, Realtime, Auth)
- UI & Styling: Tailwind CSS, Radix UI / Shadcn, Framer Motion
- Analytics & Graphs: Chart.js
- Container Orchestration (Optional): TDCTL
- Node.js 18.x or higher
- npm 9.x or higher
- A Supabase account and project
Clone the repository and install dependencies:
git clone https://github.com/farishhz/TDCTF.git
cd TDCTF
npm install- Create a new project in the Supabase Dashboard.
- Execute your database schema and RPC functions in the Supabase SQL Editor.
- In your Supabase Dashboard under Authentication > URL Configuration:
- Set Site URL to
http://localhost:3000(or your production domain). - Configure your redirect URLs accordingly.
- Set Site URL to
Create a .env.local file in the root directory:
# Required Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-supabase-anon-key
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Optional Configurations
# NEXT_PUBLIC_TURNSTILE_SITE_KEY=your_cloudflare_turnstile_site_key
# TDCTL_API_URL=http://localhost:8000
# TDCTL_API_TOKEN=your_tdctl_token
# NEXT_PUBLIC_MAINTENANCE_MODE=noStart the local development server:
npm run devThe application will be accessible at http://localhost:3000.
- Register a new account via the platform's sign-up page (
/register). - Open your Supabase Dashboard and navigate to the
userstable. - Locate your user record and set the
admincolumn totrue. - Refresh the application to access the Admin dashboard.
To synchronize database TypeScript definitions with your remote Supabase instance:
npm run update-types <your-project-ref>For a local Supabase CLI instance:
npm run update-types:localPlatform settings can be adjusted directly in src/config.ts:
export const APP = {
shortName: "TDCTF",
fullName: "TDCTF Platform",
description: "Capture The Flag Competition Platform",
flagFormat: "TDCTF{...}",
challengeCategories: [
"Web Exploitation",
"Cryptography",
"Reverse Engineering",
"Binary Exploitation",
"Forensics",
"OSINT",
"Miscellaneous"
],
teams: {
enabled: true,
hideScoreboardIndividual: false,
hideScoreboardTotal: false,
},
hideEventMain: false,
eventMainLabel: "main",
};- Push your repository to GitHub.
- Import the project in the Vercel Dashboard.
- Set the required environment variables:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYNEXT_PUBLIC_SITE_URL
- Deploy the application.
| Command | Description |
|---|---|
npm run dev |
Starts the Next.js development server |
npm run build |
Compiles the production build |
npm run start |
Starts the production server |
npm run lint |
Runs ESLint checks |
npm run update-types |
Generates TypeScript types from remote Supabase |
This project is licensed under the Apache License 2.0. See the LICENSE file for details.