Wrestling with boilerplate is a familiar struggle for developers. You have a perfect piece of logic—a function that does one thing exceptionally well—but to share it with the world, you need an API. That means setting up a server, defining routes, managing HTTP requests and responses, configuring CORS, and then figuring out deployment and scaling. What if you could skip all of that?
What if you could just write the function and get a live, scalable API endpoint instantly?
Welcome to function.do. We believe that your logic is the star of the show. Our platform transforms any piece of code into a scalable, secure, and ready-to-use API endpoint. No servers, no boilerplate, just your function.
In this post, we'll walk you through creating and deploying your very first atomic function on function.do in less time than it takes to brew your coffee.
Before we dive in, let's clarify what we mean by "atomic." An atomic function is a small, self-contained unit of code designed to perform one specific task perfectly. Think of it as a pure, single-purpose building block.
On the .do platform, this concept is central. Each function you export from your code becomes its own dedicated, independently scalable serverless API endpoint. This approach simplifies development, makes testing a breeze, and allows you to build complex systems from simple, reliable parts.
Let's turn a simple TypeScript function into a live API.
Create a file, let's call it greeting.ts, and add the following code:
import { Do, Fn } from '@do-are/sdk';
/**
* @description Generates a personalized greeting.
* @param { name: string } - The name to include in the greeting.
* @returns { message: string } - The personalized greeting message.
*/
export const getGreeting: Fn = async ({ name }) => {
if (!name) {
throw new Error('A name is required to generate a greeting.');
}
const message = `Hello, ${name}! Welcome to the platform.`;
// This object is returned as the JSON API response.
return { message };
};
Take a moment to appreciate what's not there. There's no Express server, no app.listen(), no route definition, and no manual JSON serialization. It's just the core logic.
This is where the magic happens. With the function.do CLI, you simply run the deploy command from your terminal:
do deploy
That's it. Behind the scenes, function.do analyzes your code, provisions secure infrastructure, and instantly generates a unique API endpoint.
Your function is now live at: POST https://your-name.function.do/getGreeting
Your function is now a fully-fledged API endpoint, ready to be integrated anywhere. You can call it using any HTTP client, like curl or fetch.
Let's test it with curl:
curl -X POST https://your-name.function.do/getGreeting \
-H "Content-Type: application/json" \
-d '{ "name": "World" }'
You'll get an immediate JSON response:
{
"message": "Hello, World! Welcome to the platform."
}
Congratulations! You've just gone from a simple TypeScript function to a live, scalable, and secure serverless API.
You might be thinking, "How is this different from AWS Lambda or Google Cloud Functions?" The key difference is radical simplicity.
While other Function as a Service (FaaS) platforms provide powerful low-level building blocks, they still require you to wire everything together. You need to configure an API Gateway, set up IAM permissions, define triggers, and manage the infrastructure.
function.do is a complete, production-ready solution. We provide a seamless developer experience focused on one thing: getting your code live as an API as fast as possible. You write the logic, and we handle the rest.
The simplicity of function.do doesn't limit its power.
The era of writing glue code just to expose your logic is over. function.do offers the most direct path from an idea in your head to a production-ready API that can be used by your frontend, a mobile app, or another backend service.
Ready to stop wrestling with infrastructure and start shipping features?
Sign up for free at function.do and deploy your first function today!