DEV Community 👩‍💻👨‍💻

Cover image for begin quickstart with http functions

Posted on • Updated on

begin quickstart with http functions

Begin is a platform for building modern web apps, sites, & APIs. It leverages globally available serverless infrastructure, SSD-backed databases, CDNs, and GitHub powered continuous integration. It is scientifically proven to be "ridiculously quick."


  • Begin will provision your GitHub repo pre-wired with the integrations it needs such as webhooks to Begin's CI.
  • Begin manages AWS infrastructure solely on Node 12 with additional runtimes coming soon.
  • Recent releases of Node bundle npm 5.x but npm 6.x is required for local development. Run npm install npm@latest -g to upgrade.
  • Click Login on the Begin home page to create a Begin account. Authorize it with GitHub and pick a username.

Creating and deploying an app

Login to your Begin account and click the "Create new app" button. You will first choose either a Node.js or Deno runtime.


By default you will see a list of Node.js framework-specific starter apps. Scroll down to see a list of additional example apps.


Select an app from the list of starters. You will then be asked to give your project a name.


Click "Create Hello World app" to spin up a new project under{your GH username}/{your repo name}.


After Begin sets up your repo it will kick off its first deploy to your staging environment.


By default, each commit to main initiates a build.


If the build is green that build is immediately deployed to your app's staging environment. To access your staging environment, click the Staging link in the build status module.


Click Production to see your production environment.


Project structure

Begin applications are comprised of many small, individually executing cloud functions.

├── .gitignore
├── index.js
├── package.json
Enter fullscreen mode Exit fullscreen mode

If you try to create your application as a single, giant, monolithic Lambda function then Brian LeRoux will personally come to your house and flip your dinner table over.


Begin example apps written for the node.js runtime use JSON added to the apps package.json file.

"name": "begin-app",
"version": "0.0.0",
"description": "Begin basic Hello World! app for Node",
"arc": {
  "app": "hello-world",
  "http": [
      "/": {
        "method": "any",
        "src": "."
Enter fullscreen mode Exit fullscreen mode

Start script

"scripts": {
  "start": "cross-env NODE_ENV=testing npx sandbox"
Enter fullscreen mode Exit fullscreen mode

Development dependencies

"devDependencies": {
  "@architect/functions": "latest",
  "@architect/sandbox": "^3.3.6",
  "@begin/data": "latest",
  "cross-env": "^7.0.3"
Enter fullscreen mode Exit fullscreen mode


Function directories must contain an index.js file that services the cloud function handler and any dependencies required for it to operate.

HTTP Functions

Each HTTP Function directory services a handler for a publicly available HTTP route.

exports.handler = async function http(req) {
  let html = `
    <!doctype html>
    <html lang=en>
        <meta charset=utf-8>
        <title>This is a title</title>
        <h1 class="center-text">
          I hath been shipped

        <p class="center-text">
          Nailed it

  return {
    headers: {
      'content-type': 'text/html; charset=utf8',
      'cache-control': 'no-cache, no-store, must-revalidate, max-age=0, s-maxage=0'
    statusCode: 200,
    body: html
Enter fullscreen mode Exit fullscreen mode

To deploy your changes, click "Deploy to Production"


Click Ship it to ship that sucker.


You can see this thoroughly shipped site at the following link.

Top comments (0)

🌚 Life is too short to browse without dark mode