If you build a Telegram bot with aiogram 3 (or Pyrogram / python-telegram-bot) and store user state in SQLite or .session files, deploying to a typical free web PaaS usually ends in two ways:
- Your bot goes silent after 15 minutes because no inbound HTTP traffic hit the container.
- Every restart wipes your local
bot_data.dbbecause the container disk is ephemeral.
Here is a copy-pasteable aiogram 3 + sqlite3 starter and how to run it 24/7 for free on persistent x86_64 NVMe storage without a credit card.
Quick Comparison: Why Most Free Tiers Break Polling Bots
| Hosting Type | Sleep Timer? | Persistent SQLite / .session? |
Free RAM / Arch | Credit Card? |
|---|---|---|---|---|
| HTTP-First Free PaaS (e.g. Render Free) | Yes (15 min idle) | No (ephemeral wipe) | 512 MB | No |
| Micro Bot Containers | No | Often tight disk | 100–128 MB (easy OOM) | No |
| Arm64 Free Nodes | Weekly renew | Yes | Arm64 (native wheel issues) | No |
| BotHoster (Pterodactyl Docker) | No (24/7) | Yes (2 GB NVMe) | 512 MB x86_64 | No |
Step 1: Minimal aiogram 3 + Persistent SQLite Bot
Create main.py:
import asyncio
import os
import sqlite3
from aiogram import Bot, Dispatcher, types
from aiogram.filters import CommandStart
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("BOT_TOKEN")
conn = sqlite3.connect("bot_data.db")
conn.execute(
"CREATE TABLE IF NOT EXISTS users (user_id INTEGER PRIMARY KEY, username TEXT)"
)
conn.commit()
dp = Dispatcher()
@dp.message(CommandStart())
async def start_handler(message: types.Message):
conn.execute(
"INSERT OR REPLACE INTO users (user_id, username) VALUES (?, ?)",
(message.from_user.id, message.from_user.username or "unknown"),
)
conn.commit()
await message.answer("Bot is live 24/7 and your profile is persisted in SQLite!")
async def main():
bot = Bot(token=TOKEN)
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())
Create requirements.txt:
aiogram>=3.10.0
python-dotenv>=1.0.1
Step 2: Deploy 24/7 on BotHoster in Under 3 Minutes
BotHoster runs isolated x86_64 Docker containers orchestrated by Pterodactyl Wings on NVMe SSD nodes (Sydney cluster—especially fast for APAC, Vietnam, and Australia):
- Sign in via Discord OAuth or Email at bothoster.top (zero credit card needed).
- Create a Basic (512 MB RAM / 2 GB NVMe) container and pick the Python 3.12 egg (12 runtimes supported total, including Node.js, Bun, Go, Rust, Java, C#, Deno, Dart, Elixir, Lua).
- Click Panel SSO, upload
main.py,requirements.txt, and.env(BOT_TOKEN=your_token) via Web File Manager or SFTP. - Set
main.pyin the Startup tab and click Start in Console.
Transparent Billing Notes
- Free containers run on pay-as-you-go hourly coins (
1.00 Coin/hrearned via dashboard AFK earner, tasks, or referrals). - Stopping your container freezes coin deductions immediately, and hitting zero balance gives a 3-day grace period (your
bot_data.dbstays intact). - Live cluster RAM, ping, and 90-day uptime are public at bothoster.top/status.
Drop a comment if you run into any aiogram or Pterodactyl setup issues!
Top comments (0)