{"id":20471135,"url":"https://github.com/apotox/slsdz","last_synced_at":"2025-12-01T18:05:32.580Z","repository":{"id":186511402,"uuid":"675245429","full_name":"apotox/slsdz","owner":"apotox","description":"build your own serverless FAAS provider on AWS","archived":false,"fork":false,"pushed_at":"2023-08-06T15:06:16.000Z","size":164,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T02:19:21.808Z","etag":null,"topics":["aws","faas-platform","serverless","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apotox.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-06T09:23:42.000Z","updated_at":"2023-08-17T18:59:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"af4dee6d-1b97-4671-a5ea-c4d9bdedcb5c","html_url":"https://github.com/apotox/slsdz","commit_stats":null,"previous_names":["apotox/slsdz"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apotox%2Fslsdz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apotox%2Fslsdz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apotox%2Fslsdz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apotox%2Fslsdz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apotox","download_url":"https://codeload.github.com/apotox/slsdz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242034767,"owners_count":20061197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","faas-platform","serverless","typescript"],"created_at":"2024-11-15T14:15:03.106Z","updated_at":"2025-12-01T18:05:27.524Z","avatar_url":"https://github.com/apotox.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SLSDZ - build your own FAAS provider\n\n[![npm version](https://badge.fury.io/js/slsdz.svg)](https://badge.fury.io/js/slsdz)\n\n![slsdz schema](https://github.com/apotox/slsdz-lambda/blob/pub/docs/schema.jpg?raw=true)\n\n## Description\n\nslsdz is a command-line interface (CLI) tool and serverless FAAS for creating serverless applications with random subdomains. It simplifies the process of setting up serverless functions using AWS services.\n\n\n\nhttps://github.com/apotox/slsdz/assets/8216066/4d3bcfb8-4b5e-49b9-9fda-8a668525757e\n\n\n\n## Installation\n\nYou can try the cli:\n\n```bash\nyarn install\nyarn bundle\ncd demo\n./mycli.js --help\n# Note: mycli.js is a shortlink to the bundled CLI file cli.js\n```\n\n# Options\n\n-   `--help` Show help\n-   `--version` Show version number\n-   `--id` function id\n-   `--secret` function secret\n-   `--init` init new function (id and secret)\n-   `-f, --zip` upload a function package (.zip)\n-   `-v, --verbose` verbose level 0,1,2\n-   `--log` function log\n-   `--about` about\n\nNote: The `--id` and `--secret` options are required. you can initialize new function using the `--init` option. also you can pass these two options as an env variables `SFUNCTION_ID` and `SFUNCTION_SECRET`.\n\n## Examples\n\n```js\n// simple index.js function\nmodule.exports.handler = async (event, context) =\u003e {\n    return {\n        statusCode: 200,\n        body: \"Hello World\",\n    };\n};\n```\n\n```bash\n# bash\nzip function.zip index.js\n./mycli.js --init\n# a .slsdz file will be generated which contains the function credentials\n./mycli.js --zip function.zip\n\n\n3:27:27 PM - API_URL:  your function URL https://abcdef123.example.com\n\nℹ file size: 283 bytes\n3:27:29 PM - UPLOAD_STATUS:  200\n\n✔ uploading [/Users/mac/test/function.zip]\n\n```\n\n## How it works\n\n#### AWS services:\n\n-   Lambda (functions)\n-   ApiGateway (handle http requests)\n-   S3 (store functions codes)\n-   CloudFormation (create users functions)\n-   CloudWatch (logs)\n-   EventBridge (trigger function to create CNAME records)\n\n#### external services:\n\n-   Cloudflare\n\nto interact with the service, developers use a CLI tool called slsdz without the need for any AWS-related authentication.\n\nEach user can initialize a function and receive an ID and a secret. The secret acts as an ID signature, which is used for uploading or updating a function. These data are saved in a local file called `.slsdz`.\n\nThe slsdz CLI communicates with the serverless backend, where functions can be created, updated, and their logs can be retrieved. This backend utilizes API Gateway with Lambda integrations to manage the interactions.\n\nWhen a user uploads function code, a Lambda function called `Signer` comes into play. The `Signer` generates a signed URL `https://abc.users-functions.aws.../function-id.zip` that allows users to upload the function code to an S3 bucket.\n\n\u003e i putted the function-id.zip in the URL intentionally so i can use it in the next step when handling the s3 ObjectPut event.\n\nThe S3 bucket is configured to trigger another function called `Deployer` when an ObjectPut event occurs. The `Deployer` function reads the uploaded zip file, and it expects the zip file to be named like `function-id.zip` , where \"function-id\" represents the unique ID of the function. This naming convention allows the `Deployer` lambda function to determine which function should be updated/created.\n\nif the function is new (doesnt exists) the `Deployer` function will build a cloudformation template that has all the required parameters to create:\n\n-   add new api mapping\n-   add new custom domain to apigateway custom domains\n-   a new lambda function with basic AMI role.\n\nstack name has function-id , so we can extract it easly when handling the creation event in `cname` lambda function.\n\n```js\nconst stackName = `sls-stack-${functionId}-${Date.now()}`;\n```\n\nin AWS console it will looks like:\n\n![stack creation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qeonhhmosyebr3we9e9f.png)\n\nWhen CloudFormation stack successfully creates the resources, it publishes a \"Stack Creation Event\" to Amazon EventBridge.\n\nWhere there is a Lambda function called `cname` that is subscribed to the \"Stack Creation Event\" in EventBridge.\n\nThe `cname` Lambda function represent an integration with the Cloudflare API. It uses the \"functionId\" from the received EventBridge event to create a new CNAME record on Cloudflare.\n\nAfter the Lambda function is triggered and successfully creates the CNAME record through the Cloudflare API, you will see a new record added to your Cloudflare dashboard with the same \"functionId\" that was used in the Lambda function.\n\n![cloudflare records](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wamrdw4tcsvwrq5dlb9u.png)\n\n# Deploy on your own aws account\n\n```sh\ngit clone it\nyarn install\n```\n\n```sh\n# before deploying you need to set up some variables,\nexport AWS_ACCESS_KEY_ID=\nexport AWS_SECRET_ACCESS_KEY=\nexport TF_VAR_custom_api_domain_name=api.example.com\nexport TF_VAR_signing_secret= # used to sign the function id\nexport TF_VAR_cloudflare_zone_id=\nexport TF_VAR_cloudflare_email=\nexport TF_VAR_cloudflare_api_key=\nexport TF_VAR_certificate_arn= #https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html\n```\n\n## Contributing\n\nContributions are welcome! Please refer to the [CONTRIBUTING](https://github.com/apotox/slsdz/master/CONTRIBUTING.md) file for guidelines.\n\n## Issues\n\nIf you encounter any issues or have suggestions, please [open an issue](https://github.com/apotox/slsdz/issues) on GitHub.\n\n## Acknowledgements\n\n-   [AWS](https://aws.amazon.com/) - Cloud computing services provider.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapotox%2Fslsdz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapotox%2Fslsdz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapotox%2Fslsdz/lists"}