Back to list
Jawad-Chaudhary

nextjs-chatkit

by Jawad-Chaudhary

The Evolution of Todo: A spec-driven, AI-native journey from a Python CLI to a Cloud-Native, Event-Driven AI Chatbot deployed on Kubernetes. Built with Claude Code, Spec-Kit Plus, Next.js, FastAPI, and Dapr.

0🍴 0📅 Jan 22, 2026

SKILL.md


name: nextjs-chatkit description: Integrate OpenAI ChatKit in Next.js 15 App Router with domain allowlist, authentication, and API connections. Use when building chat interfaces or ChatKit integration.

Next.js ChatKit Integration

Environment Setup

NEXT_PUBLIC_OPENAI_DOMAIN_KEY=your_domain_key
NEXT_PUBLIC_API_URL=http://localhost:8000

Chat Page (app/chat/page.tsx)

'use client';

import { ChatKit } from '@openai/chatkit';
import { useAuth } from '@/lib/auth';

export default function ChatPage() {
  const { user, token } = useAuth();

  const handleMessage = async (message: string, conversationId?: number) => {
    const response = await fetch(
      `${process.env.NEXT_PUBLIC_API_URL}/api/${user.id}/chat`,
      {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${token}`,
        },
        body: JSON.stringify({ conversation_id: conversationId, message }),
      }
    );
    const data = await response.json();
    return data.response;
  };

  return (
    <ChatKit
      domainKey={process.env.NEXT_PUBLIC_OPENAI_DOMAIN_KEY!}
      onMessage={handleMessage}
      placeholder="Ask me to manage your tasks..."
    />
  );
}

Domain Allowlist Setup

  1. Deploy frontend to get URL (e.g., https://app.vercel.app)
  2. Add domain at: https://platform.openai.com/settings/organization/security/domain-allowlist
  3. Copy generated domain key
  4. Set NEXT_PUBLIC_OPENAI_DOMAIN_KEY in Vercel env vars

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon