Architect 7.0: HTTP APIs and even better Sandbox testing!

avatar
Ryan Block
September 18, 2020

Architect Logo

OpenJS Foundation Architect now powers thousands of serverless applications all over the world. Folks continue to tell us they value its focused, direct, stable, lock-in-free approach to building blazing fast modern web apps without ever having to manage a single server.

Today we’re extremely excited to announce Architect 7 (Chupacabra), a major step forward in building serverless web apps and APIs with AWS.

Chupacabra now deploys AWS API Gateway v2.0 (aka HTTP) APIs by default, and ships with a rewrite of Architect’s local development environment, Sandbox. The new Sandbox includes full local/offline support for building with HTTP APIs, and an even better interface for integrating Architect into your automated testing, from tape to jest (and everything in between).

Create your first serverless app in <60 seconds!

Want to give it a go? Here’s the super quickstart, no AWS credentials required:

Start sandbox in terminal

First: npm init @architect ./your-app-name Then: npx arc sandbox That’s it!

The benefits of HTTP APIs

For most applications most of the time, we now believe HTTP APIs are the right way to ship a serverless app on AWS. Compared to legacy REST APIs, there are some compelling reasons to use (and upgrade) to HTTP:

Existing Architect projects can upgrade to HTTP APIs with a single command; learn more in the Architect upgrade guide.

Enhanced testing with Sandbox

Architect 7 ships with a major upgrade to its local development and testing environment, Sandbox 2.0. Sandbox 2.0’s clean, unified testing interface enables granular controls for starting and stopping various local serverless services, and support for all major JS testing frameworks.

For example, here’s how to integrate Sandbox with two popular test libraries, Tape and Jest:

Tape

let sandbox = require('@architect/sandbox')
let test = require('tape)

test('Start the Sandbox', async t => {
  t.plan(1)
  let result = await sandbox.start()
  t.equal(result, 'Sandbox successfully started')
})

test('Tests go here', t => {
  // Make use of various Sandbox resources in your tests...
})

test('Shut down the Sandbox', async t => {
  t.plan(1)
  let result = await sandbox.end()
  t.equal(result, 'Sandbox successfully shut down')
})

Jest

let sandbox = require('@architect/sandbox')
beforeAll(async () => {
  let result = await sandbox.start()
  expect(result).toBe('Sandbox successfully started')
})
afterAll(async () => {
  let result = await sandbox.end()
  expect(result).toBe('Sandbox successfully shut down')
})
test('Tests go here', () => {
  // Make use of various Sandbox resources in your tests...
})

Upgrading from Architect 6.x

Where possible, we’ve taken every possible measure to ensure a seamless upgrade to Architect 7.x from 6.x (Ogopogo) and earlier. Architect 7.x is fully backward compatible, and continues to ship API Gateway REST APIs to existing Architect projects.

Changes to Sandbox may require minor settings updates for local workflows, and its new testing interface does remove support for some obscure, undocumented APIs.

To learn more, please check out our extensive Architect upgrade guide.

Thank you

We couldn’t do this work without the support and feedback of the Architect community, and of the folks at AWS working hard to make the future a little more serverless.

More specifically, we’d like to give a shout out to: Akash Peri, Alan Tan, Khozema Ujjainwala, and the entire API Gateway team, Ali Servet Donmez, Andy Buckingham, Carter Rabasa, Fil Maj, Greg Allen, Gregor Martynus, Jordan Harband, Jory Burson, and Kris Borchers.

Since releasing Architect with the OpenJS Foundation, there have been over 390 releases — with many more to come based on your feedback and contributions.

Oh, and don’t forget to join the Architect conversation in Discord!

Art by Michael Ramstead

Art by Michael Ramstead