npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bot-machine/telegram-sdk

v0.1.11

Published

A lightweight and modern framework for building Telegram bots, inspired by Express.js and React.

Downloads

68

Readme

Bot-Machine

A lightweight and modern framework for building Telegram bots, inspired by Express.js and React, and designed for AI-driven development.

➡️ Go to the full documentation

Overview

bot-machine provides a highly structured, predictable, and scalable environment for bot development. Its core features are:

  • Schema-First Architecture: Business logic is defined with Zod schemas, providing strong typing and runtime validation.
  • Type-Safe State Machines: Conversational flows are built with a type-safe API that prevents common errors.
  • Component-Based UI: UI rendering is separated from logic, inspired by React.
  • Express-style Routing: A familiar routing pattern for handling commands, callbacks, and text messages.

Installation

bun install @bot-machine/core @bot-machine/telegram-client zod

Quick Start

This example creates a simple bot that asks for your name and greets you.

import { TelegramClient } from '@bot-machine/telegram-client';
import { Router, session, createFlow, createCommand } from '@bot-machine/core';
import { z } from 'zod';

// 1. Initialize the client and router
const client = new TelegramClient(process.env.BOT_TOKEN!);
const router = new Router();

// 2. Use session middleware (required for flows)
router.use(session());

// 3. Create a command to enter the flow
router.onCommand('start', async (ctx) => {
  await ctx.reply('Let\'s begin!');
  await ctx.enterFlow('welcome');
});

// 4. Define the conversational flow
const welcomeFlow = createFlow('welcome', {
  index: {
    component: async () => ({ text: 'What is your name?' }),
    onText: {
      ':name': {
        command: createCommand({
          input: z.object({ name: z.string() }),
          output: z.object({ greeting: z.string() }),
          execute: async ({ name }) => ({ greeting: `Hello, ${name}!` }),
        }),
        nextState: 'greet',
      },
    },
  },
  greet: {
    component: async (props: { greeting: string }) => ({ text: props.greeting }),
  },
});

// 5. Register the flow
router.addFlow(welcomeFlow);

// 6. Start the bot
console.log('Bot starting...');
client.startPolling((update) => {
  router.handle(update, client);
});

Learn More

To learn more about the concepts and the full API, please visit the main documentation.