AY.com Svelte Themes

Ay.com

AY.com is a Twitter-like social media platform with communities, threads, real-time chat, and AI-powered content moderation. Built using a microservices architecture with Go and gRPC, Svelte + TypeScript frontend, PostgreSQL/Redis, Docker, and a Python ML service for sentiment analysis.

AY.com - Social Media Platform

AY.com is a modern social media platform inspired by X (Twitter), built with microservices architecture using cutting-edge technologies.

๐Ÿ“‹ Table of Contents

โœจ Key Features

  • ๐Ÿ” Authentication & Authorization - Register, login, JWT token management
  • ๐Ÿ‘ฅ Community Management - Create and manage communities like subreddit/forum
  • ๐Ÿ’ฌ Real-time Chat - Instant communication using WebSocket
  • ๐Ÿ“ Thread & Posts - Create, edit, and share posts with comments
  • ๐Ÿท๏ธ Category System - Content organization by categories
  • ๐Ÿค– AI Content Moderation - Harmful message detection using ML
  • ๐Ÿ”– Bookmark - Save favorite posts
  • ๐Ÿ‘ค User Profiles - Complete user profile management
  • ๐ŸŒ™ Dark/Light Theme - Customizable theme

๐Ÿ›  Technologies

Backend

  • Go - Core microservices
  • gRPC - Inter-service communication
  • Python/Flask - AI Service for content moderation
  • PostgreSQL - Primary database
  • Redis - Caching & real-time features
  • Docker - Containerization
  • Protocol Buffers - Data serialization

Frontend

  • Svelte 5 - Modern reactive framework
  • TypeScript - Type-safe JavaScript
  • Vite - Fast build tool
  • Axios - HTTP client
  • Svelte SPA Router - Client-side routing

AI/ML

  • scikit-learn - Machine learning
  • TF-IDF - Text vectorization
  • Sentiment Analysis - Content classification

๐Ÿ”Œ Microservices

  1. Auth Service (Port: 50051)

    • User registration & authentication
    • JWT token generation & validation
    • Email verification
    • Password recovery
  2. Community Service (Port: 50055)

    • Community CRUD operations
    • Member management
    • Community discovery
  3. Chat Service (Port: 50052)

    • Real-time messaging
    • Chat rooms
    • Message history
  4. Thread Service (Port: 50054)

    • Post creation & management
    • Comments & replies
    • Vote system
  5. Category Service (Port: 50053)

    • Category management
    • Content organization
  6. AI Service (Port: 5001)

    • Harmful content detection
    • Sentiment analysis
    • Content moderation
  7. API Gateway (Port: 8080)

    • Request routing
    • Authentication middleware
    • WebSocket connections
    • Swagger documentation

๐Ÿ“ฆ Prerequisites

Make sure you have installed:

  • Docker (v20.10+) & Docker Compose (v2.0+)
  • Go (v1.21+) - if you want development without Docker
  • Node.js (v18+) & npm - for frontend development
  • Python (v3.9+) - for AI service development

๐Ÿš€ Installation & Setup

1. Clone Repository

git clone https://github.com/yourusername/AY.com.git
cd AY.com

2. Setup Environment Variables

Backend Services

Create .env file in backend/ folder:

# Database
POSTGRES_USER=ay_user
POSTGRES_PASSWORD=ay_password
POSTGRES_DB=ay_auth_db

# JWT
JWT_SECRET=your-super-secret-jwt-key

# Services
AUTH_SERVICE_URL=auth-service:50051
CATEGORY_SERVICE_URL=category-service:50053
CHAT_SERVICE_URL=chat-service:50052
THREAD_SERVICE_URL=thread-service:50054
COMMUNITY_SERVICE_URL=community-service:50055
AI_SERVICE_URL=http://ai-service:5000

Frontend

Create .env file in frontend/ folder:

VITE_API_URL=http://localhost:8080
VITE_WS_URL=ws://localhost:8080

3. Setup AI Model

