Architect projects have a
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 | '- ws .......... Web Socket Lambda functions '- .arc
All folders are OPTIONAL. Architect ignores any other folders.
.arc manifest can be broadly split into three sections:
These sections are for global system level env configuration. The most important being the
@app namespace which is used to prefix all generated resources.
@app[Required] The application namespace
@domainAssign a domain name to your app (ACM, API Gateway, and Route 53)
Lambda Function config
These sections deal with Lambda functions and their event sources. By convention Architect promotes one event source per function.
@httpHTTP routes (API Gateway)
@eventsEvent pub/sub (SNS)
@queuesqueues and handlers for them (SQS)
@scheduledInvoke functions specified times (CloudWatch Events)
@wsWeb Socket functions (API Gateway)
These sections deal with config of various persistence resources.
@staticBuckets for hosting static assets (S3)
@tablesDatabase tables and trigger functions (DynamoDB)
@indexesTable global secondary indexes (DynamoDB)
.arccomments out anything after hash symbol
Provision a project with the following
# this is going to be great! @app testapp @events hello @http get / get /posts # the posts go here
npx create creates the following code:
/ |-src | |-events | | '-hello/ | '-http | |-get-index/ | '-get-posts/ '-.arc
The generated code was also immediately deployed to the built-in
staging environment. Subsequent edits to the local code are deployed by running
Happy with staging? Ship a release to production by running
npx deploy production.
Time to celebrate! ✨