MCPcopy Index your code
hub / github.com/faastjs/faast.js

github.com/faastjs/faast.js @v8.0.75

Chat with this repo
repository ↗ · DeepWiki ↗ · release v8.0.75 ↗ · + Follow
593 symbols 1,546 edges 72 files 40 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

faast.js

License CircleCI codecov semantic-release FOSSA Status

Faast.js makes regular functions callable as serverless functions on AWS Lambda. It handles the details of uploading your code, creating cloud infrastructure, and cleaning up. Scale up your functions to a thousand cores in seconds :rocket:

Faast.js is a pure library with no service dependencies, operational overhead, or unnecessary complexity.

Installation

Faast.js requires node version 8+.

$ npm install faastjs

Example

First write the functions you want to run in a serverless function. Make sure to export them:

// functions.ts
export function hello(name: string) {
    return "hello " + name;
}

Use faast.js to turn this into a serverless function:

// main.ts
import { faast } from "faastjs";
import * as funcs from "./functions";

(async () => {
    const m = await faast("aws", funcs);
    const { hello } = m.functions;
    const result = await hello("world!");
    console.log(result);
    await m.cleanup();
})();

Make 1000 concurrent calls if you like:

const promises: string[] = [];
for (let i = 0; i < 1000; i++) {
    promises.push(hello(`world ${i}!`));
}
await Promise.all(promises);

How much did that cost...?

const cost = await m.costSnapshot();
console.log(`$${cost.total()}`);

Relax. It's just half a penny:

$0.00420858

Features

  • Frictionless. Faast.js takes care of packaging your code, setting up IAM roles, and other infrastructure complexity. Run your code on a thousand cores in seconds. All you need is an AWS account.
  • Scalable. Use serverless functions to scale your batch jobs up to thousands of cores.
  • Cost-effective. Understand and optimize your workload costs in real time. Pay only for compute time actually used.
  • Ephemeral. No clusters or services to manage. Faast.js creates the infrastructure it uses on the fly and cleans up when it's done.
  • Productive. First class support for TypeScript and JavaScript. Type safety, documentation, and extensive testing are part of our DNA.
  • Local. Built-in support for AWS Lambda and local processing mode when you don't have network access. Switch with one line of code.

Ready to learn more?

Check out our getting started documentation.

Work through some examples

Review the detailed API documentation.

Join our discord channel.

Follow us on twitter.

Contributing

See contributing.

Extension points exported contracts — how you extend this code

FaastModule (Interface)
(no doc) [1 implementers]
src/faast.ts
Result (Interface)
(no doc)
types/proctor.d.ts
PackageConfiguration (Interface)
(no doc)
test/unit-packer.test.ts
Timing (Interface)
(no doc)
test/fixtures/functions.ts
Blob (Interface)
(no doc)
src/cache.ts
IncludeOption (Interface)
(no doc)
src/provider.ts
Workload (Interface)
(no doc)
src/cost.ts
CallId (Interface)
(no doc)
src/wrapper.ts

Core symbols most depended-on inside this repo

push
called by 116
src/throttle.ts
update
called by 66
src/shared.ts
cleanup
called by 61
src/faast.ts
all
called by 40
src/throttle.ts
on
called by 32
src/faast.ts
title
called by 31
test/fixtures/util.ts
log
called by 30
examples/map-buckets-module.ts
next
called by 27
src/throttle.ts

Shape

Function 324
Method 143
Class 70
Interface 55
Enum 1

Languages

TypeScript100%

Modules by API surface

test/fixtures/functions.ts71 symbols
src/throttle.ts59 symbols
src/faast.ts50 symbols
src/shared.ts43 symbols
src/aws/aws-faast.ts43 symbols
src/cost.ts30 symbols
src/wrapper.ts24 symbols
src/provider.ts24 symbols
src/metrics.ts22 symbols
src/trace.ts15 symbols
src/local/local-faast.ts15 symbols
test/fixtures/util.ts14 symbols

For agents

$ claude mcp add faast.js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact