Originally inspired by the SaaS tutorial by Josh tried coding on YT: https://www.youtube.com/watch?v=ucX2zXAZ1I0
This project uses the following services:
- Unkey
- Clerk
- Stripe
- Cloudflare
- OpenAI
- Planetscale
- Pinecone
- Uploadthing
- Vercel (optional)
This project is a monorepo (using Turborepo) that contains the following:
- A Nextjs fullstack app
- Two Cloudflare Workers
- A worker that handles and authenticates requests to OpenAI. Called by the frontend. Communicates with OpenAI, Unkey, Clerk, and the backend.
- A worker that integrates Clerk and Unkey. Called by Clerk webhooks on user creation and update.
- Clone the repo
- Set up Clerk
- Set up Unkey
- Set up Stripe, create a product and a price, and set up a webhook for the product
- Set up Cloudflare and Wrangler CLI
- Set up OpenAI
- Generate a secret key for your backend
- Set up the required environment variables in .dev.vars.example for each worker using
npx wrangler secret put <VARIABLE>
- Deploy the workers using
npx wrangler deploy
- Set up the required environment variables in .env.example for the Nextjs project
- Create a webhook in Clerk that calls the
post-signup-worker
worker - Deploy the project and set all the environment variables in Vercel
- Implemente API rate limiting w/ Unkey
- Switched to Turborepo for cloudflare worker
- Switched to Clerk
- Improved prompt
- Fixed serverless function timeout by routing openai requests through cloudflare worker
- Fixed mobile uploads
- Implemented file deletion
- Fixed uploadthing urls
- Tabbed chat layout on mobile
- Dark Mode
- Fixed Pinecone
- Migrated to React Query 5
- Propagate stripe renewal to Unkey & Clerk
- Optimize code and env var sharing within monorepo
- Handle Uploadthing timeouts gracefully
- Fix a layout issue in chat view
- Remove Pinecone dependency