Posts

Showing posts from June, 2025

Why Vercel Fails with Telegram Bots — And How I Fixed It

Telegram bots are powerful tools — but deploying them can be tricky, especially on platforms like Vercel. In this blog, I’ll walk you through the exact problem I faced, why it happened, what background workers are, and how I solved it using a smarter hosting approach. 🚨 1. The Problem with Vercel and Telegram Bots 🧠 A. How Vercel Works Vercel is optimized for serverless web applications like Next.js , React , and static sites . It runs short-lived serverless functions that start on HTTP requests and stop after a response. Designed for websites and APIs — not long-running scripts. 🤖 B. How Telegram Bots Work Bots typically use long polling — keeping a connection open with Telegram to wait for messages. Requires a 24/7 running process — something Vercel doesn't allow. 💥 C. The Core Problem Vercel kills long-running processes — including your Telegram bot. Symptoms you may encounter: The bot doesn't respond at all. Crashes after a few s...

How to Build a Telegram Bot Using Node.js – Step-by-Step Guide

Image
How to Build a Telegram Bot Using Node.js – Step-by-Step Guide   Creating your own Telegram bot is easier than you think. In this guide, I’ll walk you through the complete process — from setting up your bot with BotFather , writing the bot using Node.js , to deploying it live 24/7 using Render . username: tns_server_error_bot 🧭 Step 1: Create a Bot on Telegram Using BotFather Open Telegram app In the search bar, type: BotFather Start the chat and type /start Then type /newbot and follow the steps: Choose a name for your bot (e.g., TNS Server Bot ) Choose a username that must end with _bot (e.g., tns_server_error_bot ) Copy the HTTP API token that BotFather gives you — we’ll use this later in our .env file. 💻 Step 2: Set Up Y our Project in VS Code (or Cursor) Open your preferred IDE (I used Cursor but you can use VS Code) Create a new folder for your project: mkdir tns_server_error_bot cd tns_server_error_bot Initiali...

Building a Simple Chatbot with Google Generative AI

Image
Build a Chatbot with Google Generative AI – Step-by-Step Guide  In this blog post, we'll walk through the steps to create a basic chatbot using Google's Generative AI (Gemini) that can remember user-provided information and retrieve it later.    Step 1: Setting Up Google Generative AI    First, we need to set up the Google Generative AI (genai) with an API key:   ```python   import google.generativeai as genai   import json   import os   # Set up Google Generative AI   genai.configure(api_key="API_KEY")  # Replace with your actual API key   ```   # Step 2: Memory Management with JSON   The chatbot will store and retrieve user data using a JSON file (`memory.json`).   # Loading Memory    ```python   MEMORY_FILE = "memory.json"   # Load memory from JSON file    def load_memory():       if os....

Firebase Authentication Starter Guide: Building a Secure Login System

Firebase Authentication Starter Guide – Build a Secure Login System Introduction This guide walks you through creating a complete authentication system using Firebase. We'll cover email/password login, signup, password reset, and user session management.  The project includes: - Login/Signup forms - Password recovery - Welcome dashboard - Session persistence Project Structure auth-starter-master/ ├── firebase.js          # Firebase configuration ├── index.css            # Styling for auth pages ├── index.html           # Login/Signup page ├── index.js             # Auth logic ├── welcome.html         # Dashboard after login └── welcome.js           # Logout functionality 1. Firebase Configuration (firebase.js) ```javascript const firebaseConfig = {   apiKey: "Your Key",   authDomain: "Your A...

How to Set Up Firebase with a Web Application

Image
How to Set Up Firebase with a Web Application – Step-by-Step Guide This guide walks you through the complete process of integrating Firebase into a basic web app using CDN links and Firebase console setup . 🔹 Step 1: Create a Firebase Project Go to https://firebase.google.com Click on "Get Started" or "Go to Console" Click "Add Project" Name your project: 👉 Dean-Project Click Continue Enable Google Analytics (toggle ON) Click Continue Choose Default Account for Firebase Click Create Project 🔄 Firebase will now take a few moments to set up your project. Once complete, click Continue 🔹 Step 2: Register Your Web App In Firebase Console, go to Project Overview Click on the Web icon (</>) to register a web app Enter your app name: 👉 Ry-app ❌ Do not check "Also set up Firebase Hosting" Click Register App Firebase will now generate a JavaScript snippet – Copy this code ...