Skip to content

mdb1710/AI-Agent-Starter-Kit

 
 

Repository files navigation

๐Ÿค– Collab-Thon AI Bot Template

A modern full-stack AI-enabled template using Next.js for frontend and Express.js for backend, with Telegram and OpenAI integrations! โœจ

๐ŸŽฏ Cursor IDE Integration

This template is specially crafted for the Cursor IDE, offering:

  • ๐Ÿค– AI-assisted development with inline code explanations
  • ๐Ÿ” Smart environment variable setup assistance
  • ๐Ÿ’ก Intelligent error resolution
  • ๐Ÿ“ Context-aware code completion
  • ๐Ÿ› ๏ธ Built-in debugging helpers

Just highlight any error message, code snippet, or variable in Cursor and ask the AI for help!

๐ŸŽฎ Quick Cursor Commands

  • Cmd/Ctrl + K: Ask AI about highlighted code
  • Cmd/Ctrl + L: Get code explanations
  • Cmd/Ctrl + I: Generate code completions
  • Highlight any error message to get instant fixes

๐Ÿš€ Getting Started

  1. Prerequisites:
node >= 22 ๐ŸŸข
pnpm >= 9.14.1 ๐Ÿ“ฆ
  1. Install dependencies:
pnpm install
  1. Fire up the dev servers:
pnpm run dev

๐Ÿ“ Repository Structure

.
โ”œโ”€โ”€ ๐Ÿ“ฆ client/                 # Next.js frontend
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฑ app/               # Next.js app router (pages, layouts)
โ”‚   โ”œโ”€โ”€ ๐Ÿงฉ components/        # React components
โ”‚   โ”‚   โ””โ”€โ”€ HelloWorld.tsx    # Example component with API integration
โ”‚   โ”œโ”€โ”€ ๐Ÿ’… styles/           # Global styles and Tailwind config
โ”‚   โ”‚   โ”œโ”€โ”€ globals.css      # Global CSS and Tailwind imports
โ”‚   โ”‚   โ””โ”€โ”€ tailwind.config.ts # Tailwind configuration
โ”‚   โ”œโ”€โ”€ ๐Ÿ› ๏ธ bin/             # Client scripts
โ”‚   โ”‚   โ””โ”€โ”€ validate-env     # Environment variables validator
โ”‚   โ”œโ”€โ”€ next.config.js       # Next.js configuration (API rewrites)
โ”‚   โ”œโ”€โ”€ .env.example         # Example environment variables for client
โ”‚   โ””โ”€โ”€ tsconfig.json        # TypeScript configuration
โ”‚
โ”œโ”€โ”€ โš™๏ธ server/               # Express.js backend
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ src/             # Server source code
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ›ฃ๏ธ routes/     # API route handlers
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ hello.ts    # Example route with middleware
โ”‚   โ”‚   โ””โ”€โ”€ index.ts        # Server entry point (Express setup)
โ”‚   โ”œโ”€โ”€ ๐Ÿ› ๏ธ bin/            # Server scripts
โ”‚   โ”‚   โ”œโ”€โ”€ validate-env    # Environment validator
โ”‚   โ”‚   โ””โ”€โ”€ www-dev        # Development server launcher
โ”‚   โ””โ”€โ”€ tsconfig.json       # TypeScript configuration
โ”‚
โ”œโ”€โ”€ ๏ฟฝ๏ฟฝ๏ฟฝ scripts/             # Project scripts
โ”‚   โ””โ”€โ”€ dev                 # Concurrent dev servers launcher
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ .env.example         # Root environment variables example for server
โ”œโ”€โ”€ ๐Ÿ”ง package.json         # Root package with workspace config
โ””โ”€โ”€ ๐Ÿ“ฆ pnpm-workspace.yaml  # PNPM workspace configuration

๐Ÿ” Environment Variables

๐Ÿ’ก Pro Tip: In Cursor IDE, highlight any environment variable name and ask the AI for setup instructions!

Client (.env)

  • NEXT_PUBLIC_API_URL: Backend API URL (default: http://localhost:3001) ๐ŸŒ
  • NEXT_PUBLIC_TELEGRAM_BOT_NAME: Telegram bot name without the @ symbol, you can get it from BotFather after creating your bot (default: your_bot_username) ๐Ÿค–

Server (.env)

๐Ÿ”’ Note: Keep these tokens secure! Never commit them to version control. The template's .gitignore has your back!

๐Ÿš€ Production Setup

  1. Build both apps:
pnpm run build
  1. Launch production servers:
pnpm start
  1. For production deployment: ๐ŸŒŽ
  • Set NODE_ENV=production
  • Use proper SSL certificates ๐Ÿ”’
  • Configure CORS settings in server/src/index.ts ๐Ÿ›ก๏ธ
  • Set up error handling and logging ๐Ÿ“
  • Use process manager like PM2 โšก

๐Ÿ”ง Advanced Usage

๐ŸŽฏ Adding New Environment Variables

  1. Client:
const ENV_HINTS = {
  NEXT_PUBLIC_API_URL: "Your API URL (usually http://localhost:3001)",
  // Add more hints as needed! โœจ
};
  1. Server:
const ENV_HINTS = {
  PORT: "API port (usually 3001)",
  NODE_ENV: "development or production",
  TELEGRAM_BOT_TOKEN: "Get from @BotFather",
  OPENAI_API_KEY: "Get from OpenAI dashboard",
  NGROK_AUTH_TOKEN: "Get from ngrok dashboard",
  // Add more hints as needed! โœจ
};
  1. Add TypeScript types in respective env.d.ts files ๐Ÿ“

๐Ÿ›ฃ๏ธ API Routes

  1. Create new route file in server/src/routes/
  2. Import and use in server/src/index.ts
  3. Add corresponding client API call in client/components/

๐ŸŽจ Frontend Components

  1. Create component in client/components/
  2. Use Tailwind CSS for styling ๏ฟฝ๏ฟฝ
  3. Follow existing patterns for API integration

โš™๏ธ Backend Middleware

  1. Create middleware in server/src/middleware/
  2. Apply globally or per-route basis

๐Ÿช™ Minting Tokens

  1. Copy the token metadata template:
cp token_metadata.example.jsonc token.jsonc
  1. Edit token.jsonc with your token details:
{
  "name": "YourToken", // Token name
  "symbol": "TOKEN", // Token symbol (2-6 chars)
  "description": "Your token description", 
  "websiteLink": "https://yoursite.com",
  "twitter": "your_twitter_handle",
  "discord": "https://discord.gg/your_server", 
  "telegram": "your_bot_telegram_username",
  "nsfw": false,
  "image": "ipfs://your_ipfs_hash" // Upload image to IPFS first
}
  1. Update .env to point to your token file:
TOKEN_DETAILS_PATH=token.jsonc
  1. Start your bot and use the /mint command in Telegram. The bot will:
  • Read your token config
  • Mint on Base Sepolia testnet
  • Return contract details and token page URL

Note: Make sure you have set up your COLLABLAND_API_KEY and TELEGRAM_BOT_TOKEN in .env first.

๐Ÿ“š Sources

About

Collab.Land AI Agent Starter Kit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 87.9%
  • JavaScript 11.3%
  • CSS 0.8%