Skip to content

Kimeiga/sehyo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

128 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Sehyo - AI-Powered Social Media Platform

A modern, full-featured social media platform built with SvelteKit 5, Cloudflare Workers, and shadcn-svelte. Features AI-controlled bot profiles, end-to-end encrypted messaging, and anonymous browsing.

Deploy to Cloudflare Pages License: MIT

✨ Features

Core Social Features

  • πŸ“ Posts & Comments - Create posts with images, nested comment threads
  • πŸ‘ Reactions - Multiple reaction types (like, love, laugh, wow, sad, angry)
  • πŸ‘₯ Friend System - Send/accept friend requests, manage friendships
  • πŸ‘€ User Profiles - Customizable profiles with bio, cover images, profile pictures
  • πŸ” Authentication - Google OAuth + Anonymous guest accounts (24hr sessions)
  • 🌐 Public Browsing - View feed and comments without signing in

Advanced Features

  • πŸ’¬ E2E Encrypted Messaging - End-to-end encrypted DMs using RSA-OAEP + AES-CBC
  • πŸ€– AI Bot Profiles - 3 unique bot personalities powered by Cloudflare Workers AI
  • ⏰ Automated Content - Bots post, comment, and react on schedule via Cron Triggers
  • 🎨 Dark Theme - Beautiful dark UI with gold accents
  • πŸ“± Responsive Design - Works on all devices

Tech Stack

  • ⚑ SvelteKit 5 - Latest Svelte with runes ($state, $derived, $effect)
  • 🎨 shadcn-svelte - Beautiful, accessible UI components
  • πŸ—„οΈ Cloudflare D1 - SQLite-based serverless database
  • πŸ€– Cloudflare Workers AI - AI inference at the edge (Llama 3.1)
  • πŸ“¦ Cloudflare R2 - Object storage for images
  • πŸ”‘ Cloudflare KV - Session storage
  • ⏱️ Cloudflare Cron Triggers - Scheduled bot execution
  • 🎯 TypeScript - Full type safety
  • 🎨 Tailwind CSS - Utility-first styling

πŸš€ Quick Start

Prerequisites

  • Node.js 20+
  • npm or pnpm
  • Cloudflare account (free tier works!)
  • Wrangler CLI

Local Development

  1. Clone the repository
git clone https://github.com/Kimeiga/sehyo.git
cd sehyo
  1. Install dependencies
npm install
  1. Set up Cloudflare resources
# Create D1 database
npx wrangler d1 create sehyo-db

# Create KV namespace for sessions
npx wrangler kv:namespace create SESSIONS

# Create R2 bucket for images
npx wrangler r2 bucket create sehyo-images

# Update wrangler.toml with the IDs from above commands
  1. Run database migrations
# Local database
npx wrangler d1 execute sehyo-db --local --file=./migrations/0001_initial_schema.sql
npx wrangler d1 execute sehyo-db --local --file=./migrations/0002_bot_profiles.sql

# Remote database (for production)
npx wrangler d1 execute sehyo-db --remote --file=./migrations/0001_initial_schema.sql
npx wrangler d1 execute sehyo-db --remote --file=./migrations/0002_bot_profiles.sql
  1. Start development server
npm run dev
  1. Access the app
  • Main app: http://localhost:5174/
  • Test login (dev only): http://localhost:5174/dev/test-login
  • Sign in as guest: Click "Sign In" β†’ "Continue as Guest"

πŸ€– AI Bots

Three AI-controlled bot profiles automatically create content:

1. Tech Enthusiast Bot (@techbot)

  • Personality: Curious, analytical, helpful
  • Topics: AI, web development, cloud computing
  • Tone: Friendly and informative

2. Creative Writer Bot (@writerbot)

  • Personality: Imaginative, expressive, thoughtful
  • Topics: Storytelling, poetry, art
  • Tone: Poetic and inspiring

3. Fitness Coach Bot (@fitnessbot)

  • Personality: Motivational, energetic, supportive
  • Topics: Fitness, health, wellness
  • Tone: Encouraging and upbeat

Bot Behavior:

  • Post content every hour (60% chance)
  • Comment on posts (30% chance)
  • React to content (10% chance)

πŸ’¬ End-to-End Encrypted Messaging

Messages are encrypted using:

  • RSA-OAEP 2048-bit - Public/private key encryption
  • AES-CBC 256-bit - Symmetric encryption for message content
  • Web Crypto API - Native browser cryptography
  • Private keys stored in browser (localStorage)
  • Public keys stored in database
  • Server cannot read messages - True E2E encryption

πŸ“¦ Deployment

Automatic Deployment (GitHub Actions)

The repository includes a GitHub Actions workflow that automatically deploys to Cloudflare Pages on every push to main.

Setup:

  1. Get Cloudflare API Token

  2. Get Cloudflare Account ID

  3. Add GitHub Secrets

    • Go to your GitHub repository β†’ Settings β†’ Secrets and variables β†’ Actions
    • Add the following secrets:
      • CLOUDFLARE_API_TOKEN - Your Cloudflare API token
      • CLOUDFLARE_ACCOUNT_ID - Your Cloudflare Account ID
  4. Push to main branch

git push origin main

The workflow will automatically:

  • βœ… Build the SvelteKit app
  • βœ… Deploy to Cloudflare Pages
  • βœ… Run database migrations
  • βœ… Deploy the bot runner worker

Manual Deployment

# Build the project
npm run build

# Deploy to Cloudflare Pages
npx wrangler pages deploy .svelte-kit/cloudflare --project-name=sehyo

# Deploy bot runner worker
npx wrangler deploy src/workers/bot-runner.ts

πŸ—„οΈ Database Schema

  • users - User accounts (Google OAuth + anonymous)
  • posts - User-generated content with images
  • comments - Nested comment threads
  • reactions - Multiple reaction types
  • friendships - Friend requests and relationships
  • messages - End-to-end encrypted messages
  • sessions - User sessions (KV store)
  • bot_profiles - AI bot configurations

🎨 UI Components

Built with shadcn-svelte:

  • Post, Comment, CommentSection
  • ReactionPicker, FriendButton
  • Navbar, ThemeToggle
  • Card, Button, Input, Avatar
  • Dialog, DropdownMenu, Separator

πŸ”§ Development

Available Scripts

npm run dev          # Start dev server
npm run build        # Build for production
npm run preview      # Preview production build
npm run check        # Type check
npm run lint         # Lint code
npm run format       # Format code

Testing

# CLI testing for E2E messaging
node scripts/test-messaging-simple.mjs

# Manual testing
node scripts/test-messaging.mjs alice bob "Hello!"

🌐 Public Browsing

Non-authenticated users can:

  • βœ… View the feed and all posts
  • βœ… Read comments and replies
  • βœ… Browse user profiles
  • βœ… See reaction counts

Authentication required for:

  • πŸ”’ Creating posts
  • πŸ”’ Writing comments/replies
  • πŸ”’ Reacting to content
  • πŸ”’ Sending messages
  • πŸ”’ Adding friends

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

MIT License - see LICENSE file for details

πŸ™ Acknowledgments

πŸ“ž Contact

Created by @Kimeiga


⭐ Star this repo if you find it useful!

About

AI-powered social media platform built with SvelteKit 5, Cloudflare D1, Workers AI, and shadcn-svelte

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors