Asyncflow is no longer under development and all features presented below are functional. If you encounter any issues, you can create an issue on this repository.
AsyncFlow, a JS library that simplifies asynchronous task management by automating workflows on the cloud (AWS, Google Cloud, Azure), focusing on scalability and cost optimization. We provide an SDK to interact with your cloud provider's API.
- Decrease Complexity: Reduce the requirements for extensive configurations and simplify troubleshooting on the developer's side. No more worker queues and setting up infrastructure.
- Improve Deployment Speed: Enable tasks to run on-demand directly from the cloud environment.
- Maintain Clear Monitoring: Deliver ongoing, real-time tracking of all active workflows.
AsyncFlow simplifies cloud function execution by providing a lightweight SDK that abstracts away the complexity of the AWS infrastructure.
Instead of directly managing functions, permissions, or deployments, you use our SDK to define and trigger asynchronous tasks through a unified API.
Asyncflow will handle everything, from environment variables to dependencies and role permissions.
AsyncFlow presents itself as a node package.
npm install asyncflow-sdkYou might want to use our CLI in order to use Asyncflow using directories.
npm -g install asyncflow-cliTo use AsyncFlow with AWS, you need to provide your AWS credentials. Create a .env file at the root of your project:
your-project/
├── .env
├── src/
├── package.json
└── README.mdThen, provide your AWS credentials, AWS_ACCESS_KEY and AWS_SECRET_KEY
//.env
AWS_ACCESS_KEY=XXXXXXX
AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXXMake sure the user associated with these credentials has the necessary permissions to perform all intended actions. We recommend following the principle of least privilege.
First, call
import "dotenv/config";
import { Asyncflow } from "asyncflow-sdk";to retrieve the credentials you declared in the .env file you created at your project's root, as explained above. Then import the Asyncflow library. The order is important, since Asyncflow cannot work without having your credentials.
Then, you need to first initialize the Asyncflow client, with the Asyncflow.init method. It takes two parameters, initializeDirectories and initializeCallbacks, that are both true by default.
You can disable them if you're not working with them.
import "dotenv/config";
import { Asyncflow } from "asyncflow-sdk";
const asyncflowClient = await Asyncflow.init({
// initializeDirectories: true,
// initializeCallbacks: true,
});You can create jobs with Asyncflow in two different ways, depending on your needs and project structure:
Use the Asyncflow.addInlineJob method to declare a new job by passing a callback function that contains the code to be executed asynchronously. It will return an asynchronous function that can then be used to trigger the job you've added. You can pass to the asynchronous function any arguments, it will then be used as a payload that will be passed to the job in the cloud.
import "dotenv/config";
import { Asyncflow } from "asyncflow-sdk";
const asyncflowClient = await Asyncflow.init();
const githubCall = await asyncflowClient.addInlineJob(()=>{
const response = await fetch("https://api.github/...");
return response;
});
// The job is now created, you can now invoke it whenever you want
const githubCallResult = await githubCall();
console.log(githubCallResult);
const analysis = await asyncflowClient.addInlineJob((multiplier: number)=>{
return 42 * multiplier;
});
const analysisResult = await analysis(21);Use the asyncflow-cli to create directories with jobs boilerplates
asyncflow-cli create foobar nodeasyncflow/
└── foobar/
├── index.js
└── package.json
Job name : foobar// ./asyncflow/foobar/index.js
export const handler = async (event) => {
const response = {
statusCode: 200,
body: JSON.stringify("Hello from Lambda!"),
};
return response;
};The command above creates a directory inside asyncflow/ named foobar with a index.js and package.json file inside. The job will have the same name as the directory name. You can then write code inside this directory.
You only need to initialize the Asyncflow client — it will automatically create the jobs located in your asyncflow/ directory, if they don't already exist.
To trigger a job created during initialization, use Asyncflow.trigger, which takes two parameters: the name of the job, and an optional configuration object.
You can pass the following options:
LambdaResponse<T> {
statusCode: number;
body: T;
}
options: {
payload?: Record<string, any>;
callback?: (a: LambdaResponse<T> | null) => void;
onrejected?: (err: any) => void;
}import "dotenv/config";
import { Asyncflow } from "asyncflow-sdk";
const asyncflowClient = await Asyncflow.init();
asyncflowClient.triggerDirectoryJob("foobar", {
callback: (res) => {
console.log(res);
},
onrejected: (err) => {
console.error(err);
},
payload: { statusCode: 200, body: "this is a payload" },
});As simple as that!
You're invited to join this project ! Check out the contributing guide.
If you're interested in how the project is organized at a higher level, please contact the current project manager.
Developers
![]() Pierre Riss |
![]() Loan Riyanto |
![]() Laurent Gonzalez |
|---|
Manager
![]() Pierre Lissopé |
|---|
🚀 Don't hesitate to follow us on our different networks, and put a star 🌟 on
PoC'srepositories
Made with ❤️ by PoC



