Skip to content

ebenezerdon/e7.chat

Repository files navigation

e7.chat

The open-source alternative to ChatGPT

Live url: https://e7.chat

A modern, full-featured AI chat application built with Next.js, featuring multi-provider AI model access, image generation, user authentication, chat sharing, branching conversations, file attachments, and cloud synchronization.

✨ Features

  • πŸ€– Multi-AI Model Support - Access 100+ AI models via OpenRouter integration
  • πŸ” Multiple Authentication Methods - Email/password and OAuth (Google, GitHub)
  • πŸ“± Responsive Design - Works seamlessly on desktop and mobile
  • πŸ’Ύ Cloud Sync - Chat history synchronized across devices
  • πŸ”— Chat Sharing - Share conversations with public links
  • 🎨 AI Image Generation - Create images with AI models
  • πŸŒ™ Dark Theme - Beautiful, modern dark interface
  • πŸ“‚ File Uploads - Support for images and PDFs
  • πŸ” Search Functionality - Find chats quickly
  • 🎯 Chat Management - Rename, delete, and organize conversations

πŸš€ Quick Start

Prerequisites

1. Clone the Repository

git clone https://github.com/ebenezerdon/e7.chat.git
cd e7.chat

2. Install Dependencies

npm install

3. Environment Setup

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

# OpenRouter API Configuration
OPENROUTER_API_KEY=your_openrouter_api_key_here

# Site Information (Optional)
NEXT_PUBLIC_SITE_URL=http://localhost:3000
NEXT_PUBLIC_SITE_NAME=e7.chat

# Appwrite Configuration
NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
NEXT_PUBLIC_APPWRITE_PROJECT_ID=your_appwrite_project_id
APPWRITE_API_KEY=your_appwrite_server_api_key

# Database Configuration (Optional - will use defaults)
NEXT_PUBLIC_APPWRITE_DATABASE_ID=ai-chat-db
NEXT_PUBLIC_APPWRITE_CHATS_COLLECTION_ID=chats

# Optional: OpenAI API Key for image generation
OPENAI_API_KEY=your_openai_api_key_for_images

4. Start Development Server

npm run dev

Visit http://localhost:3000 to see your application running!

πŸ”§ Setup Guides

OpenRouter Setup

  1. Get API Key

    • Visit OpenRouter
    • Sign up for a free account
    • Navigate to API Keys
    • Create a new API key
    • Copy the key (starts with sk-or-)
  2. Add to Environment

    OPENROUTER_API_KEY=sk-or-v1-your-key-here

Appwrite Setup

1. Create Project

  1. Go to Appwrite Console
  2. Create a new project
  3. Copy your Project ID

2. Configure Authentication

  1. Go to Auth β†’ Settings
  2. Add your domain to Domains: http://localhost:3000, https://yourdomain.com
  3. Enable Email/Password authentication

3. Set Up OAuth (Optional)

For Google and GitHub sign-in, follow this OAuth Setup Guide.

4. Create Database

  1. Database: ai-chat-db
  2. Collections:
    • chats - Stores chat conversations
    • shared-chats - Stores shared chat links
    • user-chat-metadata - Optimized chat metadata
    • user-profiles - User preferences and API keys

5. Set Permissions

For each collection, set these permissions:

  • Create: users
  • Read: users
  • Update: users
  • Delete: users

6. Get Server API Key

  1. Go to Overview β†’ Integrate with your server
  2. Create an API Key with these scopes:
    • databases.read
    • databases.write
  3. Copy the key to APPWRITE_API_KEY

πŸ—οΈ Tech Stack

πŸ“ Project Structure

e7.chat/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                  # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ api/             # API Routes
β”‚   β”‚   β”‚   β”œβ”€β”€ chat/        # Chat completions
β”‚   β”‚   β”‚   β”œβ”€β”€ generate-image/  # AI image generation
β”‚   β”‚   β”‚   β”œβ”€β”€ generate-title/  # Auto-generate chat titles
β”‚   β”‚   β”‚   └── user/        # User management
β”‚   β”‚   β”œβ”€β”€ auth/            # Authentication pages
β”‚   β”‚   └── share/           # Shared chat pages
β”‚   β”œβ”€β”€ components/          # React Components
β”‚   β”‚   β”œβ”€β”€ AuthModal.jsx    # Authentication modal
β”‚   β”‚   β”œβ”€β”€ ChatThread.jsx   # Chat message display
β”‚   β”‚   β”œβ”€β”€ Sidebar.jsx      # Chat history sidebar
β”‚   β”‚   └── ...              # Other components
β”‚   β”œβ”€β”€ lib/                 # Utility libraries
β”‚   β”‚   β”œβ”€β”€ appwrite.js      # Appwrite client config
β”‚   β”‚   β”œβ”€β”€ auth.js          # Authentication logic
β”‚   β”‚   └── db.js            # Database operations
β”‚   └── styles/              # CSS styles
β”œβ”€β”€ public/                  # Static assets
β”œβ”€β”€ .env.local              # Environment variables
└── package.json            # Dependencies

🎯 Available AI Models

Through OpenRouter, you have access to:

Popular Models

  • OpenAI: GPT-4o, GPT-4o-mini, o1, o1-mini, o3-mini
  • Anthropic: Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude 3 Opus
  • Google: Gemini 2.0 Flash, Gemini 1.5 Pro, Gemini 1.5 Flash
  • Meta: Llama 3.1 405B, Llama 3.1 70B, Llama 3.1 8B
  • DeepSeek: DeepSeek V3, DeepSeek R1

Specialized Models

  • Qwen: Qwen 2.5 series
  • Mistral: Mistral 7B, 8x7B, 8x22B
  • Cohere: Command R+
  • And 90+ more models

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

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Run linting: npm run lint
  5. Commit: git commit -m "Add feature"
  6. Push: git push origin feature-name
  7. Create a Pull Request

πŸ“„ License

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

πŸ†˜ Support

πŸ™ Acknowledgments


Built by Ebenezer Don

About

The open-source alternative to ChatGPT | Built with NextJS and Appwrite

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published