A full-stack application featuring a Telegram bot that provides weather updates and an administrative panel for user management. Built with NestJS, React, and PostgreSQL.
Admin_Panel = https://telegram-weather-bot-1-e9yo.onrender.com/
Bot_Link = https://t.me/hs918131_ast_bot
I have used Tomorrow.io Weather API
- Daily weather updates for subscribed users
- Real-time weather information on demand
- Location-based weather forecasts
- User subscription management
- Secure Google OAuth authentication
- Comprehensive user management
- View all subscribers
- Block/unblock users
- Delete user accounts
- Bot settings management
- Weather API key configuration
- Telegram bot token management
- Real-time user activity monitoring
- NodeJS - TypeScript-based Node.js framework
- Prisma ORM - Database management and migrations
- PostgreSQL - Primary database
- nestjs-telegraf - Telegram bot integration
- @nestjs/schedule - Scheduled tasks for daily updates
- React - UI framework
- Tailwind CSS - Styling
telegram-weather-bot/
βββ backend/
β βββ src/
β β βββ admin/ # Admin panel logic
β β βββ auth/ # Authentication
β β βββ config/ # Configuration
β β βββ prisma/ # Database connection
β β βββ telegram/ # Telegram bot logic
β β βββ weather/ # Weather API integration
β β βββ app.module.ts
β β βββ main.ts
β βββ prisma/
β βββ schema.prisma # Database schema
βββ frontend/
β βββ src/
β β βββ components/AdminPanel
β β βββ App.jsx
β βββ public/
β βββ package.json
βββ README.md
- NestJS
- PostgreSQL
- Telegram Bot Token (from BotFather)
- Weather API Key
- Google OAuth credentials
bash
git clone <https://github.com/Hs918131/Telegram_Weather_Bot>
cd telegram-weather-bot
bash
cd backend
npm install
cp .env.example .env
npx prisma generate
npx prisma db push
npm run start:dev
bash
cd frontend
npm install
npm start
Create .env files in both backend and frontend directories:
Backend (.env) env
-
DATABASE_URL="postgresql://user:password@localhost:5432/telegram_bot" -
PORT=3000 -
TELEGRAM_BOT_TOKEN="your_bot_token" -
WEATHER_API_KEY="your_weather_api_key" -
GOOGLE_CLIENT_ID="your_google_client_id" -
GOOGLE_CLIENT_SECRET="your_google_client_secret" -
JWT_SECRET="your_jwt_secret"
Frontend (.env) env
-
VITE_FIREBASE_API_KEY=your_api_key -
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com -
VITE_FIREBASE_PROJECT_ID=your_project_id -
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com -
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id -
VITE_FIREBASE_APP_ID=your_app_id
- /start - Initialize the bot
- /subscribe - Subscribe to daily weather updates
- /unsubscribe - Unsubscribe from updates
- /weather - Get current weather
- GET /admin/users - List all users
- GET /admin/users/:id - Get specific user
- POST /admin/users/:id/:action - Perform user action (block/unblock)
- DELETE /admin/users/:id - Delete user
- GET /admin/settings - Get bot settings
- PUT /admin/settings - Update bot settings
bash
npx prisma migrate dev --name migration_name
npx prisma migrate deploy
bash
cd backend
npm run test
cd frontend
npm test
- Fork the repository
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.