├── .env.example
├── .eslintrc.json
├── .gitignore
├── README.md
├── next.config.js
├── package.json
├── pnpm-lock.yaml
├── postcss.config.js
├── prisma
└── schema.prisma
├── public
├── dashboard-preview.jpg
├── file-upload-preview.jpg
├── icon.png
└── thumbnail.png
├── screenshot.png
├── src
├── app
│ ├── _trpc
│ │ └── client.ts
│ ├── api
│ │ ├── auth
│ │ │ └── [kindeAuth]
│ │ │ │ └── route.ts
│ │ ├── message
│ │ │ └── route.ts
│ │ ├── trpc
│ │ │ └── [trpc]
│ │ │ │ └── route.ts
│ │ ├── uploadthing
│ │ │ ├── core.ts
│ │ │ └── route.ts
│ │ └── webhooks
│ │ │ └── stripe
│ │ │ └── route.ts
│ ├── auth-callback
│ │ └── page.tsx
│ ├── dashboard
│ │ ├── [fileId]
│ │ │ └── page.tsx
│ │ ├── billing
│ │ │ └── page.tsx
│ │ └── page.tsx
│ ├── favicon.ico
│ ├── globals.css
│ ├── layout.tsx
│ ├── page.tsx
│ └── pricing
│ │ └── page.tsx
├── components
│ ├── BillingForm.tsx
│ ├── Dashboard.tsx
│ ├── Icons.tsx
│ ├── Main.tsx
│ ├── MaxWidthWrapper.tsx
│ ├── MobileSlideover.tsx
│ ├── Navbar.tsx
│ ├── PdfFileCard.tsx
│ ├── PdfFullscreen.tsx
│ ├── PdfRenderer.tsx
│ ├── ProfileMenu.tsx
│ ├── Providers.tsx
│ ├── UpgradeButton.tsx
│ ├── UploadButton.tsx
│ ├── chat
│ │ ├── ChatInput.tsx
│ │ ├── ChatWrapper.tsx
│ │ ├── CodeRenderer.tsx
│ │ ├── LinkRenderer.tsx
│ │ ├── Message.tsx
│ │ ├── Messages.tsx
│ │ └── index.ts
│ ├── index.ts
│ └── ui
│ │ ├── Avatar.tsx
│ │ ├── Button.tsx
│ │ ├── Card.tsx
│ │ ├── Dialog.tsx
│ │ ├── DropdownMenu.tsx
│ │ ├── Input.tsx
│ │ ├── Progress.tsx
│ │ ├── Textarea.tsx
│ │ ├── Toast.tsx
│ │ ├── Toaster.tsx
│ │ ├── Tooltip.tsx
│ │ ├── UseToast.tsx
│ │ └── index.ts
├── config
│ ├── infinite-query.ts
│ ├── max-query.ts
│ └── stripe.ts
├── context
│ ├── chat.tsx
│ └── document.tsx
├── db
│ └── index.ts
├── lib
│ ├── openai.ts
│ ├── pinecone.ts
│ ├── rate-limiter.ts
│ ├── redis.ts
│ ├── shadcn-plugin.ts
│ ├── shadcn-preset.ts
│ ├── stripe.ts
│ ├── uploadthing.ts
│ ├── utils.ts
│ └── validators
│ │ └── message.ts
├── middleware.ts
├── trpc
│ ├── index.ts
│ └── trpc.ts
└── types
│ └── message.ts
├── tailwind.config.ts
└── tsconfig.json
/.env.example:
--------------------------------------------------------------------------------
1 | # ------------------------
2 | # Kinde Configuration
3 | # ------------------------
4 |
5 | KINDE_CLIENT_ID=
6 | KINDE_CLIENT_SECRET=
7 | KINDE_ISSUER_URL=
8 | KINDE_SITE_URL=
9 | KINDE_POST_LOGOUT_REDIRECT_URL=
10 | KINDE_POST_LOGIN_REDIRECT_URL=
11 |
12 | # ------------------------
13 | # Aiven
14 | # ------------------------
15 |
16 | DATABASE_URL=
17 |
18 | # ------------------------
19 | # UploadThing
20 | # ------------------------
21 |
22 | UPLOADTHING_TOKEN=
23 |
24 | # ------------------------
25 | # Pinecone
26 | # ------------------------
27 |
28 | PINECONE_API_KEY=
29 |
30 | # ------------------------
31 | # OpenAI
32 | # ------------------------
33 |
34 | OPENAI_API_KEY=
35 |
36 | # ------------------------
37 | # Stripe
38 | # ------------------------
39 |
40 | PRICING_API_ID=
41 | STRIPE_SECRET_KEY=
42 | STRIPE_WEBHOOK_SECRET=
43 |
44 | # ------------------------
45 | # Upstash
46 | # ------------------------
47 |
48 | UPSTASH_REDIS_REST_URL=
49 | UPSTASH_REDIS_REST_TOKEN=
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/.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 | .yarn/install-state.gz
8 |
9 | # testing
10 | /coverage
11 |
12 | # next.js
13 | /.next/
14 | /out/
15 |
16 | # production
17 | /build
18 |
19 | # misc
20 | .DS_Store
21 | *.pem
22 | .history
23 |
24 | # debug
25 | npm-debug.log*
26 | yarn-debug.log*
27 | yarn-error.log*
28 |
29 | # local env files
30 | .env
31 | .env*.local
32 |
33 | # vercel
34 | .vercel
35 |
36 | # typescript
37 | *.tsbuildinfo
38 | next-env.d.ts
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Documon
2 |
3 | A web application that harnesses the power of artificial intelligence to transform the way you interact with PDF documents. Documon enables you to seamlessly engage in a conversation with your PDFs, enjoy smart context summarization, and benefit from annotation features. This makes document exploration and information retrieval a breeze.
4 |
5 | ## Screenshot
6 |
7 |
8 |
9 |
10 | View Project » 11 |
12 | 13 | ## Running Locally 14 | 15 | This application requires Node.js v16.13+. 16 | 17 | ### Cloning the repository to the local machine: 18 | 19 | ```bash 20 | git clone https://github.com/nabarvn/documon.git 21 | cd documon 22 | ``` 23 | 24 | ### Installing the dependencies: 25 | 26 | ```bash 27 | pnpm install 28 | ``` 29 | 30 | ### Setting up the `.env` file: 31 | 32 | ```bash 33 | cp .env.example .env 34 | ``` 35 | 36 | > [!IMPORTANT] 37 | > Ensure you populate the variables with your respective API keys and configuration values before proceeding. 38 | 39 | ### Configuring Prisma: 40 | 41 | ```bash 42 | pnpm prisma generate 43 | ``` 44 | 45 | ```bash 46 | pnpm prisma db push 47 | ``` 48 | 49 | ### Running the application: 50 | 51 | ```bash 52 | pnpm dev 53 | ``` 54 | 55 | ## Tech Stack 56 | 57 | - **Language**: [TypeScript](https://www.typescriptlang.org) 58 | - **Framework**: [Next.js](https://nextjs.org) 59 | - **Styling**: [Tailwind CSS](https://tailwindcss.com) 60 | - **Analytics**: [Vercel Analytics](https://vercel.com/analytics) 61 | - **State Management**: [React Query](https://www.npmjs.com/package/@tanstack/react-query) 62 | - **ORM Toolkit**: [Prisma](https://www.prisma.io/docs/concepts/overview/what-is-prisma) 63 | - **LLM Provider**: [OpenAI](https://platform.openai.com/docs/overview) 64 | - **Vector Database**: [Pinecone](https://docs.pinecone.io/docs/overview) 65 | - **Memory Builder**: [LangChain.js](https://js.langchain.com/docs/get_started/introduction) 66 | - **Rate Limiter**: [Upstash](https://docs.upstash.com/redis) 67 | - **MySQL Database**: [Aiven](https://aiven.io/docs/get-started) 68 | - **Authentication**: [Kinde](https://kinde.com/docs/developer-tools/nextjs-sdk) 69 | - **File Hosting**: [UploadThing](https://docs.uploadthing.com) 70 | - **API Typesafety**: [tRPC](https://trpc.io/docs) 71 | - **Payments**: [Stripe](https://stripe.com/docs/payments) 72 | - **Deployment**: [Vercel](https://vercel.com) 73 | 74 | ## Credits 75 | 76 | Learned a ton while building this project. All thanks to Josh for the next level (no pun intended) tutorial! 77 | 78 |47 | You will be redirected automatically. 48 |
49 |20 | Documon is now live! 21 |
22 |30 | Documon allows you to have conversations with any PDF document. Simply 31 | upload your file and start asking questions right away. 32 |
33 | 34 | 43 | Get started 44 |105 | Interacting with your PDF files has never been easier. 106 |
107 |93 | Whether you're just trying out our service or need more, 94 | we've got you covered. 95 |
96 |{tagline}
125 | 126 |127 | ${price} 128 |
129 | 130 |per month
131 |{quota.toLocaleString()} PDFs/mo included
136 | 137 |167 | {text} 168 |
169 | 170 |186 | {text} 187 |
188 | )} 189 |53 | Let's upload your first PDF. 54 |
55 |113 | / 114 | {numPages ?? "x"} 115 |
116 |{name}
} 42 | 43 | {email && ( 44 |45 | {email} 46 |
47 | )} 48 |43 | We're preparing your PDF. 44 |
45 |This won't take long.
60 |80 | Your{" "} 81 | 82 | {isSubscribed ? "Pro" : "Free"} 83 | {" "} 84 | plan supports upto {isSubscribed ? proNumPages : freeNumPages}{" "} 85 | pages per PDF. 86 |
87 | 88 | 95 |
19 | {children}
20 |
21 | 102 | Ask your first question to get started. 103 |
104 |