This folder contains the Infrastructure as Code (IaC) configuration for the API (backend)'s stateless resources, primarily AWS Lambda functions, API Gateway, and IAM roles. The /infra
folder is responsible for stateful resources like databases, authentication services, and other persistent resources.
One of the advantages of managing stateless resources in this directory is that if they are accidentally removed or modified, the data stored in stateful resources (e.g., databases) will not be lost.
The API/IaC Directory is organized into the following sub-folders:
serverless
: Contains the serverless configuration files for various components, such as functions, IAM roles, and provider settings.serverless/functions
: Contains the configuration for AWS Lambda functions, including the API Gateway event triggers and associated handlers.serverless/helpers.ts
: Utility functions and shared code used across serverless configurations.serverless/iam
: Contains IAM role configurations for the API (backend).serverless/provider
: Contains provider-specific settings and configurations, such as tags.
The API/IaC Directory is responsible for:
- Defining and managing stateless infrastructure resources for the API (backend).
- Configuring provider settings and options for stateless resources.
- Ensuring that the serverless configuration for stateless resources is up-to-date and accurate.
When working with the API/IaC Directory, follow these best practices:
- Keep resource definitions for stateless services organized and modular by placing them in separate files within the
serverless
folder. - Use the serverless framework for managing stateless infrastructure resources and deployments.
- Follow best practices for Infrastructure as Code, such as keeping configurations version-controlled and documenting changes.
When adding new stateless infrastructure resources or updating existing ones, ensure that you:
- Follow the existing project structure and organization.
- Update this README.md file if needed.
- Test your changes thoroughly before deploying them to production.
- Adhere to the project's coding style and best practices.