Mini Interaction is a modular, type-safe framework for building Discord bots on the HTTP interaction model. No gateway, no WebSocket management - just pure serverless functions.
Install the core package and the required Discord types:
npm install @theminesastudios/mini-interaction discord-api-typesPeer dependencies: @vercel/functions and mongodb are optional but recommended for edge deployment and persistence.
Create an app, register a command handler, and deploy. The framework handles verification, routing, and response formatting.
import { createApp, command } from "@theminesastudios/mini-interaction";
import { ApplicationCommandType } from "discord-api-types/v10";
const app = createApp({
publicKey: process.env.DISCORD_PUBLIC_KEY!,
applicationId: process.env.DISCORD_CLIENT_ID!,
});
const ping = command({
name: "ping",
description: "Check the bot's latency",
async handler(ctx) {
const latency = Date.now() - ctx.timestamp.getTime();
return ctx.respond({
content: `Pong! ${latency}ms`,
});
},
});
app.use(ping);
export const POST = app.handle();To connect your app to Discord:
DISCORD_PUBLIC_KEY and DISCORD_CLIENT_ID in your environmentA typical Mini Interaction project follows this structure:
src/
commands/ # Slash command definitions
ping.ts
info.ts
components/ # Component handlers (buttons, selects)
ticket.ts
modals/ # Modal submit handlers
feedback.ts
routers/ # Composed router modules
mod.ts
index.ts # App entry point
env.ts # Environment variable types