Welcome to the "pdf-cogify" project, a comprehensive chat application with PDF integration. This project is designed to provide a seamless chat experience where users can upload PDF files, create chats around them, and interact with an AI assistant. The AI assistant uses the OpenAI API to generate responses based on the chat context.
- Next.js
- React
- TypeScript
- Tailwind CSS
- Clerk
- Drizzle ORM
- PostgreSQL
- AWS SDK
- OpenAI API
- Stripe
- Axios
- Pinecone
- Drizzle-kit
- OpenAI
- Neon Database Serverless
- Drizzle-orm/neon-http
- @tanstack/react-query
- @clerk/nextjs
- clsx
- tailwind-merge
Follow the steps below to install and setup the project:
-
Clone the repository
Open your terminal and run the following command:
git clone [https://github.com/Elliott-Chong/chatpdf-yt.git](https://github.com/Shubham-sharma8/chatify)
-
Navigate to the project directory
cd chatify
-
Install Node.js
The project requires Node.js version 13.4.19 or later. You can download it from here.
-
Install the required dependencies
Run the following command to install all the required dependencies:
npm install
This will install all the dependencies listed in the
package.json
file, including Next.js, React, React DOM, Axios, Stripe, Tailwind CSS, and other specific dependencies such as "@aws-sdk/client-s3" and "@clerk/nextjs". -
Setup environment variables
Create a
.env
file in the root directory of your project and add the required environment variables. -
Setup Database
For building or developing with Drizzle Kit, use the following command:
npx drizzle-kit push:pg
-
Run the project
Now, you can run the project using the following command:
npm run dev
Open https://localhost:3000 with your browser to see the result.
This guide will walk you through the steps to create and configure an Amazon S3 bucket for your project.
- Go to the AWS Management Console.
- Click on "Create an AWS Account" and follow the instructions to set up your account.
- Open the S3 console at https://s3.console.aws.amazon.com/s3/.
- Click "Create bucket".
- Enter a unique bucket name (e.g.,
cogify
), choose a region, and click "Create bucket".
- Go to the "Permissions" tab of your bucket.
- In the "Block public access" section, uncheck the "Block all public access" option.
- Confirm the changes to allow public access.
- Go to the "Permissions" tab and find the "Bucket policy" section.
- Click "Edit" and paste the following JSON policy:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::cogify/*" } ] }
- Save the policy.
- In the "Permissions" tab, find the "CORS configuration" section.
- Click "Edit" and add the following configuration:
[ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "PUT", "POST", "DELETE", "GET" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [] } ]
- Save the CORS configuration.
- Go to the IAM console at https://console.aws.amazon.com/iam/.
- Click "Users" and then "Add user".
- Enter a username (e.g.,
s3admin
), select "Programmatic access", and click "Next". - Attach the
AmazonS3FullAccess
policy to the user. - Complete the creation process to generate an
Access key ID
andSecret access key
.
- Save the
Access key ID
andSecret access key
as environment variables in your.env
file:NEXT_PUBLIC_S3_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID NEXT_PUBLIC_S3_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
Make sure to replace YOUR_ACCESS_KEY_ID
and YOUR_SECRET_ACCESS_KEY
with your actual keys.
That's it! Your S3 bucket is now set up and configured for public access, with the necessary IAM permissions and environment variables ready for your application.
This guide will walk you through the steps to create and configure a Neon database with PostgreSQL 15 for your project.
- Go to Neon.tech.
- Click on "Sign Up" and follow the instructions to create your account.
- Once logged in, click on "Create New Project" or "New Project" button.
- Name your project (e.g.,
my-project
). - Choose "PostgreSQL 15" as the database version.
- Click on "Create Project" to set up your database.
- After the project is created, navigate to the "Databases" tab.
- copy the postgres URL
psql -h <your_host> -U <your_user> -d <your_database> -p <your_port>
Are you kidding me? Do it yourself at pinecone