AETHEX Project - Complete Technical Stack Analysis

Executive Summary

This document provides a comprehensive analysis of the AETHEX project's actual technical stack, comparing it against the development plan and identifying implementation status for all components.


1. FRONTEND STACK (Vercel)

Current Implementation

  • Framework: Vite + React (Custom architecture)

  • NOT Next.js - This is a significant difference from the development plan

  • Build Tool: Vite for fast development and optimized production builds

  • Hosting: Vercel

  • UI Builder Integration: Builder.io visual editor

  • Authentication Client: Custom Supabase client (NOT @supabase/ssr)

Architecture Components

Page Structure

code/client/pages/
├── Auth Pages
│   ├── Login.tsx (Email, GitHub, Google, Roblox, Discord OAuth)
│   ├── Onboarding.tsx (Multi-step creator setup)
│   └── ResetPassword.tsx

├── Main Application
│   ├── Dashboard.tsx
│   ├── Profile.tsx
│   └── Admin.tsx (Discord management, role mappings, metrics)

├── ARM Pages (6 arms)
│   ├── Labs.tsx (Yellow - Research & Development)
│   ├── GameForge.tsx (Green - Game Development)
│   ├── Corp.tsx (Blue - Enterprise Solutions)
│   ├── Foundation.tsx (Red - Community & Education)
│   ├── DevLink.tsx (Cyan - Roblox Professional Network)
│   └── Nexus.tsx (Purple - Talent Marketplace)

├���─ Creator Network
│   ├── creators/CreatorDirectory.tsx (Browse creators by arm)
│   ├── creators/CreatorProfile.tsx (Individual creator page)
│   ├── opportunities/OpportunitiesHub.tsx (Job board)
│   └── opportunities/OpportunityDetail.tsx (Individual opportunity)

└── Discord Integration
    ├── DiscordVerify.tsx (Verification code linking)
    ├── DiscordActivity.tsx (Activity page - WIP)
    └── Activity.tsx (Activity dashboard - WIP)

Context Providers

Key Components

Authentication Methods Supported

  1. Email/Password (Native Supabase)

  2. GitHub OAuth (Supabase)

  3. Google OAuth (Supabase)

  4. Roblox OAuth (Custom implementation)

  5. Discord OAuth (New - just implemented)

  6. Web3/Ethereum (Metamask signature verification)

Critical Notes on Frontend

  • ✅ Uses custom Supabase client (NOT the new @supabase/ssr package)

  • ⚠️ Does NOT use Next.js App Router or middleware

  • ⚠️ CSP headers need configuration in Vite for Discord Activity

  • ✅ Builder.io visual editor integration working

  • ✅ Mobile-responsive with full-screen modal arm switcher


2. BACKEND STACK (Supabase + Vercel Functions)

Database (PostgreSQL via Supabase)

Core Tables

Discord Integration Tables

Creator Network Tables

Web3 Integration

Game Integration

Row Level Security (RLS) Status

Current State: Basic RLS policies implemented

Status: ⚠️ NOT YET OPTIMIZED (Plan recommends performance optimization)

API Endpoints (Code in Vercel Functions)

Location: code/api/ directory

Discord OAuth

  • code/api/discord/oauth/start.ts - GET endpoint, redirects to Discord

  • code/api/discord/oauth/callback.ts - GET endpoint, handles OAuth callback

Discord Linking & Verification

  • code/api/discord/verify-code.ts - POST, verifies 6-digit code from /verify command

  • code/api/discord/link.ts - POST, links Discord account to user

Discord Management

  • code/api/discord/role-mappings.ts - GET/POST/PUT/DELETE role mapping CRUD

  • code/api/discord/sync-roles.ts - POST, assigns Discord roles based on arm + user_type

  • code/api/discord/admin-register-commands.ts - POST, registers slash commands (requires admin token)

  • code/api/discord/interactions.ts - POST, handles Discord slash command interactions

  • code/api/discord/verify.ts - POST, checks if user is linked to Discord

Creator Network

  • code/api/creators.ts - GET/POST/PUT, manage creator profiles

  • code/api/opportunities.ts - GET/POST/PUT, manage job opportunities

  • code/api/applications.ts - GET/POST/PUT/DELETE, manage job applications

Game Integration

  • code/api/games/game-auth.ts - POST, unified game authentication (Unity/Unreal/Godot/Roblox)

  • code/api/games/roblox-auth.ts - POST, Roblox-specific authentication

  • code/api/games/verify-token.ts - POST, verify game session tokens

Other

  • code/api/user/link-roblox.ts - POST, link Roblox account

  • code/api/user/link-web3.ts - POST, link Ethereum wallet

  • code/api/web3/nonce.ts - POST, generate Web3 nonce

  • code/api/web3/verify.ts - POST, verify Web3 signature

Backend Server (Express.js)

Location: code/server/index.ts

