Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

HackeliteB2/Aegis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

68 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ† AEGIS - Advanced Esports Gaming Intelligence System

License Frontend Backend Database AI Blockchain

A comprehensive, scalable tournament management platform for esports with blockchain verification, AI-powered features, and real-time updates.

🌟 Project Overview

AEGIS is a full-stack tournament management platform designed specifically for esports competitions. It combines modern web technologies with cutting-edge features like blockchain integration for fair draws, AI-powered match summaries, and real-time tournament updates.

🎯 Key Features

  • πŸ† Tournament Management: Complete tournament lifecycle from creation to completion
  • πŸ‘₯ Team Management: Team creation, member management, and statistics tracking
  • βš”οΈ Match Management: Real-time match tracking with automated summaries
  • πŸ” Multi-Role Authentication: Admin, Organizer, Player, and Spectator roles
  • ⛓️ Blockchain Integration: Provably fair tournament draws on Polygon network
  • πŸ€– AI-Powered Features: Match summaries and RAG-enhanced chatbot using Gemini 2.0 Flash
  • ⚑ Real-time Updates: WebSocket integration for live tournament events
  • πŸ“± Responsive Design: Mobile-first approach with Matrix cybersecurity theme

πŸ—οΈ Architecture

Frontend (Next.js 15.4.5)

  • Framework: Next.js with App Router and Turbopack
  • Language: TypeScript for type safety
  • Styling: Tailwind CSS with Matrix theme
  • State Management: TanStack Query for server state
  • Real-time: Socket.io for WebSocket connections

Backend (FastAPI)

  • Framework: FastAPI with Python 3.11+
  • Database: PostgreSQL 15+ with SQLAlchemy
  • Authentication: JWT-based with role-based access control
  • AI Integration: Google Gemini 2.0 Flash for content generation
  • Blockchain: Web3 integration with Polygon network
  • Real-time: WebSocket support for live updates

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ (for frontend)
  • Python 3.11+ (for backend)
  • PostgreSQL 15+ (database)
  • Git (version control)

1. Clone Repository

git clone <repository-url>
cd Aegis

2. Backend Setup

# Navigate to backend directory
cd Backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
copy .env.example .env
# Edit .env file with your configuration:
# - Database credentials (PostgreSQL)
# - API keys (Gemini, SendGrid, LangFuse)
# - Security settings (SECRET_KEY)
# - CORS origins for frontend

# Run backend server
python run.py

Backend will be available at: http://localhost:8001

3. Frontend Setup

# Navigate to frontend directory (in new terminal)
cd Frontend

# Install dependencies
npm install

# Set up environment variables
# Create .env.local file with:
NEXT_PUBLIC_API_URL=http://localhost:8001/api/v1
NEXT_PUBLIC_WS_URL=http://localhost:8001

# Start development server
npm run dev

Frontend will be available at: http://localhost:3003

4. Database Setup

  1. Install PostgreSQL 15+ on your system
  2. Create database and user:
    CREATE DATABASE aegis_db;
    CREATE USER aegis_user WITH ENCRYPTED PASSWORD 'your_password';
    GRANT ALL PRIVILEGES ON DATABASE aegis_db TO aegis_user;
  3. Update .env file with connection details:
    DATABASE_URL=postgresql://aegis_user:your_password@localhost:5432/aegis_db

5. External Services Setup (Optional but Recommended)

AI Services (Gemini 2.0 Flash)

  1. Get API key from Google AI Studio
  2. Add to .env: GEMINI_API_KEY=your_key_here

Email Services (SendGrid)

  1. Sign up at SendGrid
  2. Create API key and verify sender email
  3. Add to .env:
    SENDGRID_API_KEY=your_key_here
    SENDGRID_FROM_EMAIL=noreply@yourdomain.com

Blockchain (Polygon)

  1. Get RPC URL from Polygon or Alchemy
  2. Create Ethereum wallet for tournament operations
  3. Add to .env:
    POLYGON_RPC_URL=https://polygon-rpc.com
    PRIVATE_KEY=your_ethereum_private_key

RAG Chatbot (LangFuse - Optional)

  1. Sign up at LangFuse
  2. Create project and get API keys
  3. Add to .env:
    LANGFUSE_PUBLIC_KEY=your_langfuse_public_key
    LANGFUSE_SECRET_KEY=your_langfuse_secret_key
    LANGFUSE_HOST=https://cloud.langfuse.com

Complete Backend .env Example

# Database Configuration
DATABASE_URL=postgresql://aegis_user:your_password@localhost:5432/aegis_db

