A modern, full-featured AI assistant application built with Next.js 16, Clerk authentication, and a beautiful UI. Features include real-time chat interface, user dashboard, and secure authentication.
- π Secure Authentication - Powered by Clerk with sign-in/sign-up flows
- π¬ Real-time Chat Interface - Beautiful chat UI with typing indicators
- π User Dashboard - Track conversations, messages, and activity
- π¨ Modern UI/UX - Gradient backgrounds, smooth animations, and responsive design
- π Dark Mode Support - Automatic dark/light theme switching
- β‘ Fast Performance - Built with Next.js 16 App Router
- π Protected Routes - Middleware-based route protection
- π± Fully Responsive - Works seamlessly on all devices
- Node.js 18+ installed
- A Clerk account (free tier available at clerk.com)
cd asno_ai_assistant
npm install- Go to Clerk Dashboard
- Create a new application or use an existing one
- Navigate to API Keys in the dashboard
- Copy your Publishable Key and Secret Key
Create a .env.local file in the root directory:
# Clerk Authentication Keys
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_your_publishable_key_here
CLERK_SECRET_KEY=sk_test_your_secret_key_here
# Optional: AI API Keys (for future integration)
# OPENAI_API_KEY=your_openai_key_here
# ANTHROPIC_API_KEY=your_anthropic_key_herenpm run devOpen http://localhost:3000 in your browser.
asno_ai_assistant/
βββ app/
β βββ api/
β β βββ chat/
β β βββ route.ts # Chat API endpoint
β βββ components/
β β βββ chat-interface.tsx # Main chat component
β βββ dashboard/
β β βββ page.tsx # User dashboard
β βββ layout.tsx # Root layout with ClerkProvider
β βββ layout-client.tsx # Client-side header component
β βββ page.tsx # Home page with landing & chat
βββ middleware.ts # Clerk auth middleware
βββ .env.local # Environment variables (create this)
βββ package.json
- Signed Out: Beautiful landing page with hero section and features
- Signed In: Full-screen chat interface with AI assistant
- User statistics and activity tracking
- Quick action buttons
- Recent conversation history
- Analytics overview
- Real-time message rendering
- Typing indicators
- Message timestamps
- Clear chat functionality
- Responsive design
The app includes a chat API route at /api/chat that's ready for AI integration:
npm install openai// app/api/chat/route.ts
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
// Replace the simulated response with:
const completion = await openai.chat.completions.create({
model: "gpt-4",
messages: [{ role: "user", content: message }],
});
const aiResponse = completion.choices[0].message.content;npm install @anthropic-ai/sdkimport Anthropic from '@anthropic-ai/sdk';
const anthropic = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
const message = await anthropic.messages.create({
model: "claude-3-opus-20240229",
messages: [{ role: "user", content: userMessage }],
});- Middleware Protection: Routes are protected by
clerkMiddleware() - Sign In/Up: Modal-based authentication flows
- Session Management: Automatic session handling by Clerk
- User Profile:
UserButtoncomponent for account management
Edit the primary color in your components:
// Current: #6c47ff (purple)
// Replace with your brand color throughout the app
className="bg-[#6c47ff]"Edit app/components/chat-interface.tsx:
- Adjust message styling
- Change animation timings
- Customize placeholder text
- Add new features
- Framework: Next.js 16 (App Router)
- Language: TypeScript 5
- Styling: Tailwind CSS 4
- Authentication: Clerk
- Icons: Heroicons (SVG)
- Fonts: Geist Sans & Geist Mono
- Push your code to GitHub
- Import to Vercel
- Add environment variables in Vercel dashboard
- Deploy!
Make sure to add these in your hosting platform:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_production_key
CLERK_SECRET_KEY=your_production_secret
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
MIT License - feel free to use this project for personal or commercial purposes.
If you encounter issues:
- Check the Clerk Documentation
- Review Next.js Docs
- Ensure environment variables are set correctly
- Check the browser console for errors
- Connect to real AI API (OpenAI, Claude, etc.)
- Add conversation persistence (database)
- Implement chat history
- Add file upload support
- Create chat templates
- Add voice input/output
- Implement team collaboration features
Built with β€οΈ using Next.js and Clerk