I want to introduce a project I’ve been working on for the past few months. I think it’s finally in a good enough state that more people can get onto it.
Here’s what microfn is about and all the cool stuff you can do with it!
Tiny composable functions
Microfn is all about small functions (hence the name micro) - you have a small piece of functionality in the form of a function and want to run it somewhere. Well microfn is just the place for that! We run that function for you and make sure it is available for whenever you need it.
Let’s say I have this snippet here that just queries wttr.in to get the current weather:
export async function main() {
const url = "https://wttr.in/Tokyo?format=3&m";
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.text();
} catch (error) {
console.error("Error fetching weather:", error);
return { error: "Failed to fetch weather data" };
}
}
We can quickly deploy this to microfn in seconds by writing the code, hitting save and it’s deployed. Now that it’s deployed we can do all kinds of stuff with it!
Functions from anywhere
By default, microfn gives you a webhook that you can call in the form of
curl -X POST https://microfn.dev/run/david/get-tokyo-weather
Executing this curl will, as you may have guessed, get the current Tokyo weather by executing your function on the microfn platform.

But we can do more!
Functions meet other functions
Isolated functions are already useful on their own, but they become even more powerful when we allow functions to interact with each other.
For example, we can encapsulate recurring logic to send a discord message into a send-discord-message function:
export async function main(input: { channelId: string, content: string }) {
const token = await secret.getRequired("DISCORD_BOT_TOKEN");
const { channelId, content } = input;
const discordPayload = {
channelId,
content
};
const response = await fetch(
`https://discord.com/api/v10/channels/${discordPayload.channelId}/messages`,
{
method: "POST",
headers: {
Authorization: `Bot ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ content: discordPayload.content }),
},
);
const data = await response.json();
if (!response.ok) {
throw new Error(
`Discord API error: ${response.status} ${JSON.stringify(data)}`,
);
}
return data;
}
We could already plug the webhook into places where we want to send a discord message, effectively giving us a curl-to-discord bridge that hides away secrets and logic: Calling the curl will send a message.
But we can also hook this up to other functions that want to send discord messages:
import fn from "@microfn/fn";
export async function main() {
const weather = await fn.executeFunction("david/get-tokyo-weather");
return await fn.executeFunction("david/send-discord-message", {
channelId: "1419082455608197140",
content: weather,
});
}
See what we did there? We hooked our 2 functions up into a new function that composes them and sends the current weather into discord!
Automation triggers
Beyond manually calling functions, microfn supports automatic triggers that execute your functions based on events.
Scheduled execution
Functions can be executed on a schedule through CRON:

With just 2 clicks, we turned our function into an hourly weather notifier in discord!
Email triggers
We can also set up functions to respond to emails. Enabling the email trigger gives you a new email address in the form of [email protected]. Any email sent to this address will automatically trigger your function:
import fn from "@microfn/fn";
export async function email(data: { email: Email }) {
if (data.email.body.indexOf("microfn") != -1) {
const content = `New email from ${data.email.from}: ${data.email.subject}`;
return await fn.executeFunction("david/send-discord-message", {
channelId: "1419082455608197140",
content: content,
});
}
}
Now we have a discord notifier for whenever someone sends us an email with the word “microfn” in the body.
This makes it easy to handle things like Google Voice SMS-to-email forwarding - just parse the email body in the email() callback, extract the SMS content, and forward it wherever you need!
Functions meet AI
Now here’s where things get really interesting. Tiny functions are a fantastic candidate to be used as AI tools - they encapsulate logic, do one job, and are easy to reason with.
We can hook microfn up to an LLM through an MCP and ask it to get the Tokyo weather:

But what’s even cooler is that we can ask AI to make changes to our functions to give itself new skills. One simple prompt, and the AI does the rest!

And executing this new variant gives us this result:

This turns microfn into a self-expanding toolbox for your AI assistant. Something missing? Just have AI write its own skill! No need to install new MCP servers just to add one extra capability.
Real-world integrations
Your functions are like micro tools that you can plug into anything: MCP, Siri Shortcuts, GitHub Actions, Webhooks, Emails, Cron - you name it!
Here are some concrete examples of what you can build:
GitHub webhook handler
Create a github-webhook function and hook it up as your GitHub webhook URL. Now you have an entry funnel for GitHub events.
Compose it with your discord or slack notification function, and you get real-time notifications with custom parsing for whenever a new issue gets opened or a PR is created:
import fn from "@microfn/fn";
export async function main(input: { action: string, issue: any }) {
if (input.action === "opened") {
const message = `New issue: ${input.issue.title}\n${input.issue.html_url}`;
return await fn.executeFunction("david/send-discord-message", {
channelId: "1419082455608197140",
content: message,
});
}
}
Twilio SMS automation
Hook a function up as a Twilio webhook when a new message has been received and you have programmable SMS funneling in seconds:
import fn from "@microfn/fn";
export async function main(input: { From: string, Body: string }) {
// Forward SMS to Telegram, Discord, or anywhere else
const message = `SMS from ${input.From}: ${input.Body}`;
return await fn.executeFunction("david/send-discord-message", {
channelId: "1419082455608197140",
content: message,
});
}
Now all your SMS messages are in one place, with all the filtering and routing logic you need.
Release notifications
Want release notifications for your projects? Create a release-notifier function, add the webhook to your GitHub release workflow or deployment script, and you have programmable release notifications:
import fn from "@microfn/fn";
export async function main(input: { version: string, notes: string }) {
const message = `🚀 New release: ${input.version}\n${input.notes}`;
// Send to multiple channels at once
await fn.executeFunction("david/send-discord-message", {
channelId: "1419082455608197140",
content: message,
});
// Also post to Twitter, send to Slack, update a status page, etc.
// All in one function!
}
Your toolbox, ready for when you need it!
Microfn gets your functions running quick! Think your local npm, but in the cloud - you have your function, you hit save, and it’s deployed. Done.
It’s your toolbox for tiny stuff, your hammers, drivers and drills, ready instantly for when you need it.
I am using microfn heavily myself and in the short time of using it, it has already positioned itself as an invaluable tool and in the middle of most of my automation flows.
Microfn comes with a free tier to try things out, and a flat $8/mo for the full version.
Give it a try and let us know what you think!
