The Autocode App Platform is a cloud hosting platform for JavaScript (Node.js) apps. Apps are built using the open source FunctionScript specification which automatically turns JavaScript files into typed HTTP(S) endpoints.
Open source, pre-built templates are available via our Autocode Templates page for you to peruse or install immediately. This is an easy way to get started with Autocode if you're looking for a ready-made solution.
In addition to templates, there are code snippets. Code snippets are single files that can be installed into any project, or used as a starting point.
Autocode differs from traditional automation software in that Autocode apps are just JavaScript (Node.js) projects that export multiple web endpoints. Anything placed in the functions/ folder gets automatically exported as an HTTP(S) endpoint on the World Wide Web or can be hooked up directly to a third-party event trigger as a webhook. This behavior is handled by the open source FunctionScript specification. Directory structure for Autocode apps typically looks like this:
functions/
| functions/ | | events/ | | | stripe/ | | | charge/ | | |- succeeded.js (Stripe webhook endpoint) | |- __main__.js (HTTP endpoint) |- env.json (Environment variables / secrets) |- package.json (Node.js config) |- payloads.json (Sample endpoint payloads) |- README.md (README) |- stdlib.json (Autocode config)
All endpoints can communicate with Autocode Standard Library APIs via the lib package on NPM. For the example webhook functions/events/stripe/charge/succeeded.js above to talk to Slack, your code might look like this:
functions/events/stripe/charge/succeeded.js
// NPM package to authenticate with the Autocode Standard Library const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN}); /** * An HTTP endpoint that acts as a webhook for Stripe charge.succeeded event * @param {object} event * @param {object} charge * @returns {object} result Your return value */ module.exports = async (event, charge) => { let result = {stripe: {}, slack: {}}; console.log(`Running [Stripe → Retrieve a customer]...`); result.stripe.customer = await lib.stripe.customers['@2020.8.27-2'].retrieve({ customer: `${charge.customer}` }); console.log(`Running [Slack → Send a Message from your Bot to a Channel]...`); result.slack.response = await lib.slack.channels['@0.7.3'].messages.create({ channel: `#demo`, text: `Charge succeeded for ${result.stripe.customer.email}, Amount: ${charge.amount} 🤑` }); return result; };
Read More about Autocode templates and snippets here.
Autocode Apps comes in two flavors: Web Services and Connector APIs.
Web Services are meant for internal tools, generic web projects and more. They can respond to HTTP(S) requests and automatically respond to webhooks from third-party ecosystems.
Connector APIs, often just referred to as APIs can only respond to HTTP(S) requests and can not have webhooks configured. They're automatically added to the Autocode Standard Library and will appear in the API Autocomplete for Autocode's Online IDE.
Autocode Apps, when deployed, can either be deployed to Development Environments or shipped as Releases. A development environment app URL looks something like user.autocode.dev/appname@dev/, whereas a release app URL looks like user.autocode.dev/appname@1.0.0/. In order to always point to the newest release, user.autocode.dev/appname/ can be used as a shorthand.
user.autocode.dev/appname@dev/
user.autocode.dev/appname@1.0.0/
user.autocode.dev/appname/
Development Environments are mutable, meaning they can be overwritten indefinitely at the same web URL. Autocode automatically maintains a deployment history so that you can roll back to previous versions effortlessly.
Releases are immutable, meaning they can't be overwritten, only destroyed. New releases of an app must have a higher semver that older releases. In the case of apps responding to events, only the most recent release will receive Autocode system webhooks. You can safely maintain your own rollback system by keeping older releases live for a period of time — if a newer release has an error, it can be torn down and the old release will still exist as a fallback.
Autocode templates and snippets can be published open source in a click from the Autocode Online IDE. Publishing will make all of your source code for the specific environment you're working in public. All templates require admin approval before being added, so please contact us if you have a pending app.