Skip to content

ttokttokttok/polis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

206 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Polis - AI-Powered Gaming Communities

Polis Logo

The Social Network Where Gaming Communities Come Alive with AI

Node.js MongoDB Redis License

๐Ÿš€ Overview

Polis is a revolutionary social media platform designed specifically for gaming communities. What makes Polis unique is that each community has its own AI personality that can interact with members in real-time. Instead of just mentioning other users with @username, you can mention entire communities with @community.ai and receive intelligent, context-aware responses.

โœจ Key Features

  • ๐Ÿค– Community AI Agents: Each community has a customizable AI that learns from its members and content
  • ๐ŸŽฏ Gaming Integration: Native support for League of Legends, Valorant, TFT, and Brawl Stars
  • ๐Ÿ’ฌ Smart Mentions: Tag communities like @tft.ai or @valorant.ai for instant AI responses
  • ๐Ÿ“น Media Sharing: Share images and videos (up to 25MB) with CloudFront CDN delivery
  • ๐Ÿ† Tournaments: Organize and manage gaming tournaments within communities
  • ๐ŸŽจ Customization: Flairs, skins, and profile customization options
  • โšก Real-time Feed: Echo (repost) system with honor (like) functionality

๐ŸŽฅ Demo

Check out how Polis works: YouTube Demo Video

๐Ÿ› ๏ธ Tech Stack

Backend

  • Node.js - Server runtime
  • Express.js - Web framework
  • MongoDB - Primary database
  • Redis - Caching and session management
  • Mongoose - MongoDB ODM

AI & APIs

  • OpenAI GPT - Powers community AI responses
  • Pinecone - Vector database for AI embeddings
  • Riot Games API - Gaming data integration
  • Brave Search API - Real-time web search for AI

Infrastructure

  • AWS S3 - Media storage
  • CloudFront CDN - Global content delivery
  • SendGrid - Email services
  • Stripe - Payment processing
  • PayPal - Alternative payment method

Frontend

  • Pug - Template engine
  • Vanilla JavaScript - No framework overhead
  • CSS3 - Custom styling
  • Ionicons - Icon library

๐Ÿ“‹ Prerequisites

  • Node.js 18.x or higher
  • MongoDB 6.0 or higher
  • Redis 7.0 or higher
  • AWS Account (for S3 and CloudFront)
  • Various API keys (see Configuration)

๐Ÿ”ง Installation

  1. Clone the repository
git clone https://github.com/yourusername/polis.git
cd polis
  1. Install dependencies
npm install
  1. Set up environment variables Create a config.env file in the root directory with the following:
# Server Configuration
NODE_ENV=development
PORT=8080

# Database Configuration
DATABASE=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>?retryWrites=true
DATABASE_PASSWORD=your_password
DATABASE_NAME_PROD=production
DATABASE_NAME_DEV=development

# Redis Configuration
REDIS_PASSWORD=your_redis_password

# Authentication
JWT_SECRET=your-ultra-secure-jwt-secret
JWT_EXPIRES_IN=90d
JWT_COOKIE_EXPIRES_IN=90

# AI Services
OPEN_AI_KEY=your_openai_api_key
PINECONE_API_KEY=your_pinecone_api_key
BRAVE_SEARCH_API_KEY=your_brave_search_api_key

# AWS Configuration
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_BUCKET_NAME=your_s3_bucket_name

# Gaming APIs
RIOT_API_KEY=your_riot_api_key
LEAGUE_API_KEY=your_league_api_key
VALORANT_API_KEY=your_valorant_api_key
BRAWL_TOKEN=your_brawlstars_token

# Payment Processing
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
PAYPAL_CLIENT_ID=your_paypal_client_id
PAYPAL_CLIENT_SECRET=your_paypal_client_secret

# Email Service
SENDGRID_API_KEY=your_sendgrid_api_key
EMAIL_FROM=your_email@domain.com

# OAuth (Riot Games)
RIOT_CLIENT_ID=your_riot_client_id
RIOT_CLIENT_SECRET=your_riot_client_secret
REDIRECT_URI=https://yourdomain.com/riotCallback
  1. Set up MongoDB
  • Create a MongoDB Atlas cluster or use a local MongoDB instance
  • Update the DATABASE connection string in config.env
  1. Set up Redis
  • Install Redis locally or use a cloud service like Redis Cloud
  • Update REDIS_PASSWORD in config.env
  1. Configure AWS Services
  • Create an S3 bucket for media storage
  • Set up CloudFront distribution pointing to your S3 bucket
  • Update AWS credentials in config.env
  1. Start the application
# Development mode
npm run dev

# Production mode
npm start

๐ŸŽฎ How It Works

Community AI Interaction

  1. Create a Community: Set up a gaming community with its own identity
  2. Train the AI: Add knowledge and personality to your community's AI
  3. Interact: Members can mention the community AI in posts
  4. Get Responses: The AI responds based on its training and context

Example:

User: "@tft.ai what's the best comp for this patch?"
TFT AI: "Based on current meta analysis, Invoker Mythic with Ahri carry is 
performing exceptionally well. Try: Ahri, Tahm Kench, Jax, Shen..."

Media Sharing

  • Upload images (up to 5MB) and videos (up to 25MB, 90 seconds)
  • Automatic CDN delivery through CloudFront
  • Orientation-aware display (portrait/landscape)

๐Ÿ“ Project Structure

polis/
โ”œโ”€โ”€ controllers/       # Route controllers
โ”œโ”€โ”€ models/           # Database models
โ”œโ”€โ”€ routes/           # API routes
โ”œโ”€โ”€ services/         # Business logic (AI, email, etc.)
โ”œโ”€โ”€ public/           # Static files
โ”‚   โ”œโ”€โ”€ js/          # Client-side JavaScript
โ”‚   โ”œโ”€โ”€ css/         # Stylesheets
โ”‚   โ””โ”€โ”€ img/         # Images
โ”œโ”€โ”€ views/           # Pug templates
โ”œโ”€โ”€ utils/           # Helper functions
โ”œโ”€โ”€ app.js           # Express app configuration
โ”œโ”€โ”€ server.js        # Server entry point
โ””โ”€โ”€ config.env       # Environment variables

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Areas for Contribution

  • ๐ŸŽฎ Add support for more games
  • ๐Ÿค– Improve AI response quality
  • ๐ŸŽจ Enhance UI/UX design
  • ๐Ÿ“ฑ Mobile app development
  • ๐Ÿงช Add more tests
  • ๐Ÿ“š Improve documentation
  • ๐Ÿ› Bug fixes

๐Ÿ”’ Security

  • All user passwords are hashed using bcrypt
  • JWT tokens for authentication
  • Rate limiting on API endpoints
  • Input sanitization to prevent XSS attacks
  • MongoDB injection prevention
  • Secure cookie configuration

๐Ÿ“ˆ Performance

  • CloudFront CDN for global content delivery
  • Redis caching for frequently accessed data
  • Optimized database queries with proper indexing
  • Lazy loading for images
  • Video streaming with range request support

๐Ÿ› Known Issues

  • Video upload may timeout on slow connections
  • Some mobile browsers have issues with video playback controls
  • AI responses occasionally timeout under heavy load

๐Ÿ“œ License

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

๐Ÿ‘ฅ Team

  • Your Name - Initial work - GitHub

๐Ÿ™ Acknowledgments

  • Riot Games for their comprehensive gaming APIs
  • OpenAI for GPT integration
  • The gaming community for inspiration
  • All contributors who help improve Polis

๐Ÿ“ž Contact


Made with โค๏ธ for the gaming community

Star โญ this repo if you find it useful!

About

X but every community has their own AI.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages