Skip to content

Commit fc7f791

Browse files
authored
Merge pull request #8 from 100XEnginners/v2/t3chat
v2 of t3chat
2 parents e95b92b + a49a998 commit fc7f791

8 files changed

Lines changed: 257 additions & 51 deletions

File tree

.env.example

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
# Since the ".env" file is gitignored, you can use the ".env.example" file to
2-
# build a new ".env" file when you clone the repo. Keep this file up-to-date
3-
# when you add new variables to `.env`.
41

5-
# This file will be committed to version control, so make sure not to have any
6-
# secrets in it. If you are cloning this repo, create a copy of this file named
7-
# ".env" and populate it with your secrets.
2+
AUTH_TRUST_HOST=true
3+
AUTH_SECRET= ''
4+
SECRURE_AUTH_SECRET = ""
5+
NEXT_PUBLIC_APP_URL = "http://localhost:3000"
6+
NEXTAUTH_URL = "http://localhost:3000"
87

9-
# When adding additional environment variables, the schema in "/src/env.js"
10-
# should be updated accordingly.
8+
GOOGLE_CLIENT_ID=""
9+
GOOGLE_CLIENT_SECRET=""
10+
TURNSTILE_SITE_KEY = ""
11+
NEXT_PUBLIC_TURNSTILE_SITE_KEY = ""
12+
TURNSTILE_SITE_SECRET = ""
13+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY = ""
14+
STRIPE_SECRET_KEY= ""
15+
STRIPE_WEBHOOK_SECRET = ""
16+
UPSTASH_REDIS_REST_URL = ""
17+
UPSTASH_REDIS_REST_TOKEN = ""
18+
MAIL_APP_USER = ""
19+
MAIL_APP_PASSWORD = ""
1120

12-
# Next Auth
13-
# You can generate a new secret on the command line with:
14-
# npx auth secret
15-
# https://next-auth.js.org/configuration/options#secret
16-
AUTH_SECRET=""
21+
DATABASE_URL="postgresql://postgres:password@localhost:5432/t3dotgg"
1722

18-
# Next Auth Discord Provider
19-
AUTH_DISCORD_ID=""
20-
AUTH_DISCORD_SECRET=""
23+
NEXT_PUBLIC_TYPEGPT_API_KEY = ""
24+
TYPEGPT_API_KEY = ""
25+
TYPEGPT_API_URL = ""
2126

22-
# Prisma
23-
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
24-
DATABASE_URL="postgresql://postgres:password@localhost:5432/t3dotgg"
27+
# Discord Webhook
28+
29+
WEBHOOK_URL= ""

