Next.js
Build AI-powered Next.js applications with App Router, Server Components, and streaming
Overview
Key Features
What You'll Build
Quick Start
1. Create Next.js Project
2. Add Environment Variables
3. Create NeurosLink AI Instance
4. Server Component Example
Server Components Pattern
Basic Server Component
Server Component with Suspense
Server Actions
Basic Server Action
Client Component Using Server Action
API Routes
Basic API Route
Protected API Route with Middleware
Rate-Limited API Route
Streaming Responses
Streaming API Route
Client Component for Streaming
Edge Runtime
Edge API Route
Edge Function with Regional Routing
Production Patterns
Pattern 1: Chat Application
Pattern 2: Document Analysis
Pattern 3: Cost Tracking
Best Practices
1. ✅ Use Server Components for Static AI Content
2. ✅ Stream for Long Responses
3. ✅ Implement Rate Limiting
4. ✅ Cache AI Responses
5. ✅ Handle Errors Gracefully
Deployment
Vercel Deployment
Environment Variables (Production)
Related Documentation
Additional Resources
Last updated
Was this helpful?

