Skip to content

Ahmad-Softwaree/bots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Telegram Bots Showcase

A beautiful, modern landing page to showcase your Telegram bots with a powerful admin dashboard. Built with Next.js 15, Clerk Auth, UploadThing, TanStack Query, shadcn/ui, and Neon PostgreSQL.

Next.js TypeScript TailwindCSS License


πŸ“Έ Screenshots

Home Page

Home Page

Dashboard

Dashboard

✨ Features

🌐 Public Website

  • 🎨 Beautiful Dark Mode - Stunning purple/blue color scheme
  • πŸš€ Lightning Fast - Optimized with Next.js 15 and React Server Components
  • πŸ“± Fully Responsive - Perfect on mobile, tablet, and desktop
  • πŸ”„ Infinite Pagination - Load more bots seamlessly
  • 🎯 Type-Safe - Built with TypeScript and Drizzle ORM
  • πŸ” SEO Optimized - Great for discoverability
  • β™Ώ Accessible - WCAG compliant
  • 🎭 Modern UI - Powered by shadcn/ui- 🌍 Multi-Language - English, Arabic, Kurdish support with next-intl
  • ✨ Smooth Animations - Beautiful transitions with motion

πŸ” Admin Dashboard

  • πŸ”’ Clerk Authentication - Secure admin-only access with dark theme
  • πŸ“€ UploadThing Integration - Upload bot images (4MB max, png/jpeg/webp)
  • ✏️ CRUD Operations - Create, edit, delete bots with modal forms
  • πŸ” Search & Filter - Search by name/description, filter by status
  • πŸŽ›οΈ Status Toggle - Switch bots between Active/Down
  • πŸƒ Card Layout - Beautiful grid layout with bot cards
  • πŸŽ‰ Toast Notifications - Success/error feedback with Sonner
  • βœ… Zod Validation - Type-safe form validation

πŸš€ Quick Start

Prerequisites

  • Node.js 18 or higher (or Bun)
  • Neon database account (free tier)
  • Clerk account (free tier)
  • UploadThing account (free tier)

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd bots
  2. Install dependencies

    bun install
  3. Set up environment variables

    Create .env file in the root:

    # Database
    DATABASE_URL="postgresql://..."
    
    # Clerk Authentication
    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
    CLERK_SECRET_KEY="sk_test_..."
    
    # Admin User ID (Your Clerk User ID)
    ADMIN_USER_ID="user_..."
    NEXT_PUBLIC_ADMIN_USER_ID="user_..."
    
    # UploadThing
    UPLOADTHING_SECRET="sk_live_..."
    UPLOADTHING_APP_ID="..."
  4. Get Clerk Credentials

    • Go to clerk.com and create an account
    • Create a new application
    • Copy API keys from dashboard
    • Sign in to your app and copy your User ID from Clerk Dashboard β†’ Users
    • Add your User ID to both ADMIN_USER_ID and NEXT_PUBLIC_ADMIN_USER_ID
  5. Get UploadThing Credentials

    • Go to uploadthing.com and create an account
    • Create a new app
    • Copy Secret and App ID from dashboard
  6. Set up the database

    bun drizzle-kit generate
    bun drizzle-kit push
  7. Run the development server

    bun dev
    # or npm run dev

    Open http://localhost:3000

🎯 Usage

Public Pages

  • Home (/) - Hero, features, showcase of active bots, CTA with WhatsApp link
  • All Bots (/bots) - All active bots with infinite scroll
  • Bot Detail (/bots/[id]) - Individual bot details

Note: Only active bots are displayed on public pages

Admin Dashboard

  1. Access: Navigate to /admin/dashboard (only visible when signed in as admin)
  2. Search: Type in search box to find bots by name or description
  3. Filter: Select status filter (All, Active, Down)
  4. Create: Click "Add New Bot" β†’ Fill form β†’ Upload images β†’ Submit
  5. Edit: Click "Edit" on any bot card β†’ Update data β†’ Submit
  6. Delete: Click "Delete" β†’ Confirm in dialog
  7. Toggle Status: Use switch on each card to toggle Active/Down

πŸ› οΈ Tech Stack

Category Technology
Framework Next.js 15 (App Router)
Language TypeScript
Styling Tailwind CSS 4
UI Components shadcn/ui (Radix UI)
Icons Lucide React
Animations motion (motion/react)
Internationalization next-intl
URL State Management nuqs
Data Fetching TanStack Query
Database Neon (PostgreSQL)
ORM Drizzle ORM
Authentication Clerk
File Upload UploadThing
Form Validation Zod + React Hook Form
Toast Notifications Sonner
Package Manager Bun
Deployment Vercel

πŸ“ Project Structure

