diff --git a/.env.example b/.env.example index 6a40fdd..aa12f4c 100644 --- a/.env.example +++ b/.env.example @@ -4,16 +4,27 @@ AUTH_SECRET=**** # The following keys below are automatically created and # added to your environment when you deploy on vercel -# Get your xAI API Key here for chat and image models: https://console.x.ai/ -XAI_API_KEY=**** - # Instructions to create a Vercel Blob Store here: https://vercel.com/docs/storage/vercel-blob BLOB_READ_WRITE_TOKEN=**** +# Get your Composio API Key here: https://app.composio.dev/developers +COMPOSIO_API_KEY=**** + +# Composio Authentication Integration IDs +# Create these integrations in your Composio dashboard +NEXT_PUBLIC_COMPOSIO_AUTH_GITHUB=**** +NEXT_PUBLIC_COMPOSIO_AUTH_GMAIL=**** +NEXT_PUBLIC_COMPOSIO_AUTH_GOOGLECALENDAR=**** +NEXT_PUBLIC_COMPOSIO_AUTH_LINEAR=**** +NEXT_PUBLIC_COMPOSIO_AUTH_NOTION=**** +NEXT_PUBLIC_COMPOSIO_AUTH_SLACK=**** + # Instructions to create a PostgreSQL database here: https://vercel.com/docs/storage/vercel-postgres/quickstart POSTGRES_URL=**** - # Instructions to create a Redis store here: # https://vercel.com/docs/redis REDIS_URL=**** + +# Get your Anthropic API Key here: https://console.anthropic.com/ +ANTHROPIC_API_KEY=**** \ No newline at end of file diff --git a/README.md b/README.md index 44a8cb2..ab678e3 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,90 @@ - - Next.js 14 and App Router-ready AI chatbot. -

Chat SDK

-
- -

- Chat SDK is a free, open-source template built with Next.js and the AI SDK that helps you quickly build powerful chatbot applications. -

- -

- Read Docs · - Features · - Model Providers · - Deploy Your Own · - Running locally -