cd backend/ai-service
# Model is already available in model/ folder
# If you need to retrain, run the notebook:
jupyter notebook AYSentimentAnalysis.ipynb

๐Ÿƒ Running the Application

Backend Services

cd backend
docker-compose up -d

Services will run on:

  • PostgreSQL: localhost:5432
  • PgAdmin: http://localhost:5050
  • API Gateway: http://localhost:8080
  • Auth Service: localhost:50051
  • Community Service: localhost:50055
  • Chat Service: localhost:50052
  • Thread Service: localhost:50054
  • Category Service: localhost:50053
  • AI Service: http://localhost:5001

Frontend

cd frontend
npm install
npm run dev

Frontend will run on: http://localhost:5173

Development Mode (Without Docker)

Backend Services

  1. Start PostgreSQL
docker run -d \
  --name postgres \
  -e POSTGRES_USER=ay_user \
  -e POSTGRES_PASSWORD=ay_password \
  -e POSTGRES_DB=ay_auth_db \
  -p 5432:5432 \
  postgres:15
  1. Run Services
# Auth Service
cd backend/auth-service
go run main.go

# Category Service
cd backend/category-service
go run main.go handler.go

# Community Service
cd backend/community-service
go run main.go

# Thread Service
cd backend/thread-service
go run main.go

# Chat Service
cd backend/chat-service
go run main.go

# AI Service
cd backend/ai-service
pip install -r requirements.txt
python app/main.py

# API Gateway
cd backend/api-gateway
go run main.go models.go

๐Ÿ“š API Documentation

After running API Gateway, access Swagger documentation at:

http://localhost:8080/swagger/index.html

Main Endpoints

Authentication

  • POST /register - Register new user
  • POST /login - Login user
  • POST /logout - Logout user
  • GET /profile - Get user profile

Communities

  • GET /communities - List all communities
  • POST /communities - Create new community
  • GET /communities/{id} - Get community detail
  • PUT /communities/{id} - Update community
  • DELETE /communities/{id} - Delete community

Threads

  • GET /threads - List threads
  • POST /threads - Create new thread
  • GET /threads/{id} - Get thread detail
  • POST /threads/{id}/comments - Add comment

Chat

  • GET /chats - List chat rooms
  • POST /chats - Create chat room
  • WS /ws/chat - WebSocket connection

AI Moderation

  • POST /ai/predict - Check harmful content

๐Ÿ“ Project Structure

AY.com/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ docker-compose.yml
โ”‚   โ”œโ”€โ”€ auth-service/          # Authentication & user management
โ”‚   โ”œโ”€โ”€ category-service/      # Category management
โ”‚   โ”œโ”€โ”€ chat-service/          # Real-time chat
โ”‚   โ”œโ”€โ”€ community-service/     # Community features
โ”‚   โ”œโ”€โ”€ thread-service/        # Posts & threads
โ”‚   โ”œโ”€โ”€ ai-service/            # AI content moderation
โ”‚   โ””โ”€โ”€ api-gateway/           # API Gateway & routing
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/        # Svelte components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/            # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ libs/             # Utilities & helpers
โ”‚   โ”‚   โ”œโ”€โ”€ store/            # State management
โ”‚   โ”‚   โ””โ”€โ”€ types/            # TypeScript types
โ”‚   โ”œโ”€โ”€ public/               # Static assets
โ”‚   โ””โ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿงช Testing

Backend

cd backend/[service-name]
go test ./...

Frontend

cd frontend
npm run check
npm run lint

๐Ÿ”จ Production Build

Backend

cd backend
docker-compose -f docker-compose.prod.yml up -d --build

Frontend

cd frontend
npm run build
# Output will be in the dist/ folder

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork this 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. Create a Pull Request

๐Ÿ“ License

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

๐Ÿ‘ฅ Team

Developed with โค๏ธ by WEB-ED-242 Team

๐Ÿ“ž Contact & Support


Happy Coding! ๐Ÿš€ "# AY.com"

Top categories

Loading Svelte Themes