bots/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   └── dashboard/
β”‚   β”‚       └── page.tsx        # Admin dashboard
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── uploadthing/
β”‚   β”‚       β”œβ”€β”€ core.ts         # UploadThing config
β”‚   β”‚       └── route.ts        # API route
β”‚   β”œβ”€β”€ bots/                   # Bot pages
β”‚   β”œβ”€β”€ layout.tsx              # Root layout (Clerk provider)
β”‚   β”œβ”€β”€ page.tsx                # Home page
β”‚   └── providers.tsx           # TanStack Query
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ cards/
β”‚   β”‚   β”œβ”€β”€ BotCard.tsx         # Bot card for home/dashboard
β”‚   β”‚   └── FeatureCard.tsx     # Feature card
β”‚   β”œβ”€β”€ forms/
β”‚   β”‚   └── BotForm.tsx         # Bot create/edit modal
β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   β”œβ”€β”€ header.tsx          # Header with admin link
β”‚   β”‚   └── footer.tsx
β”‚   β”œβ”€β”€ sections/               # Page sections
β”‚   β”œβ”€β”€ shared/                 # Shared components
β”‚   └── ui/                     # shadcn/ui components
β”œβ”€β”€ hooks/
β”‚   β”œβ”€β”€ usePaginationQueries.tsx # Pagination URL params (page, limit)
β”‚   β”œβ”€β”€ useSearchQuery.tsx      # Search URL params
β”‚   β”œβ”€β”€ useBotsQueries.tsx      # Bot status filter params
β”‚   └── use-date.ts             # Date formatting hook
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ react-query/
β”‚   β”‚   β”œβ”€β”€ keys.ts             # Centralized query keys
β”‚   β”‚   β”œβ”€β”€ actions/
β”‚   β”‚   β”‚   β”œβ”€β”€ bot.action.ts   # Bot server actions
β”‚   β”‚   β”‚   └── uploadthing.action.ts
β”‚   β”‚   └── queries/
β”‚   β”‚       β”œβ”€β”€ bot.query.ts    # Bot TanStack Query hooks
β”‚   β”‚       └── uploadthing.query.ts
β”‚   β”œβ”€β”€ db/
β”‚   β”‚   β”œβ”€β”€ client.ts           # Database client
β”‚   β”‚   └── schema.ts           # Drizzle schema
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ cookie.config.ts    # Cookie utilities
β”‚   β”‚   └── pagination.config.ts
β”‚   β”œβ”€β”€ enums.ts                # Enums and constants
β”‚   β”œβ”€β”€ urls.ts                 # Route constants
β”‚   β”œβ”€β”€ utils.ts                # Utility functions (cn)
β”‚   └── uploadthing.ts          # UploadThing config
β”œβ”€β”€ types/
β”‚   └── validation/
β”‚       └── bot.ts              # Zod schemas
β”œβ”€β”€ middleware.ts               # Clerk middleware (admin protection)
└── docs/                       # Documentation

πŸ“Š Database Schema

bots {
  id: UUID;              // Auto-generated
  userId: string;        // Clerk user ID (creator)
  name: string;          // Bot name
  description: string;   // Bot description
  image: string;         // Cover image URL (from UploadThing)
  iconImage: string;     // Icon URL (from UploadThing)
  link: string;          // Telegram bot link
  repoLink: string;      // GitHub repository
  status: 'active' | 'down';  // Bot status
  createdAt: Date;       // Auto-generated
  updatedAt: Date;       // Auto-updated
}

🎨 Security

  • Admin Protection: Middleware checks admin user ID before allowing /admin/* routes
  • Server-Side Validation: All mutations verify admin user ID in server actions
  • Upload Security: UploadThing validates admin before allowing file uploads
  • Public Safety: Public users only see active bots (down bots hidden)

πŸ”„ Data Invalidation

The app uses TanStack Query for automatic cache invalidation:

  • Create Bot: Invalidates admin list, public limited, and public infinite queries
  • Update Bot: Invalidates admin list, public queries, and specific bot query
  • Delete Bot: Invalidates admin list and all public bot queries
  • Toggle Status: Invalidates all bot queries to reflect status changes

This ensures the dashboard and public pages stay in sync automatically!

πŸš€ Deployment

Deploy to Vercel (Recommended)

  1. Push your code to GitHub
  2. Import project on Vercel
  3. Add environment variables:
    • DATABASE_URL
    • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
    • CLERK_SECRET_KEY
    • ADMIN_USER_ID
    • NEXT_PUBLIC_ADMIN_USER_ID
    • UPLOADTHING_SECRET
    • UPLOADTHING_APP_ID
  4. Deploy!

Build Locally

bun run build
bun run start

πŸ“ Scripts

bun dev              # Start development server
bun build            # Build for production
bun start            # Start production server
bun lint             # Run ESLint
bun drizzle-kit generate  # Generate Drizzle migrations
bun drizzle-kit push      # Push schema to database

🀝 Contributing

Contributions are welcome! Please read AGENTS.md for coding standards.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

πŸ“– Documentation

πŸ“„ License

MIT License - feel free to use for your projects!

πŸ™ Acknowledgments


Built with ❀️ for the Telegram bot community

⭐ Star this repo

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published