Overview
The Next.js SDK is designed to work seamlessly with Next.js 13+ applications, providing:- Server-side rendering support
- API route handlers for OAuth callbacks
- Optimized components with Tailwind CSS
- TypeScript support
- App Router compatibility
Prerequisites
Before you begin, ensure you have:- Next.js 13.0.0 or higher
- React 18.0.0 or higher
- Node.js 16.0.0 or higher
- A Suada API key
Installation
Install the Next.js SDK and its dependencies:Quick Start
1. Configure Environment Variables
Create or update your.env.local file:
2. Set Up Provider
Wrap your application with the Suada provider in your root layout:3. Add Integration Components
Use the integration components in your pages:Core Features
🔒 OAuth Integration
The SDK provides built-in support for OAuth flows:🎨 Styling
Components are styled with Tailwind CSS and can be customized:🔄 Server Components
Use the SDK with Next.js Server Components:Best Practices
Security
- Use environment variables for sensitive data
- Implement proper error handling
- Validate user sessions
- Use HTTPS for all API calls
- Secure OAuth callback endpoints
Performance
- Use Server Components when possible
- Implement proper caching
- Optimize bundle size
- Handle loading states
- Use proper error boundaries
Development
- Use TypeScript for type safety
- Follow Next.js best practices
- Write unit tests
- Keep dependencies updated
- Use proper error handling
Common Use Cases
Basic Integration
Advanced Integration
FAQ
How do I handle OAuth callbacks in Next.js?
- Create an API route handler:
How do I use the SDK with Server Components?
How do I customize the styling?
How do I handle errors?
Support & Resources
Documentation
Support
- Email Support: hello@suada.ai