Project Layout

Architect projects have a .arc, arc.yaml or arc.json manifest file in the root. This captures the infrastructure requirements beside the code it will run in your revision control. Architect favors convention over configuration and projects have the following significant folder structure:

/
|- public ......... static assets (js, css, svg, images, etc)
|- src 
|  |- shared ...... code shared by ALL Lambda functions
|  |- views ....... code shared by HTTP GET Lambda functions
|  |- http ........ HTTP Lambda functions
|  |- events ...... Event Lambda functions
|  |- queues ...... Queue Lambda functions
|  |- scheduled ... Scheduled Lambda functions
|  '- tables ...... Table Trigger Lambda functions
'- .arc 

All folders are OPTIONAL. Architect ignores any other folders.


Configuration Reference

The .arc manifest can be broadly split into three sections:

System config

  • @app [Required] The application namespace
  • @domain Assign a domain name to your app (ACM, API Gateway, and Route 53)
  • @aws AWS config

Lambda Function config

  • @http HTTP routes (API Gateway, Lambda)
  • @events Event pub/sub (SNS, Lambda)
  • @queues queues and handlers for them (SQS, Lambda)
  • @scheduled Invoke functions specified times (CloudWatch Events)

Persistence config

  • @static Buckets for hosting static assets (S3)
  • @tables Database tables and trigger functions (DynamoDB)
  • @indexes Table global secondary indexes (DynamoDB)

.arc comments out anything after hash symbol #.

Example

Provision a project with the following .arc file:

# this is going to be great!
@app
testapp

@events
hello

@http
get /
get /posts # the posts go here

Running npx create creates the following code:

/
├── src
│   ├── events
│   │   └── hello/
│   ├── http
│   │   ├── get-index/
│   │   └── get-posts/
│   └── shared/
├── .arc
├── package.json
└── public/

The generated code was also immediately deployed to the built-in staging environment. Subsequent edits to the local code are deployed by running npx deploy.

Happy with staging? Ship a release to production by running npx deploy production.

Time to celebrate! ✨

Next: Learn how to work with HTTP functions