AIDe- full stack AI document chatting app
A fullstack app to allow users to upload files (PDF/DOCX/TXT) and start chatting with the contents of the files with AI using the following stack:
- Next.js
- Prisma
- Tailwind CSS
- tRPC + Zod + TypeScript
- React Query
- LangChaing
- OpenAI
Online platform used:
- hosting: Vercel
- database: PlanetScale
- vector storage: Pinecone
- file storage: Uploadthing
- authentication: Kinde Auth
- AI Chat: OpenAI
- Payment and Subscription: Stripe
This app is based on the tutorial by Josh with lots of customizations and enhancements:
- Visual design
- customized branding
- animated icon / preview / background
- loading screens - for enhanced perceived responsiveness
- Backend
- Handle and process DOCX and TXT files - the original add only process PDF files
- Vercel edge function - circumvents the limitations of Vercel free plan
- Refactored codes - more readable and maintainable
- Bug Fix
- Filter Pinecone db with metadata - Pinecone free plan no longer supports namespace and this broke the whole app
- React Query did not revalidate owing to mutation of the original values
- Delete button didn't delete the associated stored file and Pinecone storage - the original app leaves out all the files / vectors on the web storage
-
Clone the project repository and pull to local environment
-
Create a
.env
file in the root directory and add the following
/* Kinde */
KINDE_CLIENT_ID=
KINDE_CLIENT_SECRET=
KINDE_ISSUER_URL=
KINDE_SITE_URL=
KINDE_POST_LOGOUT_REDIRECT_URL=
KINDE_POST_LOGIN_REDIRECT_URL=
/* PlanetScale */
DATABASE_URL=
/* Uploadthing */
UPLOADTHING_SECRET=
UPLOADTHING_APP_ID=
/* Pinecone */
PINECONE_API_KEY=
PINECONE_ENVIRONMENT=gcp-starter
/* Openai */
OPENAI_SECRET_KEY=
/* Stripe */
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
- Set up the database
pnpm generate
pnpx prisma db:push
pnpx prisma postinstall
- Install dependencies and run the dev server
pnpm install
pnpm dev
- For the database client Prisma Studio, run the following command:
pnpx prisma studio