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

@towns-labs/app-framework

v7.1.0

Published

An app framework for Towns.

Readme

@towns-labs/app-framework

An app framework for Towns.

Installing

We suggest users to quickstart a project using our cli.

$ bunx towns-agent init

If you prefer to install manually:

$ bun add @towns-labs/app-framework viem hono

Usage

With Node:

import { makeTownsApp } from "@towns-labs/app-framework";
import { serve } from "@hono/node-server";

const app = new Hono();
const townsApp = await makeTownsApp("<app-private-data-base64>");

townsApp.onMessage((handler, { channelId, isMentioned }) => {
  if (isMentioned) {
    handler.sendMessage(channelId, "Hello, world!");
  }
});

const { jwtMiddleware, handler } = townsApp.start();
app.post("/webhook", jwtMiddleware, handler);

serve({ fetch: app.fetch });

With Bun:

import { makeTownsApp } from "@towns-labs/app-framework";

const app = new Hono();
const townsApp = await makeTownsApp("<app-private-data-base64>");

townsApp.onMessage((handler, { channelId, isMentioned }) => {
  if (isMentioned) {
    handler.sendMessage(channelId, "Hello, world!");
  }
});

const { jwtMiddleware, handler } = townsApp.start();
app.post("/webhook", jwtMiddleware, handler);

export default app;

Identity Metadata (ERC-8004)

Apps can optionally define ERC-8004 compliant identity metadata for discovery and trust.

Minimal Example

Create identity.ts:

import type { AppIdentityConfig } from "@towns-labs/app-framework";

const identity = {
  name: "My App",
  description: "A helpful app for Towns",
  image: "https://example.com/app-logo.png",
  domain: "myApp.example.com",
} as const satisfies AppIdentityConfig;

export default identity;

Use in app setup:

import identity from "./identity";

const townsApp = await makeTownsApp(process.env.APP_PRIVATE_DATA!, {
  commands,
  identity,
});

// Get metadata for hosting at /.well-known/agent-metadata.json
const metadata = townsApp.getIdentityMetadata();
app.get("/.well-known/agent-metadata.json", metadata);

Advanced Example

For full ERC-8004 compliance with endpoints and trust models:

import type { AppIdentityConfig } from "@towns-labs/app-framework";

const identity = {
  name: "Advanced App",
  description: "AI-powered app with multi-protocol support",
  image: "https://example.com/app-logo.png",
  motto: "Building the future of agent economies",
  domain: "app.example.com",

  endpoints: [
    {
      name: "A2A",
      endpoint: "https://app.example.com/.well-known/agent-card.json",
      version: "0.3.0",
    },
    {
      name: "MCP",
      endpoint: "https://mcp.app.example.com/",
      version: "2025-06-18",
    },
  ],

  registrations: [],

  supportedTrust: ["reputation", "crypto-economic"],

  attributes: [
    { trait_type: "Category", value: "Gateway" },
    { trait_type: "Model", value: "GPT-4" },
  ],
} as const satisfies AppIdentityConfig;

export default identity;

The app automatically adds agentWallet endpoint using the app's address and A2A endpoint if domain is configured.

Debug Logging

App framework uses debug package for logging. You can enable by setting the DEBUG environment variable to csb:agent.

DEBUG=csb:agent node dist/agent.cjs