Responsibilities:

  • Discord slash command handlers (/creators, /opportunities, /nexus)

  • Discord interactions endpoint (signature verification)

  • Health check endpoints

  • Site settings management

  • Admin functions

Key Features:

  • ED25519 signature verification for Discord requests

  • Slash command routing

  • Admin token validation (DISCORD_ADMIN_REGISTER_TOKEN)

  • Token diagnostic endpoint (/api/discord/diagnostic)


3. DISCORD BOT STACK (Railway)

Current Deployment

  • Platform: Railway (PaaS)

  • Language: Node.js with discord.js v14

  • Hosting Status: ✅ Successfully deployed and running

  • Repository: code/discord-bot/ directory

Bot Configuration

Implemented Slash Commands

1. /verify (Account Linking)

  • File: code/discord-bot/commands/verify.js

  • Function: Generates 15-minute verification code

  • Flow:

    1. User runs /verify

    2. Bot generates code and stores in discord_verifications table

    3. User receives code + link to /profile/link-discord?code=XXX

    4. User verifies code on website

    5. discord_links record created

2. /set-realm (Choose Primary Arm)

  • File: code/discord-bot/commands/set-realm.js

  • Function: Dropdown menu to select primary arm

  • Options: labs, gameforge, corp, foundation, devlink, nexus

  • Flow:

    1. Updates discord_links.primary_arm

    2. Triggers role assignment via roleManager.js

3. /profile (Show Profile)

  • File: code/discord-bot/commands/profile.js

  • Function: Displays linked AeThex profile in Discord

  • Shows: Username, bio, avatar, primary realm, link to full profile

  • File: code/discord-bot/commands/unlink.js

  • Function: Removes Discord link and revokes roles

5. /verify-role (Check Assigned Roles)

  • File: code/discord-bot/commands/verify-role.js

  • Function: Shows current Discord roles and expected roles from mappings

Supporting Utilities

Dependencies

Environment Variables

Bot Health Check

  • Endpoint: POST /health

  • Returns: { status, guilds, commands, uptime, timestamp }

  • Used by: Frontend /api/discord/bot-health proxy


4. DISCORD INTEGRATION LAYER

OAuth Flow (User Signup/Login with Discord)

Discord Manifest

Location: code/public/discord-manifest.json


5. PLANNED vs. ACTUAL - KEY DIFFERENCES

Development Plan Says... | Actually Have... | Status


6. ENVIRONMENT VARIABLES (All Set)

Supabase

Discord OAuth

Roblox OAuth

Web3

API Base


7. WHAT'S PRODUCTION-READY ✅

  • ✅ Supabase backend with 15+ tables and RLS

  • ✅ Vite + React frontend on Vercel

  • ✅ 6 arm pages with full styling

  • ✅ Creator network (creators, opportunities, applications)

  • ✅ Discord OAuth login

  • ✅ Discord account linking (verification code)

  • ✅ Discord bot on Railway (5 slash commands)

  • ✅ Admin panel with Discord role mappings

  • ✅ Mobile responsive (full-screen arm switcher)

  • ✅ Web3/Ethereum wallet linking

  • ✅ Roblox OAuth integration

  • ✅ Game integration APIs (Unity/Unreal/Godot/Roblox)


8. WHAT NEEDS WORK ⏳

  1. CSP Headers for Discord Activity

    • Status: ⏳ NEEDS FIX

    • Action: Add to vite.config.ts and vercel.json

    • Priority: HIGH

  2. Discord Embedded App SDK (Dual Auth)

    • Status: ⏳ PARTIALLY DONE

    • Action: Implement full dual-auth flow in DiscordActivity.tsx

    • Priority: MEDIUM

  3. RLS Policy Optimization

    • Status: ✅ WORKS, CAN OPTIMIZE

    • Action: Wrap auth.uid() in (select auth.uid()) for performance

    • Priority: LOW

  4. GitHub Actions CI/CD

    • Status: ⏳ NOT IMPLEMENTED

    • Action: Create .github/workflows/deploy-supabase.yml

    • Priority: MEDIUM

  5. Mobile Arm Switcher Modal

    • Status: ✅ COMPLETED

    • Shows full-screen modal on mobile < 768px width

    • Back button and Proceed button functional


9. QUICK REFERENCE - FILE LOCATIONS


10. DEPLOYMENT CHECKLIST

Frontend (Vercel)

Backend (Supabase)

Bot (Railway)

Discord Developer Portal


CONCLUSION

The AETHEX project is ~75% production-ready. The core architecture differs from the development plan (Vite+React instead of Next.js), but the implementation is solid and functional. The main work ahead is:

  1. Configuring CSP headers for Discord Activity

  2. Implementing the full Embedded App SDK dual-auth flow

  3. Setting up CI/CD automation

  4. Minor performance optimizations to RLS policies

All critical functionality (auth, Discord, creator network, bot) is working and tested.

Last updated