Architecture
The web interface runs alongside the Discord bot in the same application using Tokio’s async runtime:src/main.rs
Rocket Setup
The Rocket server is configured with routes, API endpoints, and template rendering:src/main.rs
Key Components
Template Rendering
The web interface uses Handlebars templates through therocket_dyn_templates crate:
src/web/mod.rs
Cookie-Based Sessions
Authentication is managed through HTTP-only cookies containing JWT tokens:- Tokens are stored in the
tokencookie - Cookies are marked as
secureandhttp_onlyfor security - Token validation happens on every protected route
Available Routes
Public Routes
| Route | Description |
|---|---|
GET / | Home page - shows login status |
GET /login | Login page |
GET /setup | Initial setup page |
Protected Routes (Require Authentication)
| Route | Description | Required Role |
|---|---|---|
GET /verify | Email verification page | User |
GET /reverify | Re-verification page | User |
GET /switch-account | Switch between accounts | User |
GET /admin | Admin dashboard | Admin |
GET /logout | Logout (clears token) | User |
API Routes
| Route | Description |
|---|---|
POST /api/verify/sendMail | Send verification email |
POST /api/verify/checkCode | Verify email code |
GET /api/auth/discord | Initiate Discord OAuth |
GET /api/auth/discord/callback | Discord OAuth callback |
Error Handlers
Custom error pages are provided for common HTTP errors:src/web/mod.rs
Next Steps
Authentication
Learn about JWT tokens, roles, and request guards
Verify Page
Understand email verification flow
Admin Dashboard
Explore admin capabilities
API Reference
View API endpoint documentation