🚀 FaasJS

🚀 FaasJS

An atomic application framework built for the TypeScript developer.




Features

Featherweight Development & Collaboration

  • Break down complex projects into manageable components with the atomized development model.
  • Enjoy fast iterations and seamless team collaboration.
  • Jumpstart development with pre-built plugins for common functionalities like HTTP and Knex.

High maintainability

  • The FaaS architecture ensures isolated cloud functions, preventing domino-effect errors.
  • Automated testing tools built-in for robust and efficient testing.

High scalability

  • Extend your application effortlessly with flexible and simple plugin mechanisms.
  • Freely scale your functions up or down based on demand.

Quickstart

Start with Codespace

🔨 FaasJS Stateropen in new window

Start with Command Line

# use npm
npx create-faas-app --name faasjs

# use bun
bunx create-faas-app --name faasjs

Examples

Cloud function's file

// index.func.ts
// all cloud function file should be ended with .func.ts
import { useFunc } from '@faasjs/func'
import { useHttp } from '@faasjs/http'

export default useFunc(function() {
  useHttp() // use http plugin

  return async function () {
    return 'Hello, world' // response content
  }
})

Unit test's file

// __tests__/index.test.ts
// all unit test file should be ended with .test.ts
import { test } from '@faasjs/test'
import Func from '../index.func'

describe('index', function () {
  it('should work', async function () {
    // wrap the cloud function
    const func = test(Func)

    // mock the request
    const { statusCode, data } = await func.JSONhandler()

    // expect the response with 200 status
    expect(statusCode).toEqual(200)
    // expect the response content is 'Hello, world'
    expect(data).toEqual('Hello, world')
  })
})

Thanks

Code contributors (in alphabetical order):

Open source projects (in alphabetical order):