Tech stack
Architecture overview
Here is how data flows through the app:- Sign in. The user creates an account or logs in through Supabase Auth.
- Send a message. The user types a prompt in the chat interface. The message is sent to an API route that calls the OpenAI Chat Completions endpoint.
- Stream the response. GPT’s response is streamed back to the browser in real time, token by token.
- Save the conversation. Each message pair (user + assistant) is saved to a Supabase
messagestable, grouped by conversation. - Track usage. A counter in Supabase tracks how many messages the user has sent today.
- Enforce limits. Free users are capped at 20 messages per day. When they hit the limit, the app shows an upgrade prompt.
- Upgrade. Clicking “Upgrade to Pro” redirects to a Stripe Checkout session for the $12/month plan.
- Send emails. Resend delivers a welcome email on signup and a daily usage summary for Pro users.
How long does it take?
Step-by-step build
Start the project
Connect Supabase for auth and data
Connect OpenAI
Build the chat interface with streaming
Add conversation history
Implement usage limits for the free tier
Connect Stripe for the Pro plan
Add email notifications with Resend
Deploy to Netlify and test end-to-end
- Sign up with a new email and verify the welcome email arrives
- Start a conversation and confirm GPT responses stream correctly
- Create multiple conversations and switch between them
- Send 20 messages to trigger the usage limit banner
- Complete a Stripe test checkout and verify Pro features unlock
- Cancel the subscription and confirm the user reverts to the free tier
Go live
- Switch Stripe to live mode keys in the project environment variables
- Confirm Supabase row-level security is enabled on all tables
- Verify the OpenAI system prompt does not leak sensitive information
- Redeploy with the production environment variables
- Connect a custom domain if you have one
Customization ideas
Add multiple AI models
Add multiple AI models
Add document upload and analysis
Add document upload and analysis
Add team workspaces
Add team workspaces
Add custom system prompts
Add custom system prompts
Add voice input
Add voice input
Troubleshooting
Responses appear all at once instead of streaming
Responses appear all at once instead of streaming
Errors about message length or context limits
Errors about message length or context limits
'Too many requests' errors
'Too many requests' errors
Conversations disappear on refresh
Conversations disappear on refresh

