├── header.png ├── public ├── header.png ├── robot.jpg ├── favicon.ico ├── logo.svg ├── github.svg └── herobg.svg ├── postcss.config.cjs ├── prisma ├── migrations │ ├── migration_lock.toml │ └── 20240804172645_init │ │ └── migration.sql └── schema.prisma ├── src ├── app │ ├── page.tsx │ ├── api │ │ ├── auth │ │ │ └── [...nextauth] │ │ │ │ └── route.ts │ │ └── chat │ │ │ └── route.ts │ ├── home │ │ └── page.tsx │ ├── discover │ │ └── page.tsx │ └── layout.tsx ├── lib │ └── utils.ts ├── components │ ├── Provider.tsx │ ├── ui │ │ ├── textarea.tsx │ │ ├── input.tsx │ │ ├── toaster.tsx │ │ ├── bento-grid.tsx │ │ ├── button.tsx │ │ ├── use-toast.ts │ │ ├── toast.tsx │ │ └── select.tsx │ ├── discover.tsx │ ├── landingnav.tsx │ ├── Sidebar.tsx │ ├── Chat.tsx │ ├── footer.tsx │ └── landing.tsx ├── server │ ├── db.ts │ └── auth.ts ├── useApi.ts ├── env.js └── styles │ └── globals.css ├── prettier.config.js ├── .env.example ├── next.config.js ├── components.json ├── .gitignore ├── tsconfig.json ├── LICENSE ├── .eslintrc.cjs ├── README.md ├── start-database.sh ├── package.json └── tailwind.config.ts /header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronitrajfr/anonGPT/HEAD/header.png -------------------------------------------------------------------------------- /public/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronitrajfr/anonGPT/HEAD/public/header.png -------------------------------------------------------------------------------- /public/robot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronitrajfr/anonGPT/HEAD/public/robot.jpg -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ronitrajfr/anonGPT/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /postcss.config.cjs: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: { 3 | tailwindcss: {}, 4 | }, 5 | }; 6 | 7 | module.exports = config; 8 | -------------------------------------------------------------------------------- /prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (i.e. Git) 3 | provider = "postgresql" -------------------------------------------------------------------------------- /src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import Main from "~/components/landing"; 2 | 3 | export default function HomePage() { 4 | return ( 5 |
6 |
7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */ 2 | const config = { 3 | plugins: ["prettier-plugin-tailwindcss"], 4 | }; 5 | 6 | export default config; 7 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | NEXTAUTH_URL="http://localhost:3000" 2 | NEXTAUTH_SECRET=yourpassword 3 | AUTH_GOOGLE_ID= 4 | AUTH_GOOGLE_SECRET= 5 | DATABASE_URL=POSTGRES_URL 6 | GEMINI_API_KEY= 7 | GOOGLE_API_KEY= 8 | SEARCH_ENGINE_ID= 9 | NEXT_PUBLIC_NEWSAPIORG_API_KEY="GET IT FROM https://newsapi.org/" -------------------------------------------------------------------------------- /src/app/api/auth/[...nextauth]/route.ts: -------------------------------------------------------------------------------- 1 | import NextAuth from "next-auth"; 2 | 3 | import { authOptions } from "~/server/auth"; 4 | 5 | // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment 6 | const handler = NextAuth(authOptions); 7 | export { handler as GET, handler as POST }; 8 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful 3 | * for Docker builds. 4 | */ 5 | await import("./src/env.js"); 6 | 7 | /** @type {import("next").NextConfig} */ 8 | const config = {}; 9 | 10 | export default config; 11 | -------------------------------------------------------------------------------- /src/components/Provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { SessionProvider } from "next-auth/react"; 3 | import React, { ReactNode } from "react"; 4 | 5 | interface Props { 6 | children: ReactNode; 7 | } 8 | 9 | const Providers = ({ children, session }: any) => { 10 | return {children}; 11 | }; 12 | 13 | export default Providers; 14 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/styles/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "~/components", 15 | "utils": "~/lib/utils" 16 | } 17 | } -------------------------------------------------------------------------------- /src/server/db.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from "@prisma/client"; 2 | 3 | import { env } from "~/env"; 4 | 5 | const createPrismaClient = () => 6 | new PrismaClient({ 7 | log: 8 | env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"], 9 | }); 10 | 11 | const globalForPrisma = globalThis as unknown as { 12 | prisma: ReturnType | undefined; 13 | }; 14 | 15 | export const db = globalForPrisma.prisma ?? createPrismaClient(); 16 | 17 | if (env.NODE_ENV !== "production") globalForPrisma.prisma = db; 18 | -------------------------------------------------------------------------------- /src/app/home/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React from "react"; 3 | import Chat from "~/components/Chat"; 4 | import Sidebar from "~/components/Sidebar"; 5 | import { useSession } from "next-auth/react"; 6 | import { useRouter } from "next/navigation"; 7 | const page = () => { 8 | const router = useRouter(); 9 | const { status } = useSession(); 10 | if (status === "unauthenticated") { 11 | router.push("/"); 12 | } 13 | return ( 14 |
15 | 16 | 17 |
18 | ); 19 | }; 20 | 21 | export default page; 22 | -------------------------------------------------------------------------------- /src/app/discover/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React from "react"; 3 | import Discover from "~/components/discover"; 4 | import Sidebar from "~/components/Sidebar"; 5 | import { useSession } from "next-auth/react"; 6 | import { useRouter } from "next/navigation"; 7 | 8 | const page = () => { 9 | const router = useRouter(); 10 | const { status } = useSession(); 11 | if (status === "unauthenticated") { 12 | router.push("/"); 13 | } 14 | return ( 15 |
16 | 17 | 18 |
19 | ); 20 | }; 21 | 22 | export default page; 23 | -------------------------------------------------------------------------------- /public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # database 12 | /prisma/db.sqlite 13 | /prisma/db.sqlite-journal 14 | db.sqlite 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | next-env.d.ts 20 | 21 | # production 22 | /build 23 | 24 | # misc 25 | .DS_Store 26 | *.pem 27 | 28 | # debug 29 | npm-debug.log* 30 | yarn-debug.log* 31 | yarn-error.log* 32 | .pnpm-debug.log* 33 | 34 | # local env files 35 | # do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables 36 | .env 37 | .env*.local 38 | 39 | # vercel 40 | .vercel 41 | 42 | # typescript 43 | *.tsbuildinfo 44 | 45 | # idea files 46 | .idea -------------------------------------------------------------------------------- /src/useApi.ts: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { useEffect, useState } from "react"; 3 | 4 | const useApi = () => { 5 | const [apiKey, setApiKey] = useState(null); 6 | 7 | useEffect(() => { 8 | const storedApiKey = localStorage.getItem("geminiApiKey"); 9 | setApiKey(storedApiKey); 10 | }, []); 11 | 12 | return apiKey; 13 | }; 14 | 15 | const fetchData = async () => { 16 | const apiKey = useApi(); 17 | 18 | if (apiKey) { 19 | const response = await fetch("/api/chat", { 20 | method: "POST", 21 | headers: { 22 | "Content-Type": "application/json", 23 | Authorization: `Bearer ${apiKey}`, // Include API key in headers 24 | }, 25 | body: JSON.stringify({ 26 | /* Your request data */ 27 | }), 28 | }); 29 | 30 | const data = await response.json(); 31 | console.log(data); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /src/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { cn } from "~/lib/utils"; 4 | 5 | export interface TextareaProps 6 | extends React.TextareaHTMLAttributes {} 7 | 8 | const Textarea = React.forwardRef( 9 | ({ className, ...props }, ref) => { 10 | return ( 11 |