KitDev / Guides / Installation
Installation
Requirements
- A VPS or a PC running Linux or Windows
- Python 3.10 or higher (tested on 3.12 and 3.14)
- Git
- A Telegram account
API_IDandAPI_HASHof your account (you get them in step 2)
Step-by-step deployment
If you use a VPS, connect first over SSH:
ssh usuario@IP_DEL_SERVIDOR1. Install Git, Python and an editor
Linux (Debian / Ubuntu):
sudo apt update && sudo apt upgrade -ysudo apt install -y git python3 python3-pip python3-venv nano build-essential python3-dev
Linux (Arch / CachyOS / Manjaro):
sudo pacman -Syu --needed git python python-pip nano base-develWindows (PowerShell):
winget install Git.Gitwinget install Python.Python.3.12
On Windows you can also install Python from python.org and Git from git-scm.com. During the Python installation, check the Add Python to PATH box. Close and reopen the terminal when it finishes.
Check that everything is installed:
git --versionpython3 --version
(On Windows use python --version.) It must show Python 3.10 or higher.
2. Get your API_ID and API_HASH
- Go to my.telegram.org and log in with your number.
- Open API development tools.
- Create an application (the name is up to you).
- Copy the
api_idand theapi_hash.
3. Clone the repository
git clone https://github.com/ronnypro1/KitDev.gitcd KitDev
4. Create and activate the virtual environment
Linux and macOS (bash / zsh):
python3 -m venv venvsource venv/bin/activate
Linux with fish:
python3 -m venv venvsource venv/bin/activate.fish
Windows (PowerShell):
python -m venv venvvenv\Scripts\Activate.ps1
If PowerShell blocks the script, first run Set-ExecutionPolicy -Scope Process Bypass and repeat the command.
When the environment is active, the terminal shows (venv) at the start of the line.
5. Install the dependencies
pip install -r requirements.txt6. Generate your session (SESSION_STRING)
With the virtual environment active, run:
python3 gen_session.py(On Windows: python gen_session.py.)
The script will ask you, in order, for:
API_IDAPI_HASH- Your phone number with country code (for example
+593...) - The code Telegram sends to your app
- Your two-step verification password, only if you have it enabled
When it finishes, the session arrives in your Telegram Saved Messages, in a message that says KitDev SESSION_STRING. Copy it from there, without the backticks (`).
The SESSION_STRING gives full access to your account. Don't share it with anyone, don't upload it to GitHub and don't paste it in screenshots. If you think it leaked, go to Telegram → Settings → Privacy and Security → Devices and close that session.
Use a different session for each installation (your PC, your VPS, etc.). If the same session is used in two places at once, Telegram invalidates it.
Want to generate it on another device, for example your phone, without cloning the repository? There is one command per system (Linux, macOS, Windows and Termux) in Get the SESSION_STRING.
7. Configure the .env file
Copy the template:
cp .env.example .env(On Windows: copy .env.example .env.)
Open .env with the editor of your choice:
nano .envFill it in. After the = goes the value, without quotes or spaces:
API_ID=123456 API_HASH=tu_api_hash SESSION_STRING=la_cadena_completa PREFIX=. LOG_CHAT_ID= BOT_TOKEN= DEV_MODE=false DEV_KEY=
| Variable | Required | Description |
|---|---|---|
API_ID |
Yes | Numeric ID from my.telegram.org |
API_HASH |
Yes | Hash from my.telegram.org (32 characters) |
SESSION_STRING |
Yes | Session generated with gen_session.py |
PREFIX |
No | Command prefix (default .). Any symbol or emoji works, 1 to 3 characters and no spaces, for example 🔥 or 𑂅. It can also be changed from the assistant settings, with no restart, and that wins over the .env |
SUDO_PREFIX |
No | Prefix used by people with sudo (default !) |
DATABASE_URL |
No | Database: empty uses SQLite; mongodb://... or mongodb+srv://... uses MongoDB, local or Atlas; postgresql://... uses PostgreSQL, local, Supabase or Neon (see Database) |
DATABASE_NAME |
No | Database name in MongoDB (by default, the one in the URI or kitdev); in PostgreSQL it goes in the URI |
AUTO_RESTORE |
No | With an empty disk and LOG_CHAT_ID set, restores the latest automatic backup from the logs group (default true; false turns it off) |
LOG_CHAT_ID |
No | ID of a group of your own for the logs. If you leave it empty, KitDev creates one automatically |
BOT_TOKEN |
No | Token of a bot of your own. If you leave it empty, KitDev creates the assistant bot by itself |
DEV_MODE |
No | true enables dev mode. Off by default |
DEV_KEY |
Only with DEV_MODE=true |
Key to unlock dev mode from Telegram |
Save and exit depending on the editor:
- nano:
Ctrl+OandEnterto save,Ctrl+Xto exit. - vim: press
ito edit, thenEsc, type:wqandEnterto save and exit. To exit without saving,Escand:q!. - VS Code: open the file and save with
Ctrl+S. - Windows:
notepad .env.
The .env file is in the .gitignore, so it is not uploaded to the repository.
On startup, KitDev checks the .env. If a variable is missing or misspelled, it says so and stops without asking for your phone. If you get a name wrong (for example SESSION= instead of SESSION_STRING=), it tells you how to rename it.
8. Run
python3 -m kitdev(On Windows: python -m kitdev.)
The console shows the KitDev logo, a progress bar while loading the plugins and KitDev v0.1.0 iniciado como Name (@username, id ...). To stop it use Ctrl+C.
On the first run KitDev sets everything up by itself, and it takes a few extra seconds:
- It creates the assistant bot with BotFather, sets a photo and enables its inline mode.
- It creates a private supergroup called KitDev Logs and adds the bot.
- When the console shows "KitDev active", the bot sends the "KitDev has been deployed!" message there (see Deployment message and updates). When you stop it, it sends
🛑 KitDev detenido.
The group ID, the bot token and the values you save with .setdb are stored in data/state.json. If you delete the logs group, KitDev creates a new one on the next start.
data/state.json contains the token of your assistant bot. It is in the .gitignore: don't upload or share it. On Linux it is saved with permissions for your user only. Don't delete it entirely either, because the token would be lost (another bot would be created) along with the values saved with .setdb. To change only the logs group, use LOG_CHAT_ID in the .env.
[!NOTE]
The data/ folder holds everything of yours: state.json, the kitdev.sqlite3 database (bot users, snips and warnings), addons/ and media/. It is in the .gitignore. If you change servers, copy the whole data/ folder.
[!NOTE] Telegram may apply to new groups the message auto-delete you have set on your account. If you want to keep the logs, turn it off in the group settings.
If you close the terminal, the userbot stops. To keep it always on, see Background.
Termux (Android)
KitDev runs on Termux. It is tested on an Android tablet (aarch64, Python 3.14). Install Termux from F-Droid or from GitHub: the Google Play version may be outdated.
Automatic installer (recommended)
A single command does everything, with a menu of numbers:
wget -O install-termux https://darkangelbots.dev/kitdev/install-termux.sh && bash install-termux
The installer guides you step by step, with the same progress bar as KitDev's console:
- It installs the Termux packages and downloads KitDev to
~/KitDev. - It creates the virtual environment and installs the dependencies (if
pipfails, it tries only the minimum). - It asks for your
API_IDandAPI_HASHand generates your session right there, without you copying anything. If you already have one, you choose Skip (the one in the.envstays) or paste it. - It asks for the prefix, whether to enable the addons, whether you want your own bot and logs group and which database to use (SQLite, MongoDB or PostgreSQL with a URI; it installs
pymongoorpg8000and moves your data if needed). - It lets you start KitDev or leave it in the background with
tmuxandtermux-wake-lock.
When it finishes, bash ~/KitDev/install-termux.sh opens the menu again: there you can generate the session, configure the .env, update KitDev, start it or edit the .env with nano. You can run it as many times as you like: it deletes nothing and, if you press Enter, it keeps what you already have in the .env.
- If the repository is private, the installer asks for a read-only GitHub token when downloading and updating. It is not saved in any file.
- The first thing it asks is the installer's language: Spanish, English or Portuguese (it suggests your phone's). To set it without asking:
KITDEV_LANG=en bash install-termux(es,enorpt). - For another folder or branch:
KITDEV_DIR=~/my-kitdev KITDEV_BRANCH=dev bash install-termux. - It is only for Termux: on other systems follow the steps in the sections above.
By hand
If you prefer to do it yourself:
pkg update -y && pkg upgrade -ypkg install -y python git clang make nanogit clone https://github.com/ronnypro1/KitDev.gitcd KitDevpython -m venv venvsource venv/bin/activatepip install -r requirements.txtpython gen_session.pycp .env.example .envnano .envpython -m kitdev
This is how it looks on an Android tablet (aarch64, Python 3.14):
- Ctrl on the keyboard: use the
CTRLkey on Termux's extra row. Innano,Ctrl+OandEntersave, andCtrl+Xexits. - First run: it takes a few extra seconds, because it creates the logs group and the assistant bot.
- One session per installation: if you already use KitDev on a VPS, generate a new session for the phone. With the same session in two places, Telegram invalidates it.
If pip install -r requirements.txt fails. uvloop and tgcrypto are optional accelerations: KitDev works without them. If one fails to compile (it usually happens with older Python versions on Termux, which identify as Linux), install the minimum:
pip install kurigram==2.2.26 python-dotenv tzdatapip install tgcrypto
If tgcrypto also fails, skip it. The TgCrypto is missing warning is harmless.
Keeping it on. Android may close Termux to save battery. To reduce the risk:
termux-wake-lockpkg install -y tmuxtmux new -s kitdev
Run python -m kitdev inside tmux and leave with Ctrl+B and then D. Also, turn off battery optimization for Termux in Android's settings. For continuous use a VPS is better: see Background.
Updating
From the project folder, with the virtual environment active:
git pullpip install -r requirements.txt
Then restart with .restart in Telegram, or stop and start again depending on the method you use. .restart also applies any changes you make to the .env.
Kurigram is pinned to an exact version (2.2.26). If you install another one, KitDev warns you on startup and tells you how to go back to the tested version.
If something fails, check Troubleshooting.