Back to projects

AIProWeb application

AI chat that streams fast and stays stable under load.

Feb 2025 - May 2025PrototypeFull-stack · Solo build
Next.jsTypeScriptOpenAIVercel AI SDKStreamingRate Limiting

Overview

AIPro is a conversational AI assistant built with Next.js and the Vercel AI SDK. It pairs a polished chat UX with OpenAI model streaming, validated image attachments, and middleware-enforced rate limiting so responses stay fast and the public endpoint stays protected from abuse.

At a Glance

Role
Full-stack · Solo build
Timeline
Feb 2025 - May 2025
Status
Prototype
Type
Web application

Highlights

Dual-window rate limiting

Upstash sliding-window (per-minute) and fixed-window (per-day) checks run in middleware before any model call, capping abuse and cost before compute starts.

Real-time streaming responses

Output streams from OpenAI with word-level chunking via the Vercel AI SDK, cutting perceived latency on long answers.

Validated image attachments

Client filtering plus zod server validation gate file type and size before uploads land in Vercel Blob.

Technical content rendering

Markdown, syntax highlighting, and LaTeX rendering keep code and math readable in AI responses.

How It Works

1

The chat input sends prompts, optionally with image attachments, to the /api routes.

2

Middleware checks per-minute and per-day limits and returns 429 before any model call runs.

3

The chat route streams text from OpenAI via the Vercel AI SDK's streamText().

4

Attachments are validated and stored in Vercel Blob, with their URLs attached to the message.

5

The client renders streamed output with markdown, code highlighting, and LaTeX support.

Key Challenge

Keeping a public AI endpoint cheap and abuse-resistant. Enforcing rate limits in middleware—before the model is ever invoked—means burst spam and daily overuse are rejected without wasting OpenAI calls.

Tech Stack

Languages

TypeScript

Frameworks

Next.js (App Router)ReactVercel AI SDKTailwind CSSFramer Motion

Infrastructure

Upstash RedisVercel BlobVercel serverless

Tooling

@ai-sdk/openaizodreact-markdownrehype-katexsonner

Want to see it in action or read the code?

Back to all projects