Serverless hosting for Discord bots

Building a Discord bot means dealing with persistent gateway connections, sandboxed code execution, event dispatching, KV storage, and deployment pipelines - before you write a single line of actual bot logic. Coconut handles all of that so developers can focus on what their bot does, not how it runs.

The problem

Running a bot is harder than writing one

Most developers who build Discord bots hit the same wall: writing the logic is straightforward, but operating it is not. You need to maintain long-lived WebSocket connections to Discord's gateway, handle reconnects, manage sharding as your bot grows across servers, and run user code in a way that won't take the whole service down if something goes wrong.

For indie developers and small teams, this surface area is large enough that many projects get abandoned before they ship. The tooling that exists is either too low-level (raw discord.js on a VPS) or too generic (general-purpose serverless platforms that don't understand Discord's event model at all).

There's no platform today specifically designed for the Discord developer ecosystem - one that handles the gateway natively, provides safe multi-tenant execution, and gives developers a proper workbench to build and debug in.


What we're building

A managed runtime for Discord bots

Coconut is a developer platform where you write your bot in TypeScript, publish a deployment, and the platform handles everything else. Gateway connections, event routing, sandboxed execution, KV storage, and scheduled tasks - all managed.

The core idea: Discord sends an event, Coconut routes it to the right deployment, runs your handler in an isolated worker with controlled access to platform APIs, and streams the output back to you in real time. You never touch a WebSocket.

bot.ts
discord.commands.config({ prefix: "!" });

discord.commands
  .command("ping")
  .description("Ping")
  .run(async (ctx) => {
    await ctx.reply("pong");
  });

The platform includes a browser-based workbench - a Monaco editor with an integrated console, live log streaming, and one-click publishing. Developers can write, test, and iterate on their bot without leaving the browser. Hot reload lets you push a new revision and see results immediately.


Architecture

How it works under the hood

Coconut is built as a set of independent services that together form a multi-tenant bot runtime. The key design constraint is safety: user code runs in isolated workers, and the gateway layer is fully decoupled from execution.

The two-process model (Rust supervisor + Node.js workers) was a deliberate choice. Rust gives reliable process management and low-overhead isolation; Node.js gives users the familiar runtime and ecosystem they already know. NATS handles internal pub/sub without the operational overhead of heavier brokers.


Market

Who this is for

Discord has over 500 million registered users and a large, active developer community. Bot development is widespread - indie developers build community tools, studios build paid bot products, and businesses use Discord for customer engagement and support automation. Most self-host on VPS instances or use general-purpose serverless platforms never designed for Discord's event model.

Coconut's primary audience is indie developers and small teams who want to ship Discord bots without becoming infrastructure engineers. A secondary market is multi-tenant bot SaaS products - businesses that sell bot features to multiple Discord servers and need a platform that handles isolation and per-tenant quotas natively.

19M+
Active Discord servers
~1M
Registered Discord bots (est.)
Free
Hobby tier with limited quota
Usage
Paid tiers by invocations & runtime

Status

Where we are today

Coconut is in active development. The core platform - gateway, dispatcher, supervisor/worker runtime, and workbench - exists as a working local prototype. The end-to-end flow is functional: create a deployment, publish a revision, dispatch events, view logs in the workbench.

Immediate roadmap: harden runtime isolation, migrate to PostgreSQL, add billing and quota enforcement, then onboard the first external testers in a closed alpha. AWS credits would directly accelerate the production infrastructure buildout - gateway fleet, NATS cluster, and managed database.


Team

Who's building it

Marawan
Founder & Engineering Lead
Building Coconut across the full stack - gateway in Rust, runtime supervisor in Rust, API in Node.js/Fastify, workbench in React. The platform came directly out of frustration with existing tooling while building Discord bots. Currently sole engineer, with plans to bring on help post-alpha.
Get in touch GitHub →