# Security
SECRET_KEY=your-super-secret-jwt-key-here-make-it-long-and-secure
ACCESS_TOKEN_EXPIRE_MINUTES=30

# AI Services
GEMINI_API_KEY=your-google-gemini-api-key-here

# Email Services
SENDGRID_API_KEY=your-sendgrid-api-key-here
SENDGRID_FROM_EMAIL=noreply@yourdomain.com

# Blockchain
POLYGON_RPC_URL=https://polygon-rpc.com
PRIVATE_KEY=your-ethereum-private-key-for-blockchain-operations

# CORS Configuration
BACKEND_CORS_ORIGINS=["http://localhost:3000","http://localhost:3003","https://yourdomain.com"]

# App Configuration
APP_NAME=Aegis Backend
DEBUG=True
API_V1_STR=/api/v1

# RAG Chatbot Configuration (Optional)
LANGFUSE_PUBLIC_KEY=your-langfuse-public-key
LANGFUSE_SECRET_KEY=your-langfuse-secret-key
LANGFUSE_HOST=https://cloud.langfuse.com

πŸ“ Project Structure

Aegis/
β”œβ”€β”€ Frontend/                   # Next.js Frontend Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/               # Next.js App Router pages
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ contexts/          # React contexts
β”‚   β”‚   β”œβ”€β”€ lib/               # Utility libraries and API client
β”‚   β”‚   └── types/             # TypeScript type definitions
β”‚   β”œβ”€β”€ public/                # Static assets
β”‚   β”œβ”€β”€ package.json           # Frontend dependencies
β”‚   └── README.md              # Frontend documentation
β”œβ”€β”€ Backend/                    # FastAPI Backend Application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”‚   β”œβ”€β”€ core/              # Core configuration
β”‚   β”‚   β”œβ”€β”€ models/            # Database models
β”‚   β”‚   β”œβ”€β”€ schemas/           # Pydantic schemas
β”‚   β”‚   β”œβ”€β”€ services/          # Business logic
β”‚   β”‚   └── main.py            # FastAPI app initialization
β”‚   β”œβ”€β”€ requirements.txt       # Backend dependencies
β”‚   └── README.md              # Backend documentation
└── README.md                  # This file - Project overview

πŸ”§ Development

Frontend Development

cd Frontend

# Development server with Turbopack
npm run dev

# Production build
npm run build

# Type checking
npm run type-check

# Linting
npm run lint

Backend Development

cd Backend

# Development server
python run.py

# Run with auto-reload
uvicorn app.main:app --reload --port 8001

# API documentation
http://localhost:8001/docs

πŸ“Š API Integration

The system features comprehensive API integration:

  • 76 Backend Endpoints β†’ 156 Frontend API Calls
  • 9 Services with real-time status monitoring
  • RESTful APIs with WebSocket support for real-time features
  • Interactive Documentation available at /docs

Key Service APIs

  • Authentication: Login, registration, user management
  • Tournaments: CRUD operations, registration, draw generation
  • Teams: Team management, invitations, statistics
  • Matches: Scheduling, results, AI summaries
  • Notifications: Real-time alerts and updates
  • Chatbot: RAG-enhanced tournament assistance
  • WebSocket: Live tournament and match updates

πŸ€– AI Features

Gemini 2.0 Flash Integration

  • Advanced Match Summaries: Automated, engaging match narratives
  • Tournament Recaps: Comprehensive tournament analysis
  • RAG Chatbot: Context-aware tournament assistance
  • Safety Mechanisms: Professional content filtering

Chatbot Capabilities

  • Optional Authentication: Works with all user types
  • Context-Aware: Personalized responses based on user role
  • Knowledge Base: Vector database with tournament information
  • Safety First: Scope-based responses with content filtering

⛓️ Blockchain Integration

Polygon Network

  • Provably Fair Draws: Tournament brackets generated on-chain
  • Transparent Results: Immutable tournament data
  • Web3 Integration: Smart contract interactions
  • Chain ID: 137 (Polygon Mainnet)

πŸ” Security Features

Authentication & Authorization

  • JWT-based Authentication: Secure token management
  • Role-based Access Control: Granular permissions
  • Password Security: BCrypt hashing
  • Session Management: Automatic token refresh

Security Measures

  • Input Validation: Zod schemas for all forms
  • CORS Configuration: Secure cross-origin requests
  • Route Protection: Client and server-side guards
  • SQL Injection Prevention: SQLAlchemy ORM protection

πŸ“± User Experience

