How muhammadtalha15/ctf_platform works
This is a web-based CTF learning platform. Users register or sign in, browse challenges, submit flags, and track their profile, points, and leaderboard standing; administrators manage challenges, users, and announcements. Express mounts the domain routers, which query PostgreSQL and render EJS pages. The excerpts establish challenge submission transactions and several user/admin database operations; unsampled route details are represented only at the router level, without inferred internal links.
Main entry points: app.js Express application · db.js PostgreSQL pool · auth.js Authentication routes · challenges.js Challenge routes
Components 13
Web runtime
- HTTP server
server.js - Express application
app.js - Browser interactions
public/js/app.js - EJS pages
views
Identity and access
- Authentication routes
routes/auth.js - Access middleware
midleware/auth.js
CTF experience
- Challenge routes
routes/challenges.js - User routes
routes/user.js
Administration
- Admin routes
routes/admin.js
Persistent state
- PostgreSQL pool
config/db.js - PostgreSQL database
- JSON data files
data
Other components
- Visitor
Connections 21
- Visitor → Browser interactions: uses
- Browser interactions → HTTP server: HTTP requests
- HTTP server → Express application: starts and seeds
- Express application → Authentication routes: mounts routes
- Express application → Challenge routes: mounts routes
- Express application → User routes: mounts routes
- Express application → Admin routes: mounts routes
- Express application → JSON data files: reads home data
- Authentication routes → Access middleware: checks forward auth
- Challenge routes → Access middleware: checks authentication
- User routes → Access middleware: checks authentication
- Admin routes → Access middleware: checks admin role
- Authentication routes → PostgreSQL pool: queries users
- Challenge routes → PostgreSQL pool: reads and records solves
- User routes → PostgreSQL pool: queries user data
- Admin routes → PostgreSQL pool: manages platform data
- PostgreSQL pool → PostgreSQL database: queries
- Authentication routes → EJS pages: renders auth pages
- Challenge routes → EJS pages: renders challenge pages
- User routes → EJS pages: renders user pages
- Admin routes → EJS pages: renders admin pages