README.md

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,143 @@
1-
## t3dotgg clone
1+
# 𝙏3𝙘𝒉𝙖𝒕
2+
3+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2F100xEnginners%2Ft3dotgg&env=DATABASE_URL,BETTER_AUTH_SECRET,BETTER_AUTH_URL,BETTER_AUTH_TRUSTED_ORIGINS,GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET,GOOGLE_REDIRECT_URI,GITHUB_CLIENT_ID,GITHUB_CLIENT_SECRET&envDescription=For%20more%20info%20on%20setting%20up%20your%20API%20keys%2C%20checkout%20the%20Readme%20below&envLink=https%3A%2F%2Fgithub.com%2F100xEnginners%2Ft3dotgg%2Fblob%2Fmain%2FREADME.md&project-name=zero-email&repository-name=zero-email&redirect-url=zero.email&demo-title=Zero&demo-description=An%20open%20source%20email%20app&demo-url=zero.email)
4+
5+
An Open-Source Version of t3.chat.
6+
7+
## What is T3.chat?
8+
9+
T3 Chat is a fast and sleek AI chat application.
10+
11+
it's "best AI chat app ever made" ~ Theo
12+
13+
## Why T3chat?
14+
It supports different LLM, respond very fast, user friendly, have customization, cheap.
15+
-**Open-Source** – No hidden agendas, fully transparent.
16+
- 🚀 **Developer-Friendly** – Built with extensibility and integrations in mind.
17+
18+
## Tech Stack
19+
20+
T3 is built with modern and reliable technologies:
21+
22+
- **Frontend**: Next.js, TypeScript, TailwindCSS, Shadcn UI
23+
- **Backend**: tRPC, Prisma ORM
24+
- **Database**: PostgreSQL
25+
- **Authentication**: Google OAuth
26+
- **Overall**: We're using t3 stack 💙
27+
<!-- - **Testing**: Jest, React Testing Library -->
28+
29+
## Getting Started
30+
31+
### Prerequisites
32+
33+
**Required Versions:**
34+
35+
- Node.js >= 18.0.0
36+
- pnpm >= 8.0.0
37+
- Docker >= 20.10.0
38+
39+
Before running the application, you'll need to set up several services and environment variables:
40+
41+
For more in-depth information on environment variables, please refer to the [Environment Variables](#environment-variables) section.
42+
43+
44+
1. **Setup Local**
45+
46+
- Make sure you have [Docker](https://docs.docker.com/get-docker/), [NodeJS](https://nodejs.org/en/download/), and [bun](https://bun.sh/docs/installation) installed.
47+
- Open codebase as a container in [VSCode](https://code.visualstudio.com/) or your favorite VSCode fork.
48+
- Run the following commands in order to populate your dependencies and setup docker
49+
50+
```
51+
bun install
52+
```
53+
54+
- Run the following commands if you are unable to start any of the services
55+
56+
```
57+
rm -rf node_modules
58+
```
59+
60+
2. **Next Auth Setup**
61+
62+
- Open the `.env` file and change the AUTH_SECRET to string given below.
63+
64+
```env
65+
AUTH_SECRET= 'authjs.session-token'
66+
```
67+
68+
3. **Google OAuth Setup**
69+
70+
- Go to [Google Cloud Console](https://console.cloud.google.com)
71+
- Create a new project
72+
- Create OAuth 2.0 credentials (Web application type)
73+
- Add authorized redirect URIs:
74+
- Development:
75+
- `http://localhost:3000`
76+
- `http://localhost:3000/api/auth/google/callback`
77+
- Production:
78+
- `https://your-production-url`
79+
- `https://your-production-url/api/auth/google/callback`
80+
- Add to `.env`:
81+
82+
```env
83+
GOOGLE_CLIENT_ID=your_client_id
84+
GOOGLE_CLIENT_SECRET=your_client_secret
85+
```
86+
### Environment Variables
87+
88+
Copy `.env.example` located in `.env` in the configure the following variables:
89+
90+
```env
91+
# Auth
92+
AUTH_TRUST_HOST=
93+
AUTH_SECRET= # Required: Secret key for authentication
94+
95+
# Google OAuth ( Required )
96+
GOOGLE_CLIENT_ID=
97+
GOOGLE_CLIENT_SECRET=
98+
99+
# Turnstile ( Required )
100+
NEXT_PUBLIC_TURNSTILE_SITE_KEY=
101+
TURNSTILE_SITE_KEY=
102+
TURNSTILE_SITE_SECRET=
103+
104+
# Stripe ( Required )
105+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
106+
STRIPE_SECRET_KEY=
107+
STRIPE_WEBHOOK_SECRET=
108+
109+
# Upstash ( Required )
110+
UPSTASH_REDIS_REST_URL=
111+
UPSTASH_REDIS_REST_TOKEN =
112+
113+
# Mail ( Optional )
114+
MAIL_APP_USER =
115+
MAIL_APP_PASSWORD =
116+
117+
# TypeGPT ( Required )
118+
NEXT_PUBLIC_TYPEGPT_API_KEY=
119+
TYPEGPT_API_KEY=
120+
TYPEGPT_API_URL=
121+
122+
# Discord webhook ( Optinal )
123+
WEBHOOK_URL
124+
125+
# Database ( Required )
126+
DATABASE_URL=
127+
```
128+
129+
Migration the database by running `bunx prisma migrate dev` and generate prisma client `bunx prisma generate`.
130+
131+
132+
### Running Locally
133+
134+
Run the development server:
135+
136+
```bash
137+
bun dev
138+
```
139+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
140+
141+
## Contribute
142+
143+
Contributions are welcome ❤️.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
"use client";
22
import Chat from "@/app/_components/Chat";
3+
import { useParams } from "next/navigation";
34

45
export default function SingleChatPage() {
6+
const { chatId } = useParams();
57
return (
68
<>
7-
<Chat />
9+
<Chat chatId={chatId as string} />
810
</>
911
);
1012
}

src/app/(app)/ask/layout.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { SidebarToggle } from "@/app/_components/sidebar-toggle";
22
import {
33
SidebarInset,
4-
SidebarTrigger,
5-
useSidebar,
64
} from "@/components/ui/sidebar";
75
import { SelectTheme } from "@/components/ui/theme-toggler";
86
import { UIStructure } from "@/components/ui/ui-structure";

0 commit comments

Comments
 (0)