Matrix Theme Design

  • Dark Aesthetic: Cybersecurity-inspired interface
  • Green Accents: Matrix-style color scheme
  • Responsive Layout: Mobile-first design approach
  • Smooth Animations: Framer Motion transitions

Real-time Features

  • Live Tournament Updates: WebSocket-powered bracket updates
  • Match Score Tracking: Real-time score changes
  • Instant Notifications: Toast alerts and system messages
  • Connection Status: WebSocket health monitoring

πŸ§ͺ Testing

Health Checks

# Backend health
curl http://localhost:8001/api/v1/health

# Service status
curl http://localhost:8001/api/v1/services/status

# Frontend access
curl http://localhost:3003

API Testing

Interactive API documentation is available at:

  • Swagger UI: http://localhost:8001/docs
  • ReDoc: http://localhost:8001/redoc

πŸ”§ Troubleshooting

Environment Setup Issues

Backend Issues

# Database connection error
# Check if PostgreSQL is running and database exists
psql -U postgres -c "SELECT 1;"
createdb aegis_db

# Missing API keys
# Verify all required environment variables are set
python -c "import os; print('GEMINI_API_KEY:', bool(os.getenv('GEMINI_API_KEY')))"

# Port already in use
# Backend automatically tries ports 8001, 8000, 8002
netstat -an | findstr :8001

Frontend Issues

# API connection error
# Verify backend is running and accessible
curl http://localhost:8001/api/v1/health

# Environment variables not loaded
# Check .env.local file exists and has correct format
cat .env.local

# Build errors
# Clear Next.js cache and reinstall
rm -rf .next node_modules package-lock.json
npm install

Common Error Solutions

  1. "Database does not exist"

    CREATE DATABASE aegis_db;
  2. "CORS policy error"

    • Add frontend URL to BACKEND_CORS_ORIGINS in backend .env
  3. "Invalid JWT token"

    • Clear browser localStorage and login again
  4. "Service unavailable"

    • Check if all required API keys are configured

πŸš€ Deployment

Production Environment

  1. Backend: Configure production database and environment variables
  2. Frontend: Build and deploy to static hosting or server
  3. Database: Set up PostgreSQL with proper security
  4. CORS: Configure allowed origins for frontend domain

Production Environment Variables

For production deployment, update the following in your .env files:

Backend Production

  • Set DEBUG=False
  • Use production database URL
  • Configure proper CORS origins
  • Use HTTPS URLs for all services

Frontend Production

  • Update API URLs to production endpoints
  • Remove localhost references
  • Configure proper domain settings

πŸ“ˆ Monitoring & Analytics

System Health

  • Service Status Dashboard: Real-time monitoring in admin panel
  • Database Connectivity: Health check endpoints
  • External Services: Blockchain, AI, and email service status
  • WebSocket Monitoring: Connection health tracking

Performance Metrics

  • API Response Times: FastAPI built-in metrics
  • Database Queries: SQLAlchemy query monitoring
  • Frontend Performance: Next.js built-in analytics
  • Real-time Updates: WebSocket connection tracking

🀝 Contributing

Development Guidelines

  1. Code Quality: Maintain TypeScript strict mode
  2. Testing: Add tests for new features
  3. Documentation: Update README files for changes
  4. Security: Follow security best practices
  5. Style: Maintain consistent code formatting

Getting Started

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.


🎯 Project Status

βœ… Production Ready

Frontend Status:

  • βœ… 76/76 Backend Endpoints integrated
  • βœ… All User Roles implemented with access control
  • βœ… Real-time Features functional with WebSocket
  • βœ… AI Services integrated with Gemini 2.0 Flash
  • βœ… Responsive Design with Matrix theme
  • βœ… Type Safety with comprehensive TypeScript

Backend Status:

  • βœ… 69+ API Endpoints with full CRUD operations
  • βœ… 4/4 External Services verified and operational
  • βœ… Database PostgreSQL 17.5 with optimized schema
  • βœ… AI Integration Gemini 2.0 Flash for advanced features
  • βœ… Blockchain Polygon Mainnet connectivity verified
  • βœ… Security JWT authentication with role-based access

System Integration:

  • βœ… Full-Stack Communication between frontend and backend
  • βœ… Real-time Updates via WebSocket connections
  • βœ… External APIs integrated and tested
  • βœ… Database Operations optimized and secured
  • βœ… Error Handling comprehensive across all layers

πŸš€ Ready for Production Deployment

The AEGIS platform is 100% complete with all core features implemented, tested, and ready for production use. The system provides a comprehensive tournament management solution with modern architecture, security best practices, and cutting-edge features.


Built with ❀️ for the esports community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors