{"id":13753546,"url":"https://github.com/clay-run/clay-cli","last_synced_at":"2025-05-09T21:35:05.567Z","repository":{"id":87637452,"uuid":"73114146","full_name":"clay-run/clay-cli","owner":"clay-run","description":"CLI for Clay - A powerful set of tools to create Functions As A Service (FaaS) ","archived":false,"fork":false,"pushed_at":"2019-10-29T14:53:44.000Z","size":169,"stargazers_count":56,"open_issues_count":5,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-06T23:10:03.317Z","etag":null,"topics":["clay","clay-cli","developer-tools","devtools","lambda","microservice","nodejs","serverless"],"latest_commit_sha":null,"homepage":"https://www.clay.run","language":"JavaScript","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/clay-run.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-07T19:41:01.000Z","updated_at":"2024-02-21T10:36:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"0285685f-c42e-4d63-aed0-d93464bd8d17","html_url":"https://github.com/clay-run/clay-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clay-run%2Fclay-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clay-run%2Fclay-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clay-run%2Fclay-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clay-run%2Fclay-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clay-run","download_url":"https://codeload.github.com/clay-run/clay-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253328901,"owners_count":21891546,"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":["clay","clay-cli","developer-tools","devtools","lambda","microservice","nodejs","serverless"],"created_at":"2024-08-03T09:01:24.299Z","updated_at":"2025-05-09T21:35:05.266Z","avatar_url":"https://github.com/clay-run.png","language":"JavaScript","readme":"\u003cimg src=\"http://i.imgur.com/Z0vvLkI.png\" width=\"720px\"\u003e\n\n---\n[![Build Status](https://travis-ci.org/clay-run/clay-cli.svg?branch=master)](https://travis-ci.org/clay-run/clay-cli)\n\n**This repo is the command line tool for using Clay - The fastest way to create and deploy microservices.**\n\nYou can learn more here: \u003chttps://www.clay.run\u003e\n\n## What is Clay?\n[Clay](https://www.clay.run) is:\n\n1. A set of tools that allow you to create and deploy API endpoints (microservices) in seconds.\n2. A community and registry for those microservices.\n\nThink of it like Github if the code at each repository was running and not static. The benefit of this is that your code is a living service that:\n\n- Can be used in any language - every function you write instantly becomes an API that can be used by someone in whatever language they work in.\n- People can test out via our microservice UI\n- Provides you a way to see how people use your service via our logs \u0026 helps you catch errors you might hit.\n\nWe're in early days. Get involved or ask questions by opening up Github issues or chatting with us on [Gitter](https://gitter.im/clay-run/Lobby?source=github).\n\n## What Kinds of Things Can I Use Clay For\n- Building an app powered entirely by microservices\n- Programmable Web Hooks\n- Power Your Alexa Skill or Slack Bot\n- Data Processing \u0026 Enrichment\n- Scraping, Screenshoting \u0026 other things that require Headless Browsers\n\nBuild your own microservices or browse our list of [publicly available microservices](https://www.clay.run/public/services)\n\n### You can open up an issue if you are looking for a microservice or api that is not available in our public registry and we will get it built!\n\n## Introduction\n\nClay-Cli is a command line tool that allows you to quickly create microservices using Clay.\n\nWe currently support nodejs. The microservices are auto-scaling and production ready.\n\n\n## Install\n\n```\n$npm install -g clay-run\n```\n\n\n## Usage - Creating microservices\n### Signup\nThe first thing to do is to signup:\n\n```\n$ clay signup\n```\n\nFollow the interactive instructions. You just need an email, username and a password.\n\nNow you're ready to create your first service\n\n\n### There are two ways to get started:\n### 1. Create a new service\n\n```\n$ clay new \u003cyour-service-name\u003e\n```\n\nReplace \u003cserviceName\u003e with the name of your service. This will create a folder in your current directory with the name of your service. \n\nif you want to build an Alexa Skill simply run the following\n\n```\n$ clay new \u003cyour-service-name\u003e -t alexa\n```\n\n### 2. Fork an existing function\n```\n$ clay fork serviceToFork newServiceName\n```\nYou can use the name of service to fork\n\ne.g. ```kareemcore/whois-deluxe```\nor a url ```https://clay.run/services/kareemcore/whois-deluxe```\n\nYou can find a list of public functions that you can fork here:\n[publicly available microservices](https://www.clay.run/public/services)\n\n\nThen enter a valid name as the new service name. Do not include your username as part of the newServiceName\n\n\nNext change to your service directory:\n\n```\n$ cd your-service-name\n```\n\nIt should look like this:\n\n```\n- your-service-name\n\t- your-service-name.js\n\t- package.json\n\t- node_modules\n\t- clay-config.json\n\t- test-data.json\n```\n\n\n### Edit Code\nYou can now edit the nodejs code in ```your-service-name.js```\n\nHere is what it looks like by default:\n\n```\n // Require your files or libraries here. You can use npm to install libraries.\n\nexports.handler = function(event, context, callback) {\n  // Write your code here\n  \n  // Your service only responds to POST requests\n  // Any variables passed are found in event.body\n  // eventVars is a convenience that parses any JSON\n  // objects that were passed in the POST request\n  \n  var eventVars = JSON.parse(event.body);\n  \n  // JSON Stringify the result of the service call\n  // In this case we simply pass back whatever parameters\n  // were sent to the service\n  \n  var result = JSON.stringify(eventVars)\n  \n  // Do not change this: \n  // This ends the service call with the results, \n  // HTTP 200 status code and headers to allow cross origin requests \n  // and to indicate that the result is JSON.\n  \n  context.succeed({\"body\": result,\n                  \"statusCode\": 200,\n                  \"headers\": {\n                    \"Content-Type\": \"application/json\",\n                    \"Access-Control-Allow-Origin\": \"*\"\n                  }\n  });\n}\n\n```\nManage packages with npm and require them the way you would in any regular nodejs project.\n\n### Deploy\nTo deploy simply run while in the service directory:\n\n```\n$ clay deploy\n```\n\n### Clay Config File\nThe config file looks like this:\n\n```\n{\n  \"accountName\": \"public\",\n  \"serviceName\": \"get-all-images\",\n  \"serviceDescription\": \"A service that takes in bits and moves atoms\",\n  \"inputs\": [\n    {\n      \"name\": \"myVariable\",\n      \"type\": \"text\",\n      \"displayName\": \"My Variable\"\n    }\n  ],\n  \"serviceDisplayName\": \"Get All Images\"\n}\n```\n\nThis is used by Clay to automatically created a visual interface that you can use to run your service and test it. It will also facilitate many features that will help in developing microservices in the future.\n\n```accountName```: is a string that identifies the type of account. Do not change this.\n\n```serviceName```: is a string that identifies your service. Do not change this.\n\n```serviceDescription```: is a description of what your service does.\n\n```inputs```: is an array of JSON objects with a\n\n  - ```name```: variable name that you use in the code\n  - ```type```: type of variable. \n  \n  Currently supported are ```text```, ```date```, ```image```, ```file```, ```json```, ```address```, ```url```, ```select```. Use ```text``` when you want to pass arbitrary text including an []\n  - ```displayName```: this is the name that shows up in the Clay's UI to idenitfy this variable\n  \n```serviceDisplayName```: this is the name that shows up in Clay's UI to identify this service \n  \n### Using Private/Secret Environment Variables\n\nTo add a new key and value pair:\n\n```$ clay add:env key value ```\n\nIf the value has special characters in it enclose the whole value in single quotes.\n\nTo delete an existing key\n\n```$ clay delete:env key``` \n\nTo list all variables\n\n```$ clay list:env```\n\nThe environment variables are accessible through \n\n```process.env.key```\n\nwhere key is the name of your key.\n\n\n## Running your service\n\n\n### Run Locally\nTo run locally call:\n\n```\n$ clay test\n```\nThis will run your code and use the ```test-data.json``` file as the key-value pairs that get passed to the function's ```event.body``` variable.\n\nLogging will work normally and output to STDOUT.\n\n### Run on Production from the CLI\nIf you are in a Clay service directory simply type\n\n```\n$ clay run\n```\n\nThis will run you code use the ```test-data.json``` file as the key-value pairs that get passed to the function's ```event.body``` variable.\n\nYou can also pass in custom key-value pairs for that invocation with the following command:\n\n```\n$ clay run `{\"myVariable: value\"}`\n```\n\nFinally you can run any publicly accessible clay service with the following command:\n\n\n$ clay run nameOfService `{\"myVariable: value\"}`\n### Run on Production from code\nMake an HTTP POST call to:\n\n\u003chttps://www.clay.run/your_username/your_service_name\u003e\n\nPass any key-value arguments in the body of your POST call\n### Run on Production using the Clay visual interface\nYou can also view your service at:\n\n\u003chttps://www.clay.run/your_username/your_service_name\u003e\n\nLogin with your credentials and you will be able to run your service with any parameters that you specified in the clay config file. You will also be able to see the logs.\n\n### See Production Logs\nUse:\n\n```\n$ clay logs\n```\n\nor view the logs at:\n\n\u003chttps://www.clay.run/your_username/your_service_name\u003e\n \n## Managing your Clay services\n\n### Downloading code for a Clay service\n\n```\n$ clay download nameOfService\n```\n\nThe service must be either public or owned by you in order to download it. \n\nDownloading a public service allows you to have read-only access to the code.  \n\nIf you'd like to make changes to a public service you have to fork it to create your own version and make changes to that. \n\n### List All of Your Services\n```\n$ clay list\n```\n\n### Get info about service\n```\n$ clay info\n```\n### Login\n```\n$ clay login\n```\n\n## Create an Alexa Skill\nFor a complete walk through check out [this blog\npost](https://medium.com/@nicolaerusan/code-your-first-alexa-skill-in-30-ish-seconds-using-clay-ready-go-8293ee1761ac)\n\n\n```\n$ clay new my-alexa-skill -t alexa\n```\n\n## FAQ\nComing soon\n## License\nThe MIT License (MIT)\n\nCopyright (c) 2016-2017 Clay Labs Inc\n","funding_links":[],"categories":["serverless"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclay-run%2Fclay-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclay-run%2Fclay-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclay-run%2Fclay-cli/lists"}