A modern Capture The Flag (CTF) platform built with Next.js, React, and PostgreSQL.
- User authentication (email/password + GitHub)
- Team management
- Challenge categories (web, crypto, forensics, etc.)
- Real-time scoreboard
- Flag submission and validation
- Admin panel for challenge management
- Markdown support for challenge descriptions
- File attachments for challenges
- Hints system
- Mobile-responsive design
- Frontend: Next.js 14 + React + Tailwind CSS
- Backend: Next.js API Routes
- Authentication: NextAuth.js
- Database: PostgreSQL with Prisma ORM
- Real-time: Socket.IO
- Hosting: Vercel (frontend & backend) + Railway (PostgreSQL)
- DevOps: Docker + GitHub Actions
- Node.js 18+
- PostgreSQL 14+
- Docker (optional)
- GitHub account (for OAuth)
-
Clone the repository:
https://github.com/stringuers/CTF-Platform.git cd CTF-Platform -
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Fill in the required environment variables in
.env. -
Set up the database:
npx prisma migrate dev
-
Run the development server:
npm run dev
The application will be available at http://localhost:3000.
-
Build the Docker image:
docker build -t CTF-Platform . -
Run the container:
docker run -p 3000:3000 CTF-Platform
- Set up a PostgreSQL database on Railway
- Deploy the application to Vercel
- Configure environment variables in Vercel
- Set up GitHub Actions secrets for CI/CD
src/
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ ├── auth/ # Authentication pages
│ ├── challenges/ # Challenge pages
│ └── scoreboard/ # Scoreboard page
├── components/ # React components
├── lib/ # Utility functions
└── types/ # TypeScript types
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLintnpm test- Run testsnpm run prisma:generate- Generate Prisma clientnpm run prisma:migrate- Run database migrations
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.