Skip to content

eldarcodes/elcast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PRs Welcome GitHub license

Elcast

Elcast is a dynamic livestreaming platform where users can discover and engage with content across gaming, entertainment, sports, music, and more. With a diverse range of channels and interactive experiences, Elcast offers something for every viewer and creator.

πŸš€ Features

  • πŸ” Authentication & Authorization – Users can sign up, log in, and manage their accounts.
  • βœ‰οΈ Mails – Users can verify their email and receive mails for authentication, TOTP, and other security actions.
  • πŸ”‘ Password Recovery – Easily reset passwords via email.
  • 🚫 Account Deactivation – Users can deactivate their accounts if needed.
  • πŸ€– Telegram Integration – Users can connect their Telegram account to the Elcast Bot to receive security notifications alongside email alerts.
  • πŸŽ₯ Live Streaming – Start and watch live streams in real time.
  • πŸ’¬ Chat System – Integrated live chat for viewers and streamers.
  • πŸ“Ί Channel Management – Users can customize their streaming channels.
  • ⭐ Follow System – Follow favorite streamers and get notified about their streams.
  • πŸ”” Notifications – Users can receive different live notifications.
  • πŸ” TOTP Authentication – Additional security with Time-based One-Time Password (TOTP) authentication.
  • πŸ–₯️ Session Management – Users can view all active sessions, see their locations (based on IP), and terminate them if needed.
  • πŸ” Stream Categories & Tags – Easily discover content by browsing different categories.
  • 🌍 i18n Support – Available in Russian and English for a localized experience.
  • πŸŒ™ Dark Mode – Seamless UI experience with light/dark mode toggle.

Structure

Codebase Description
Server NestJS GraphQL API
Client NextJS Client

Branches

  • main - The primary development branch. All new features, bug fixes, and improvements are merged here after code review and testing. This branch should always be in a deployable state.
  • production - The stable branch that reflects the live/production environment. Only thoroughly tested and approved changes from main are merged here before deployment.

Tech Stack

Server: A backend service built with NestJS, utilizing GraphQL, Prisma, Redis, and other essential technologies.

Client: A frontend web application developed using Next.js, React, Apollo Client, and Tailwind CSS.

Package manager: pnpm

Server (Backend)

  • Framework: NestJS
  • Language: TypeScript
  • Database ORM: Prisma
  • Database: PostgreSQL
  • GraphQL Server: Apollo Server with NestJS
  • Session Management: Redis
  • File Storage: AWS S3
  • Email Service: Nodemailer

Scripts

  • start - Start the production server
  • start:dev - Start the development server with hot reload
  • db:push - Push database schema changes
  • db:seed - Seed the database
  • db:studio - Open Prisma Studio for database management
  • lint, format - Code quality and formatting scripts

Client (Frontend)

  • Framework: Next.js
  • Language: TypeScript
  • State Management: Zustand
  • GraphQL Client: Apollo Client
  • Styling: shadcn/ui, Tailwind CSS
  • Forms & Validation: React Hook Form, Zod
  • Realtime: LiveKit for interactive streaming
  • Internationalization: next-intl

Scripts

  • dev - Start the development server
  • build - Build for production
  • start - Start the production server
  • codegen - Generate GraphQL types
  • lint, format - Code quality and formatting scripts

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

Server

General Configuration

  • NODE_ENV – Defines the environment (development or production).
  • APPLICATION_PORT – Port on which the backend server runs.
  • APPLICATION_URL – Base URL of the backend.
  • ALLOWED_ORIGIN – Defines allowed origin for CORS.
  • GRAPHQL_PREFIX – API prefix for GraphQL endpoints.

Session & Authentication

  • COOKIES_SECRET – Secret for encrypting cookies.
  • SESSION_SECRET – Secret for signing sessions.
  • SESSION_NAME – Name of the session cookie.
  • SESSION_DOMAIN – Domain where session cookies are valid.
  • SESSION_MAX_AGE – Session expiration time.
  • SESSION_HTTP_ONLY – Whether the session cookie is HTTP-only.
  • SESSION_SECURE – Whether the session cookie requires HTTPS.
  • SESSION_FOLDER – Directory for storing session files in Redis.

Database

  • POSTGRES_URI – Connection string for PostgreSQL.
  • REDIS_URI – Connection string for Redis.

Email Configuration

  • MAIL_HOST – Mail server host.
  • MAIL_PORT – Mail server port.
  • MAIL_LOGIN – Mail server login.
  • MAIL_PASSWORD – Mail server password.

S3 Storage

  • S3_ENDPOINT – URL for the S3 storage provider.
  • S3_REGION – AWS region for S3.
  • S3_ACCESS_KEY_ID – Access key ID for S3.
  • S3_SECRET_ACCESS_KEY – Secret access key for S3.
  • S3_BUCKET_NAME – Name of the S3 bucket.

LiveKit

  • LIVEKIT_API_URL – API endpoint for LiveKit.
  • LIVEKIT_API_KEY – API key for LiveKit.
  • LIVEKIT_API_SECRET – API secret for LiveKit.

Telegram

  • TELEGRAM_BOT_TOKEN – API token for the Telegram bot.

Client

  • NEXT_PUBLIC_SERVER_URL – URL for the GraphQL API.
  • NEXT_PUBLIC_MEDIA_URL – URL for accessing media files. (S3 Storage)
  • NEXT_PUBLIC_TELEGRAM_BOT_URL – Telegram bot link for Elcast.
  • NEXT_PUBLIC_LIVEKIT_WS_URL – WebSocket URL for LiveKit.
  • NEXT_PUBLIC_WEBSOCKET_URL – WebSocket URL for GraphQL subscriptions.
  • NEXT_PUBLIC_APP_URL – Base URL of the frontend application.

Run Locally

Clone the project

  git clone https://github.com/eldarcodes/elcast.git

  cd elcast

Setup server

  • Go to the project directory
  cd apps/api
  • Install dependencies
  pnpm install
  • Create an environment file
  cp .env.example .env
  • Start PostgreSQL and Redis using Docker
  docker-compose up -d
  • Run Prisma migrations (apply database schema changes):
  pnpm prisma migrate dev
  • Seed database if needed
  pnpm run db:seed
  • Start the API in development mode
  pnpm run start:dev

Setup client

  • Go to the project directory
  cd apps/web
  • Install dependencies
  pnpm install
  • Create an environment file
  cp .env.example .env
  • Start client in development mode
  pnpm run dev

Contributing

Contributions are always welcome!

Elcast is open to contributions, but I recommend creating an issue or leaving a comment to share what you're working on first to avoid conflicts.

Authors

License

MIT

About

πŸ“Ί A streaming platform offering interactive live content.

Topics

Resources

License

Stars

Watchers

Forks

Languages