Skip to content

Repository files navigation

πŸ”₯ Real-Time Ephemeral Chat System

License Next.js React TypeScript

A secure, real-time chat application with self-destructing rooms built using Next.js, TypeScript, and Upstash services.

🌟 Features

  • πŸ”’ Ephemeral Messaging: Chat rooms automatically destroy themselves after use
  • ⚑ Real-time Communication: Powered by Upstash Realtime
  • πŸ›‘οΈ Anonymous Chat: No user registration required - temporary identities
  • πŸ“± Responsive Design: Works seamlessly across all devices
  • 🎨 Modern UI: Clean, dark-themed interface with Tailwind CSS
  • πŸ“¦ Type Safety: Full TypeScript support throughout
  • ⚑ Fast Performance: Optimized with Next.js 16 and React Server Components

πŸš€ Tech Stack

πŸ“‹ Prerequisites

  • Node.js 18+ or Bun
  • npm, yarn, pnpm, or bun package manager
  • Upstash account (for Redis and Realtime services)

πŸ—οΈ Environment Variables

This project requires several environment variables to function properly. These variables configure connections to external services and control various aspects of the application.

Required Services

  1. Upstash Redis - For storing chat room data and session information
  2. Upstash Realtime - For real-time messaging functionality

Setting up Environment Variables

  1. Create a .env.local file in the project root directory
  2. Add the following variables:
# Upstash Redis Configuration
UPSTASH_REDIS_REST_URL=your_redis_rest_url
UPSTASH_REDIS_REST_TOKEN=your_redis_rest_token

# Upstash Realtime Configuration  
UPSTASH_REALTIME_URL=your_realtime_url
UPSTASH_REALTIME_TOKEN=your_realtime_token

# Application Settings
NEXT_PUBLIC_APP_URL=http://localhost:3000
ROOM_EXPIRY_TIME=3600  # Room expiry time in seconds

How to Obtain Service Credentials

Upstash Redis

  1. Sign up at Upstash Console
  2. Create a new Redis database
  3. Copy the REST URL and token from the database dashboard
  4. Add them to your environment variables as UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN

Upstash Realtime

  1. In your Upstash console, navigate to the Realtime section
  2. Create a new Realtime database
  3. Copy the URL and token from the database dashboard
  4. Add them to your environment variables as UPSTASH_REALTIME_URL and UPSTASH_REALTIME_TOKEN

Note: Never commit your .env.local file to version control. It's already included in the .gitignore file.

πŸ› οΈ Installation

  1. Clone the repository

    git clone https://github.com/x0lg0n/Real-Time-Ephemeral-Chat-System
    cd real-time-ephemeral-chat-system
  2. Install dependencies

    # Using npm
    npm install
    
    # Using yarn
    yarn install
    
    # Using pnpm
    pnpm install
    
    # Using bun
    bun install
  3. Environment Setup

    Create a .env.local file in the root directory:

    # Upstash Redis Configuration
    UPSTASH_REDIS_REST_URL=your_redis_rest_url
    UPSTASH_REDIS_REST_TOKEN=your_redis_rest_token
    
    # Upstash Realtime Configuration
    UPSTASH_REALTIME_URL=your_realtime_url
    UPSTASH_REALTIME_TOKEN=your_realtime_token
    
    # Application Settings
    NEXT_PUBLIC_APP_URL=http://localhost:3000
    ROOM_EXPIRY_TIME=3600  # Room expiry time in seconds
  4. Run the development server

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
    # or
    bun dev
  5. Open your browser Navigate to http://localhost:3000

πŸ“– Usage

  1. Create a Chat Room

    • Visit the homepage
    • Your temporary identity will be generated automatically
    • Click "CREATE SECURE ROOM" to start a new chat session
  2. Share the Room

    • Copy the room URL and share it with participants
    • Anyone with the link can join the chat
  3. Chat Features

    • Real-time messaging between participants
    • Messages are encrypted in transit
    • Room automatically expires after the set time period
    • All messages are permanently deleted when the room expires
  4. Room Expiry

    • Rooms automatically self-destruct after the configured time
    • All data is permanently removed from the system
    • No data retention beyond room lifetime

