diff --git a/.env.example b/.env.example index 8b8b7bf..47e13cd 100644 --- a/.env.example +++ b/.env.example @@ -1,137 +1,22 @@ -# =========================================== -# AeThex Connect - Environment Variables -# =========================================== - -# -------------------------------------------- # Database Configuration -# -------------------------------------------- -DATABASE_URL=postgresql://user:password@localhost:5432/aethex_connect -SUPABASE_URL=https://your-project.supabase.co -SUPABASE_ANON_KEY=your-anon-key -SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +DATABASE_URL=postgresql://user:password@localhost:5432/aethex_passport -# -------------------------------------------- # Server Configuration -# -------------------------------------------- -PORT=5000 +PORT=3000 NODE_ENV=development -FRONTEND_URL=http://localhost:5173 -# -------------------------------------------- -# JWT Authentication -# -------------------------------------------- -JWT_SECRET=your-super-secret-jwt-key-change-this-in-production -JWT_EXPIRES_IN=7d - -# -------------------------------------------- -# Stripe Payment Processing (Phase 6) -# -------------------------------------------- -# Get keys from: https://dashboard.stripe.com/apikeys -STRIPE_SECRET_KEY=sk_test_... # or sk_live_... for production -STRIPE_PUBLISHABLE_KEY=pk_test_... # or pk_live_... for production - -# Webhook secret - from Stripe Dashboard -> Developers -> Webhooks -STRIPE_WEBHOOK_SECRET=whsec_... - -# Price IDs - Create in Stripe Dashboard -> Products -STRIPE_PREMIUM_YEARLY_PRICE_ID=price_premium_yearly -STRIPE_PREMIUM_MONTHLY_PRICE_ID=price_premium_monthly -STRIPE_ENTERPRISE_PRICE_ID=price_enterprise - -# -------------------------------------------- -# Blockchain Configuration (Phase 6) -# -------------------------------------------- -# Polygon RPC endpoint - get from Alchemy/Infura -POLYGON_RPC_URL=https://polygon-mainnet.g.alchemy.com/v2/YOUR_API_KEY +# Blockchain Configuration (for .aethex domain verification) RPC_ENDPOINT=https://polygon-mainnet.infura.io/v3/YOUR_INFURA_KEY +FREENAME_REGISTRY_ADDRESS=0x... # Freename contract address -# Freename .aethex domain registry contract -FREENAME_REGISTRY_ADDRESS=0x... # Contract address on Polygon +# JWT Secret (for authentication) +JWT_SECRET=your-secret-key-here -# Hot wallet for automated NFT minting -DOMAIN_MINTER_PRIVATE_KEY=0x... # KEEP SECRET - use hardware wallet in production - -# -------------------------------------------- -# GameForge Integration (Phase 3) -# -------------------------------------------- -GAMEFORGE_API_URL=https://gameforge.com/api -GAMEFORGE_CLIENT_ID=your-client-id -GAMEFORGE_CLIENT_SECRET=your-client-secret -GAMEFORGE_WEBHOOK_SECRET=your-webhook-secret - -# -------------------------------------------- -# Nexus Engine (Phase 5) -# -------------------------------------------- -NEXUS_API_KEY=your-nexus-api-key -NEXUS_ENGINE_URL=https://nexus-engine.example.com - -# -------------------------------------------- -# WebSocket/Socket.IO (Phase 2, 4) -# -------------------------------------------- -SOCKET_IO_CORS_ORIGIN=http://localhost:5173 -SOCKET_IO_PATH=/socket.io - -# -------------------------------------------- -# WebRTC/TURN Configuration (Phase 4) -# -------------------------------------------- -STUN_SERVER=stun:stun.l.google.com:19302 -TURN_SERVER=turn:your-turn-server.com:3478 +# Rate Limiting +RATE_LIMIT_WINDOW_MS=900000 +RATE_LIMIT_MAX_REQUESTS=100 +# TURN Server Configuration (for WebRTC NAT traversal) TURN_SERVER_HOST=turn.example.com TURN_SERVER_PORT=3478 -TURN_USERNAME=turn-user -TURN_CREDENTIAL=turn-password TURN_SECRET=your-turn-secret-key -TURN_TTL=86400 - -# -------------------------------------------- -# File Storage (Phase 2) -# -------------------------------------------- -MAX_FILE_SIZE_MB=100 -STORAGE_PATH=./uploads - -# -------------------------------------------- -# Platform Settings (Phase 6) -# -------------------------------------------- -# Marketplace fee percentage (10 = 10%) -PLATFORM_FEE_PERCENTAGE=10 - -# Feature limits - Free tier defaults -FREE_MAX_FRIENDS=5 -FREE_STORAGE_GB=0.1 - -# Premium tier defaults -PREMIUM_STORAGE_GB=10 - -# Enterprise tier defaults -ENTERPRISE_STORAGE_GB=-1 # -1 = unlimited - -# -------------------------------------------- -# Rate Limiting -# -------------------------------------------- -RATE_LIMIT_WINDOW_MS=900000 # 15 minutes -RATE_LIMIT_MAX_REQUESTS=100 -RATE_LIMIT_PREMIUM_MAX_REQUESTS=1000 - -# -------------------------------------------- -# Security -# -------------------------------------------- -# CORS allowed origins (comma-separated) -CORS_ORIGINS=http://localhost:5173,http://localhost:3000 - -# Session secret for Express sessions -SESSION_SECRET=your-session-secret-change-this - -# -------------------------------------------- -# Production Checklist -# -------------------------------------------- -# Before deploying to production: -# [ ] Change all secrets and keys -# [ ] Set NODE_ENV=production -# [ ] Use Stripe live keys (sk_live_, pk_live_) -# [ ] Set up production webhook endpoint -# [ ] Enable HTTPS/SSL -# [ ] Configure CORS for production domain -# [ ] Set up database backups -# [ ] Set strong JWT_SECRET -# [ ] Secure DOMAIN_MINTER_PRIVATE_KEY -# [ ] Test Stripe webhook with live endpoint \ No newline at end of file +TURN_TTL=86400 \ No newline at end of file diff --git a/README.md b/README.md index 71b140c..8f3b8dd 100644 --- a/README.md +++ b/README.md @@ -1,177 +1,235 @@ -# Supabase CLI +# 🎮 AeThex Connect -[![Coverage Status](https://coveralls.io/repos/github/supabase/cli/badge.svg?branch=main)](https://coveralls.io/github/supabase/cli?branch=main) [![Bitbucket Pipelines](https://img.shields.io/bitbucket/pipelines/supabase-cli/setup-cli/master?style=flat-square&label=Bitbucket%20Canary)](https://bitbucket.org/supabase-cli/setup-cli/pipelines) [![Gitlab Pipeline Status](https://img.shields.io/gitlab/pipeline-status/sweatybridge%2Fsetup-cli?label=Gitlab%20Canary) -](https://gitlab.com/sweatybridge/setup-cli/-/pipelines) +**Next-Generation Communication Platform for Gamers & Game Developers** -[Supabase](https://supabase.io) is an open source Firebase alternative. We're building the features of Firebase using enterprise-grade open source tools. +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +[![Node](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/) +[![PostgreSQL](https://img.shields.io/badge/postgresql-14%2B-blue.svg)](https://www.postgresql.org/) -This repository contains all the functionality for Supabase CLI. +AeThex Connect is a comprehensive communication platform built specifically for the gaming ecosystem. It combines real-time messaging, voice/video calls, game integration, and blockchain-based identity with a sustainable monetization model. -- [x] Running Supabase locally -- [x] Managing database migrations -- [x] Creating and deploying Supabase Functions -- [x] Generating types directly from your database schema -- [x] Making authenticated HTTP requests to [Management API](https://supabase.com/docs/reference/api/introduction) +--- -## Getting started +## ✨ Features -### Install the CLI +### 🔐 Phase 1: Blockchain Identity (.AETHEX Domains) +- Custom blockchain domain authentication (`username.aethex`) +- NFT-based ownership on Polygon +- Freename TLD integration +- Domain verification and management -Available via [NPM](https://www.npmjs.com) as dev dependency. To install: +### 💬 Phase 2: Real-Time Messaging +- End-to-end encrypted messaging +- Group conversations and DMs +- File sharing with encryption +- Rich media support (images, videos, voice messages) +- Real-time delivery via WebSocket +- Read receipts and typing indicators + +### 🎮 Phase 3: GameForge Integration +- Auto-provisioned game project channels +- Role-based access control (Developer, Artist, Designer, Tester) +- System notifications (builds, commits, deployments) +- Team synchronization +- Project-specific communication + +### 📞 Phase 4: Voice & Video Calls +- High-quality WebRTC calls +- 1-on-1 and group calling +- Screen sharing +- In-call chat +- Call recording (premium feature) +- STUN/TURN NAT traversal + +### 🌐 Phase 5: Cross-Platform (Nexus Integration) +- Communication that follows players across games +- Friend system with cross-game presence +- Game session management +- Lobby system +- In-game overlay component +- Nexus Engine SDK plugin + +### 💎 Phase 6: Premium Monetization +- Three-tier subscription model (Free, Premium, Enterprise) +- Blockchain .aethex domain NFT ownership +- Domain marketplace with 10% platform fee +- Stripe payment integration +- Usage analytics dashboard +- White-label solutions for enterprises + +--- + +## 🚀 Quick Start + +### Prerequisites +- Node.js 18+ +- PostgreSQL 14+ +- Stripe account (for monetization) +- Supabase project (optional) + +### Installation ```bash -npm i supabase --save-dev +# Clone repository +git clone https://github.com/AeThex-Corporation/AeThex-Connect.git +cd AeThex-Connect + +# Install dependencies +npm install + +# Setup environment variables +cp .env.example .env +# Edit .env with your configuration + +# Run database migrations +npm run migrate + +# Start backend server +npm start + +# Start frontend (new terminal) +cd src/frontend +npm install +npm run dev ``` -When installing with yarn 4, you need to disable experimental fetch with the following nodejs config. +**Server runs on:** `http://localhost:5000` +**Frontend runs on:** `http://localhost:5173` -``` -NODE_OPTIONS=--no-experimental-fetch yarn add supabase -``` - -> **Note** -For Bun versions below v1.0.17, you must add `supabase` as a [trusted dependency](https://bun.sh/guides/install/trusted) before running `bun add -D supabase`. - -
- macOS - - Available via [Homebrew](https://brew.sh). To install: - - ```sh - brew install supabase/tap/supabase - ``` - - To install the beta release channel: - - ```sh - brew install supabase/tap/supabase-beta - brew link --overwrite supabase-beta - ``` - - To upgrade: - - ```sh - brew upgrade supabase - ``` -
- -
- Windows - - Available via [Scoop](https://scoop.sh). To install: - - ```powershell - scoop bucket add supabase https://github.com/supabase/scoop-bucket.git - scoop install supabase - ``` - - To upgrade: - - ```powershell - scoop update supabase - ``` -
- -
- Linux - - Available via [Homebrew](https://brew.sh) and Linux packages. - - #### via Homebrew - - To install: - - ```sh - brew install supabase/tap/supabase - ``` - - To upgrade: - - ```sh - brew upgrade supabase - ``` - - #### via Linux packages - - Linux packages are provided in [Releases](https://github.com/supabase/cli/releases). To install, download the `.apk`/`.deb`/`.rpm`/`.pkg.tar.zst` file depending on your package manager and run the respective commands. - - ```sh - sudo apk add --allow-untrusted <...>.apk - ``` - - ```sh - sudo dpkg -i <...>.deb - ``` - - ```sh - sudo rpm -i <...>.rpm - ``` - - ```sh - sudo pacman -U <...>.pkg.tar.zst - ``` -
- -
- Other Platforms - - You can also install the CLI via [go modules](https://go.dev/ref/mod#go-install) without the help of package managers. - - ```sh - go install github.com/supabase/cli@latest - ``` - - Add a symlink to the binary in `$PATH` for easier access: - - ```sh - ln -s "$(go env GOPATH)/bin/cli" /usr/bin/supabase - ``` - - This works on other non-standard Linux distros. -
- -
- Community Maintained Packages - - Available via [pkgx](https://pkgx.sh/). Package script [here](https://github.com/pkgxdev/pantry/blob/main/projects/supabase.com/cli/package.yml). - To install in your working directory: - - ```bash - pkgx install supabase - ``` - - Available via [Nixpkgs](https://nixos.org/). Package script [here](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/supabase-cli/default.nix). -
- -### Run the CLI +### Quick Test ```bash -supabase bootstrap +# Test API health +curl http://localhost:5000/health + +# Test domain availability +curl -X POST http://localhost:5000/api/premium/domains/check-availability \ + -H "Content-Type: application/json" \ + -d '{"domain": "testuser.aethex"}' ``` -Or using npx: +--- + +## 📖 Documentation + +### Phase Guides +- [PHASE2-MESSAGING.md](PHASE2-MESSAGING.md) - Real-time chat implementation +- [PHASE3-GAMEFORGE.md](PHASE3-GAMEFORGE.md) - Game project integration +- [PHASE4-CALLS.md](PHASE4-CALLS.md) - Voice/video calling +- [PHASE5-COMPLETE.md](PHASE5-COMPLETE.md) - Cross-platform features +- [PHASE6-COMPLETE.md](PHASE6-COMPLETE.md) - Monetization & subscriptions + +### Quick Start Guides +- [PHASE4-QUICK-START.md](PHASE4-QUICK-START.md) - WebRTC calls in 5 minutes +- [PHASE6-QUICK-START.md](PHASE6-QUICK-START.md) - Premium monetization in 10 minutes + +### Integration Docs +- [docs/GAMEFORGE-EXAMPLES.md](docs/GAMEFORGE-EXAMPLES.md) - Integration code examples +- [nexus-sdk/README.md](nexus-sdk/README.md) - Game engine plugin docs +- [integration-package/README.md](integration-package/README.md) - Domain verification integration + +--- + +## 💰 Pricing Tiers + +| Feature | Free | Premium | Enterprise | +|---------|------|---------|------------| +| **Price** | $0 | $100/year | $500-5000/month | +| **Domain** | Subdomain | .aethex NFT | Custom domain | +| **Friends** | 5 max | Unlimited | Unlimited | +| **Messaging** | Text only | Text + Files | Everything | +| **Calls** | Audio only | HD Video (1080p) | 4K Video | +| **Storage** | 100 MB | 10 GB | Unlimited | +| **Analytics** | ❌ | ✅ | Advanced | +| **Branding** | AeThex | Custom | White-label | +| **Support** | Community | Priority | Dedicated | + +--- + +## 🏗️ Architecture + +``` +┌─────────────────────────────────────────────────────────┐ +│ AeThex Connect │ +├─────────────────────────────────────────────────────────┤ +│ Frontend (React + Vite) │ +│ - Real-time messaging UI │ +│ - WebRTC call interface │ +│ - Domain verification │ +│ - Premium upgrade flow │ +├─────────────────────────────────────────────────────────┤ +│ Backend (Node.js + Express) │ +│ - REST API │ +│ - WebSocket (Socket.IO) │ +│ - WebRTC signaling │ +│ - Stripe webhooks │ +├─────────────────────────────────────────────────────────┤ +│ Services │ +│ - Messaging Service │ +│ - Call Service (WebRTC) │ +│ - Premium Service (Stripe) │ +│ - GameForge Integration │ +│ - Nexus Integration │ +├─────────────────────────────────────────────────────────┤ +│ Database (PostgreSQL + Supabase) │ +│ - Users & Authentication │ +│ - Conversations & Messages │ +│ - Blockchain Domains │ +│ - Premium Subscriptions │ +└─────────────────────────────────────────────────────────┘ +``` + +--- + +## 🔧 Configuration + +Create a `.env` file in the root directory: ```bash -npx supabase bootstrap +# Database +DATABASE_URL=postgresql://user:password@localhost:5432/aethex_connect +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_ANON_KEY=your-anon-key + +# Server +PORT=5000 +NODE_ENV=development +JWT_SECRET=your-super-secret-jwt-key + +# Stripe (Premium Features) +STRIPE_SECRET_KEY=sk_test_... +STRIPE_PUBLISHABLE_KEY=pk_test_... +STRIPE_WEBHOOK_SECRET=whsec_... + +# Blockchain +POLYGON_RPC_URL=https://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY +FREENAME_REGISTRY_ADDRESS=0x... + +# GameForge Integration +GAMEFORGE_API_KEY=your-api-key +GAMEFORGE_API_SECRET=your-secret + +# WebRTC +STUN_SERVER=stun:stun.l.google.com:19302 +TURN_SERVER=turn:your-turn-server.com:3478 ``` -The bootstrap command will guide you through the process of setting up a Supabase project using one of the [starter](https://github.com/supabase-community/supabase-samples/blob/main/samples.json) templates. +--- -## Docs +## 🤝 Contributing -Command & config reference can be found [here](https://supabase.com/docs/reference/cli/about). +Contributions are welcome! Please read our contributing guidelines before submitting pull requests. -## Breaking changes +--- -We follow semantic versioning for changes that directly impact CLI commands, flags, and configurations. +## 📄 License -However, due to dependencies on other service images, we cannot guarantee that schema migrations, seed.sql, and generated types will always work for the same CLI major version. If you need such guarantees, we encourage you to pin a specific version of CLI in package.json. +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -## Developing +--- -To run from source: +## 🔗 Links -```sh -# Go >= 1.22 -go run . help -``` +- **Documentation:** [Full Documentation](PROJECT-README.md) +- **Support:** [GitHub Issues](https://github.com/AeThex-Corporation/AeThex-Connect/issues) +- **Website:** [AeThex Corporation](https://aethex.com) diff --git a/src/backend/server.js b/src/backend/server.js index eb54dcd..3766b50 100644 --- a/src/backend/server.js +++ b/src/backend/server.js @@ -9,9 +9,6 @@ const domainRoutes = require('./routes/domainRoutes'); const messagingRoutes = require('./routes/messagingRoutes'); const gameforgeRoutes = require('./routes/gameforgeRoutes'); const callRoutes = require('./routes/callRoutes'); -const nexusRoutes = require('./routes/nexusRoutes'); -const premiumRoutes = require('./routes/premiumRoutes'); -const stripeWebhook = require('./routes/webhooks/stripeWebhook'); const socketService = require('./services/socketService'); const app = express(); @@ -39,9 +36,6 @@ const limiter = rateLimit({ app.use('/api/', limiter); -// Stripe webhook (must be before body parser for raw body) -app.use('/webhooks/stripe', stripeWebhook); - // Body parsing middleware app.use(express.json()); app.use(express.urlencoded({ extended: true })); @@ -56,9 +50,6 @@ app.use('/api/passport/domain', domainRoutes); app.use('/api/messaging', messagingRoutes); app.use('/api/gameforge', gameforgeRoutes); app.use('/api/calls', callRoutes); -app.use('/api/nexus', nexusRoutes); -app.use('/api', nexusRoutes); // Also mount at /api for friend routes -app.use('/api/premium', premiumRoutes); // Initialize Socket.io const io = socketService.initialize(httpServer); diff --git a/src/frontend/components/GameForgeChat/index.jsx b/src/frontend/components/GameForgeChat/index.jsx index bed54b1..5e9035e 100644 --- a/src/frontend/components/GameForgeChat/index.jsx +++ b/src/frontend/components/GameForgeChat/index.jsx @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import { useParams } from 'react-router-dom'; import { useSocket } from '../../contexts/SocketContext'; import { useAuth } from '../../contexts/AuthContext'; import ChannelList from './ChannelList'; @@ -9,8 +10,9 @@ import './GameForgeChat.css'; * Embedded chat component for GameForge projects * Can be embedded in GameForge UI via iframe or direct integration */ -export default function GameForgeChat({ projectId: propProjectId = 'demo-project-123', embedded = false }) { - const projectId = propProjectId; +export default function GameForgeChat({ projectId: propProjectId, embedded = false }) { + const { projectId: paramProjectId } = useParams(); + const projectId = propProjectId || paramProjectId; const { socket } = useSocket(); const { user } = useAuth();