-
+# AI Chat Application + +A full-stack AI chatbot application built with Next.js 15, Anthropic Claude, and Composio integration. + +## Tech Stack + +- **Next.js 15** - App Router with React Server Components +- **AI SDK** - Anthropic Claude integration (claude-4-sonnet) +- **Composio** - Third-party app integrations (300+ apps) +- **Drizzle ORM** - PostgreSQL database +- **Auth.js** - Authentication system +- **shadcn/ui** - UI components with Tailwind CSS ## Features -- [Next.js](https://nextjs.org) App Router - - Advanced routing for seamless navigation and performance - - React Server Components (RSCs) and Server Actions for server-side rendering and increased performance -- [AI SDK](https://sdk.vercel.ai/docs) - - Unified API for generating text, structured objects, and tool calls with LLMs - - Hooks for building dynamic chat and generative user interfaces - - Supports xAI (default), OpenAI, Fireworks, and other model providers -- [shadcn/ui](https://ui.shadcn.com) - - Styling with [Tailwind CSS](https://tailwindcss.com) - - Component primitives from [Radix UI](https://radix-ui.com) for accessibility and flexibility -- Data Persistence - - [Neon Serverless Postgres](https://vercel.com/marketplace/neon) for saving chat history and user data - - [Vercel Blob](https://vercel.com/storage/blob) for efficient file storage -- [Auth.js](https://authjs.dev) - - Simple and secure authentication +- Real-time AI chat with Claude models +- Multiple artifact types (code, documents, images, spreadsheets) +- File upload and document processing +- Chat history with public/private visibility +- User voting and suggestions system +- Multi-modal input support +- Third-party app integrations via Composio -## Model Providers +## Getting Started -This template ships with [xAI](https://x.ai) `grok-2-1212` as the default chat model. However, with the [AI SDK](https://sdk.vercel.ai/docs), you can switch LLM providers to [OpenAI](https://openai.com), [Anthropic](https://anthropic.com), [Cohere](https://cohere.com/), and [many more](https://sdk.vercel.ai/providers/ai-sdk-providers) with just a few lines of code. +### Prerequisites -## Deploy Your Own +- Node.js 18+ +- PostgreSQL database +- pnpm package manager -You can deploy your own version of the Next.js AI Chatbot to Vercel with one click: +### Installation -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fai-chatbot&env=AUTH_SECRET&envDescription=Learn+more+about+how+to+get+the+API+Keys+for+the+application&envLink=https%3A%2F%2Fgithub.com%2Fvercel%2Fai-chatbot%2Fblob%2Fmain%2F.env.example&demo-title=AI+Chatbot&demo-description=An+Open-Source+AI+Chatbot+Template+Built+With+Next.js+and+the+AI+SDK+by+Vercel.&demo-url=https%3A%2F%2Fchat.vercel.ai&products=%5B%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22ai%22%2C%22productSlug%22%3A%22grok%22%2C%22integrationSlug%22%3A%22xai%22%7D%2C%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22storage%22%2C%22productSlug%22%3A%22neon%22%2C%22integrationSlug%22%3A%22neon%22%7D%2C%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22storage%22%2C%22productSlug%22%3A%22upstash-kv%22%2C%22integrationSlug%22%3A%22upstash%22%7D%2C%7B%22type%22%3A%22blob%22%7D%5D) +1. Clone the repository +2. Install dependencies: + ```bash + pnpm install + ``` -## Running locally +3. Set up environment variables: + - Copy `.env.example` to `.env` + - Add your Composio API key from [app.composio.dev](https://app.composio.dev/developers) + - Configure database connection + - Set up authentication providers -You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js AI Chatbot. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/projects/environment-variables) for this, but a `.env` file is all that is necessary. +4. Run database migrations: + ```bash + pnpm db:migrate + ``` -> Note: You should not commit your `.env` file or it will expose secrets that will allow others to control access to your various AI and authentication provider accounts. +5. Start the development server: + ```bash + pnpm dev + ``` -1. Install Vercel CLI: `npm i -g vercel` -2. Link local instance with Vercel and GitHub accounts (creates `.vercel` directory): `vercel link` -3. Download your environment variables: `vercel env pull` +## Development Commands -```bash -pnpm install -pnpm dev +- `pnpm dev` - Start development server +- `pnpm build` - Build for production +- `pnpm lint` - Run linting with auto-fix +- `pnpm format` - Format code with Biome +- `pnpm test` - Run e2e tests +- `pnpm db:studio` - Open database studio + +## Project Structure + +``` +/app/(auth)/ - Authentication routes +/app/(chat)/ - Main chat interface +/artifacts/ - Artifact type components +/components/ - Reusable UI components +/lib/ai/ - AI model configuration +/lib/db/ - Database schema +/hooks/ - Custom React hooks +/tests/ - Playwright tests ``` -Your app template should now be running on [localhost:3000](http://localhost:3000). +## Composio Integration + +This app integrates with Composio to provide access to 300+ third-party applications. Users can connect their accounts and use them as tools within the chat interface. + +For Composio documentation, see `composio-docs.md`. + +## Contributing + +Please refer to `CLAUDE.md` for development guidelines and best practices. + +## License + +MIT \ No newline at end of file diff --git a/app/layout.tsx b/app/layout.tsx index 1813e0f..89c8b81 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -7,9 +7,9 @@ import './globals.css'; import { SessionProvider } from 'next-auth/react'; export const metadata: Metadata = { - metadataBase: new URL('https://chat.vercel.ai'), - title: 'Next.js Chatbot Template', - description: 'Next.js chatbot template using the AI SDK.', + metadataBase: new URL('https://chat.composio.dev'), + title: 'Composio AI Chat', + description: 'AI-powered chat application with 300+ app integrations via Composio.', }; export const viewport = { diff --git a/instrumentation.ts b/instrumentation.ts index 9e0fa0d..7af94f4 100644 --- a/instrumentation.ts +++ b/instrumentation.ts @@ -1,5 +1,5 @@ import { registerOTel } from '@vercel/otel'; export function register() { - registerOTel({ serviceName: 'ai-chatbot' }); + registerOTel({ serviceName: 'composio-chat' }); } diff --git a/package.json b/package.json index d3b24d4..3ebeda4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ai-chatbot", + "name": "composio-chat", "version": "3.0.23", "private": true, "scripts": {