πŸ—οΈ Project Structure

real-time-ephemeral-chat-system/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js app router
β”‚   β”‚   β”œβ”€β”€ api/                # API routes
β”‚   β”‚   β”œβ”€β”€ room/[roomId]/      # Room page
β”‚   β”‚   β”œβ”€β”€ layout.tsx          # Root layout
β”‚   β”‚   └── page.tsx            # Home page
β”‚   β”œβ”€β”€ components/             # React components
β”‚   β”œβ”€β”€ hooks/                  # Custom hooks
β”‚   └── lib/                    # Utility libraries
β”œβ”€β”€ public/                     # Static assets
β”œβ”€β”€ elysia/                     # API server (separate)
β”œβ”€β”€ README.md
└── package.json

πŸ”§ Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

🎯 Contributing

We welcome contributions from the community! Here's how you can help make this project better:

πŸš€ Getting Started

  1. Fork the Repository

    • Click the "Fork" button at the top right of this repository
    • Clone your forked repository to your local machine git clone https://github.com/x0lg0n/real-time-ephemeral-chat-system.git cd real-time-ephemeral-chat-system
  2. Set Up Development Environment

    • Install dependencies: bun install
    • Create your .env.local file (see Environment Variables section)
    • Start the development server: bun run dev
  3. Create a Feature Branch git checkout -b feature/your-feature-name Use descriptive branch names like:

    • feature/add-user-authentication
    • bugfix/fix-room-expiry-issue
    • enhancement/improve-ui-components

πŸ“ Development Guidelines

Code Quality Standards:

  • βœ… Use TypeScript for all new code
  • βœ… Follow the existing ESLint configuration
  • βœ… Write clear, descriptive commit messages
  • βœ… Include tests for new functionality
  • βœ… Ensure all existing tests pass before submitting

Commit Message Format:

type(scope): brief description

Detailed explanation of changes (optional)

  • Specific changes made
  • Reason for changes
  • Impact on functionality

Resolves: #issue-number (if applicable)

Commit Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting, etc.)
  • refactor: Code refactoring
  • test: Adding or modifying tests
  • chore: Maintenance tasks

πŸ”„ Submission Process

  1. Before Pushing:

    • Run code quality checks

         bun run lint
         bun run build
    • Ensure all tests pass

         bun test
  2. Push Your Changes:

       git push origin feature/-your-feature-name
  3. Create Pull Request:

    • Go to your fork on GitHub
    • Click "New Pull Request"
    • Select your feature branch
    • Provide a clear title and detailed description
    • Link any related issues

🎯 What We're Looking For

Areas for Contribution:

  • πŸ› Bug fixes and performance improvements
  • ✨ New features and enhancements
  • πŸ“š Documentation improvements
  • 🎨 UI/UX enhancements
  • πŸ§ͺ Test coverage expansion
  • πŸ“± Mobile responsiveness improvements

Good First Issues: Check our GitHub Issues for issues labeled good first issue or help wanted.

🀝 Community Guidelines

  • Be respectful and inclusive
  • Provide constructive feedback
  • Help others learn and grow
  • Follow our Code of Conduct
  • Ask questions in our Discussions

πŸ“‹ Pull Request Review Process

  1. Initial Review: Maintainers will review your PR within 48 hours
  2. Feedback: Address any requested changes
  3. Approval: Once approved, your PR will be merged
  4. Celebration: πŸŽ‰ Your contribution is now part of the project!

πŸ†˜ Need Help?

Thank you for contributing to make this project amazing! πŸš€

Code Quality Standards

  • Use TypeScript for all new code
  • Follow ESLint configuration
  • Write meaningful commit messages
  • Include tests for new functionality
  • Ensure all existing tests pass

πŸ“„ License

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

πŸ“ž Support

For support, questions, or feature requests:

  • Create an issue in the GitHub Issues
  • Contact the maintainer via email

πŸ’™ Acknowledgements


Made with ❀️ and β˜•

About

A secure, real-time chat application with self-destructing rooms built using Next.js, TypeScript, and Upstash services.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages