Example Node (Express + Knex) codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.
This repository contains the infrastructure code for the Conduit Application, a real-world example application adhering to the RealWorld API spec. It uses AWS CDK to manage the deployment of foundational components such as S3 buckets, IAM roles, SQS queues, and CI/CD pipelines.
Architecture Overview | Get Started | Contributing | License
The project follows a monorepo structure using Turbo Repo and is divided into two repositories:
- Realword Node.js Example App Infrastructure: Contains the infrastructure stacks such as storage, roles, queues, and CI/CD pipelines.
- Realword Node.js Example App: Contains Lambda functions and API Gateway configuration.
- S3: For object storage, used to store artifacts on CodeBuild.
- IAM Roles: For permissions management, roles are created for CodePipeline, CodeBuild, and Lambda functions.
- SQS: For asynchronous messaging between microservices.
- CodePipeline: For CI/CD deployment pipelines.
- API Gateway + Lambda: Defines the serverless microservices (located in the app repo).
- Node.js v14+: CDK requires Node.js to be installed.
- AWS CDK v2: Install the latest version of the CDK. npm install -g aws-cdk
- Yarn: Use Yarn as the package manager. npm install -g yarn
-
Clone the repository:
git clone https://github.com/kenyipp/realworld-nodejs-example-app-infra
-
Install dependencies:
yarn install
-
Bootstrap the CDK environment (if not already done):
cdk bootstrap aws://<account-id>/<region>
-
Synthesize the CloudFormation templates:
cdk synth
-
View available stacks:
cdk list
After synthesizing the CDK program, you will see a folder called cdkgraph under the
cdk.out folder. You can review the infrastructure to ensure it matches your
expectations. Adjust the preset and filter in main.ts. For more details on
generating the graph, click here.
We are using Amazon CDK to deploy the application. Additionally, we have set up a CI/CD pipeline to automatically deploy the CDK application once the lint check and test cases pass.
| Environment Variable | Description | Example |
|---|---|---|
NODE_ENV |
The running environment (e.g., development, production) | develop, production |
AWS_ACCOUNT_ID |
The AWS account ID. You can get it from the AWS Management Console under "My Account" | 123456789012 |
GITHUB_INFRA_REPOSITORY |
The repository name of the infrastructure | realworld-nodejs-example-app-infra |
GITHUB_INFRA_OWNER |
The owner of the infrastructure repository | kenyipp |
GITHUB_CONDUIT_SERVER_REPOSITORY |
The repository name of the server | realworld-nodejs-example-app |
GITHUB_CONDUIT_SERVER_OWNER |
The owner of the server repository | kenyipp |
Note: If you want to deploy the application automatically via GitHub Actions, you need to set up the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in the GitHub settings.
To deploy a specific stack, use:
cdk deploy <stack-name>To deploy all stacks:
cdk deploy --allPlease review the existing issues in this repository for areas that require improvement. If you identify any missing or potential areas for improvement, feel free to open a new issue.
This project is licensed under the MIT License - see the LICENSE file for details.
