Skip to content

Praashh/t3.chat

Repository files navigation

𝙏3𝙘𝒉𝙖𝒕

Deploy with Vercel

An Open-Source Version of t3.chat.

What is T3.chat?

T3 Chat is a fast and sleek AI chat application.

it's "best AI chat app ever made" ~ Theo

Why T3chat?

It supports different LLM, respond very fast, user friendly, have customization, cheap.

  • Open-Source – No hidden agendas, fully transparent.
  • 🚀 Developer-Friendly – Built with extensibility and integrations in mind.

Tech Stack

T3 is built with modern and reliable technologies:

  • Frontend: Next.js, TypeScript, TailwindCSS, Shadcn UI
  • Backend: tRPC, Prisma ORM
  • Database: PostgreSQL
  • Authentication: Google OAuth
  • Overall: We're using t3 stack 💙

Getting Started

Prerequisites

Required Versions:

  • Node.js >= 18.0.0
  • pnpm >= 8.0.0
  • Docker >= 20.10.0

Before running the application, you'll need to set up several services and environment variables:

For more in-depth information on environment variables, please refer to the Environment Variables section.

  1. Setup Local

    • Make sure you have Docker, NodeJS, and bun installed.

    • Open codebase as a container in VSCode or your favorite VSCode fork.

    • Run the following commands in order to populate your dependencies and setup docker

      bun install
      
    • Run the following commands if you are unable to start any of the services

      rm -rf node_modules
      
  2. Next Auth Setup

    • Open the .env file and change the AUTH_SECRET to string given below.

      AUTH_SECRET= 'authjs.session-token'
  3. Google OAuth Setup

    • Go to Google Cloud Console

    • Create a new project

    • Create OAuth 2.0 credentials (Web application type)

    • Add authorized redirect URIs:

      • Development:
        • http://localhost:3000
        • http://localhost:3000/api/auth/google/callback
      • Production:
        • https://your-production-url
        • https://your-production-url/api/auth/google/callback
    • Add to .env:

      GOOGLE_CLIENT_ID=your_client_id
      GOOGLE_CLIENT_SECRET=your_client_secret

Environment Variables

Copy .env.example located in .env in the configure the following variables:

# Auth
AUTH_TRUST_HOST= 
AUTH_SECRET=     # Required: Secret key for authentication

# Google OAuth ( Required )
GOOGLE_CLIENT_ID=      
GOOGLE_CLIENT_SECRET=  

# Turnstile ( Required )
NEXT_PUBLIC_TURNSTILE_SITE_KEY=
TURNSTILE_SITE_KEY=
TURNSTILE_SITE_SECRET=

# Stripe ( Required )
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=

# Upstash ( Required )
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN = 

# Mail ( Optional )
MAIL_APP_USER =
MAIL_APP_PASSWORD = 

# TypeGPT ( Required )
NEXT_PUBLIC_TYPEGPT_API_KEY=
TYPEGPT_API_KEY=
TYPEGPT_API_URL=

# Discord webhook ( Optinal )
WEBHOOK_URL

# Database ( Required )
DATABASE_URL=    

Migration the database by running bunx prisma migrate dev and generate prisma client bunx prisma generate.

Running Locally

Run the development server:

bun dev

Open http://localhost:3000 with your browser to see the result.

Contribute

Contributions are welcome ❤️.

About

An open-source version of t3.chat.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •