All Projects → jetbridge → jetkit-cdk

jetbridge / jetkit-cdk

Licence: MIT License
Cloud-native TypeScript API development kit for AWS CDK.

Programming Languages

typescript
32286 projects
HTML
75241 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to jetkit-cdk

cdk-multi-profile-plugin
Adds multi profile/account, mfa and aws sso support to cdk apps
Stars: ✭ 41 (+24.24%)
Mutual labels:  cdk
simple-nft-marketplace
This project provides sample codes to build a simple NFT marketplace with Amazon Managed Blockchain.
Stars: ✭ 59 (+78.79%)
Mutual labels:  cdk
document-processing-pipeline-for-regulated-industries
A boilerplate solution for processing image and PDF documents for regulated industries, with lineage and pipeline operations metadata services.
Stars: ✭ 36 (+9.09%)
Mutual labels:  cdk
django-cdk
A CDK library that provides high-level constructs for hosting Django applications on AWS
Stars: ✭ 31 (-6.06%)
Mutual labels:  cdk
cli
Panacloud Command Line Interface (CLI) uses the design-first approach for developing APIs. It generates Modern Multi-Tenant Serverless Cloud API infrastructure, mocks, stubs, tests, and stages using CDK. GraphQL schemas and OpenAPI specifications are used to implement the design-first approach.
Stars: ✭ 23 (-30.3%)
Mutual labels:  cdk
cdk-ecr-deployment
A CDK construct to deploy docker image to Amazon ECR
Stars: ✭ 51 (+54.55%)
Mutual labels:  cdk
rds-snapshot-export-to-s3-pipeline
RDS Snapshot Export to S3 Pipeline
Stars: ✭ 88 (+166.67%)
Mutual labels:  cdk
aws-serverless-fullstack-swift-apple-carplay-example
This application demonstrates a full-stack Apple CarPlay app that uses Swift for both the UI and the backend services in AWS. The app accesses Lambda functions written in Swift and deployed from Docker images. The app accesses Amazon Location Service and a 3rd party weather api to display information in the vicinity of the user.
Stars: ✭ 84 (+154.55%)
Mutual labels:  cdk
cdk pywrapper
A Python wrapper for the Chemistry Development Kit (CDK)
Stars: ✭ 25 (-24.24%)
Mutual labels:  cdk
demo-notes-app
Source for the demo notes app in the Serverless Stack Guide
Stars: ✭ 52 (+57.58%)
Mutual labels:  cdk
cloudfront-image-proxy
Make CloudFront resize images "on the fly" via lambda@edge, cache it and persists it in S3.
Stars: ✭ 32 (-3.03%)
Mutual labels:  cdk
aws-firewall-factory
Deploy, update, and stage your WAFs while managing them centrally via FMS.
Stars: ✭ 72 (+118.18%)
Mutual labels:  cdk
aws-cdk-github-oidc
CDK constructs to use OpenID Connect for authenticating your Github Action workflow with AWS IAM
Stars: ✭ 59 (+78.79%)
Mutual labels:  cdk
cdk-github-actions-runner
Deploy self-hosted GitHub Actions runner to AWS Fargate using AWS Cloud Development Kit (CDK)
Stars: ✭ 89 (+169.7%)
Mutual labels:  cdk
sourcestack
A highly adaptable template for full-stack Typescript web apps.
Stars: ✭ 45 (+36.36%)
Mutual labels:  cdk
aws-usage-queries
This application bootstraps everything needed to query the AWS Cost and Usage reports through Amazon Athena. It also includes reference data and preconfigured SQL queries.
Stars: ✭ 28 (-15.15%)
Mutual labels:  cdk
cdkdx
Zero-config CLI for aws cdk development
Stars: ✭ 31 (-6.06%)
Mutual labels:  cdk
amazon-sagemaker-model-serving-using-aws-cdk
This repository provides AI/ML service(MachineLearning model serving) modernization solution using Amazon SageMaker, AWS CDK, and AWS Serverless services.
Stars: ✭ 23 (-30.3%)
Mutual labels:  cdk
maildog
🐶 Hosting your own email forwarding service on AWS and managing it with Github Actions
Stars: ✭ 381 (+1054.55%)
Mutual labels:  cdk
aws-cdk-microservice
An AWS CDK Construct to deploy microservice infra in less than 50 lines of code.
Stars: ✭ 48 (+45.45%)
Mutual labels:  cdk

JetKit/CDK

Tests npm version Open in Visual Studio Code

An anti-framework for building cloud-native serverless applications.

This module provides convenient tools for writing Lambda functions, RESTful API views, and generating cloud infrastructure with AWS CDK.

Motivation

Frameworkless web applications.

We want to build maintainable and scalable cloud-first applications, with cloud resources generated from application code.

Using AWS CDK we can automate generating API Gateway routes and Lambda functions from class and function metadata.

Each class or function view is a self-contained Lambda function that only pulls in the dependencies needed for its functioning, keeping startup times low and applications modular.

Documentation

Guides and API reference can be found at https://jetkit.dev/docs/.

Super Quickstart

Use this monorepo project template: typescript-cdk-template.

Installation

npm install @jetkit/cdk

Synopsis

API View

Combine related functionality and routes into a single Lambda function bundle.

import { HttpMethod } from "@aws-cdk/aws-apigatewayv2"
import { badRequest, methodNotAllowed } from "@jdpnielsen/http-error"
import { ApiView, SubRoute, ApiEvent, ApiResponse, ApiViewBase, apiViewHandler } from "@jetkit/cdk-runtime"

@ApiView({
  path: "/album",
})
export class AlbumApi extends ApiViewBase {
  // define POST /album handler
  @SubRoute({ methods: [HttpMethod.POST] })
  async post() {
    return "Created new album"
  }

  // custom endpoint in the view
  // routes to the ApiView function
  @SubRoute({
    path: "/{albumId}/like", // will be /album/123/like
    methods: [HttpMethod.POST, HttpMethod.DELETE],
  })
  async like(event: ApiEvent): ApiResponse {
    const albumId = event.pathParameters?.albumId
    if (!albumId) throw badRequest("albumId is required in path")

    const method = event.requestContext.http.method

    // POST - mark album as liked
    if (method == HttpMethod.POST) return `Liked album ${albumId}`
    // DELETE - unmark album as liked
    else if (method == HttpMethod.DELETE) return `Unliked album ${albumId}`
    // should never be reached
    else return methodNotAllowed()
  }
}
// Not required but lets you omit specifying the `entry` path to this file for convenience.
export const handler = apiViewHandler(__filename, AlbumApi)
// If using ES modules
// export const handler = apiViewHandlerEs(import.meta, AlbumApi)

Handler Function With Route

import { HttpMethod } from "@aws-cdk/aws-apigatewayv2"
import { Lambda, ApiEvent } from "@jetkit/cdk-runtime"

// a simple standalone function with a route attached
export async function topSongsHandler(event: ApiEvent) {
  return JSON.stringify(event.headers)
}
// define route and lambda properties
Lambda({
  path: "/top-songs",
  methods: [HttpMethod.GET],
})(topSongsHandler)
// If using ES modules:
// LambdaEs(import.meta, { path: "/top-songs" })(topSongsHandler)

// alternate, uglier way of writing the same thing
const topSongsFuncInner = Lambda({
  path: "/top-songs-inner",
  methods: [HttpMethod.GET],
  // this function name should match the exported name
  // or you must specify the exported function name in `handler`
})(async function topSongsFuncInner(event: ApiEvent) {
  return JSON.stringify(event.headers)
})
export { topSongsFuncInner }

CDK Stack

To start from scratch:

npm install -g aws-cdk
cdk init app --language typescript
npm install @jetkit/cdk @aws-cdk/core @aws-cdk/aws-apigatewayv2

See the guide for more details.

To deploy your stack:

cdk deploy

To generate API Gateway routes and Lambda function handlers from your application code:

import { CorsHttpMethod, HttpApi } from "@aws-cdk/aws-apigatewayv2"
import { Duration, Stack, StackProps, App } from "@aws-cdk/core"
import { ResourceGeneratorConstruct, ApiViewCdk } from "@jetkit/cdk"
import { topSongsHandler, AlbumApi } from "./test/sampleApp"

export class InfraStack extends Stack {
  constructor(scope: App, id: string, props?: StackProps) {
    super(scope, id, props)

    // create API Gateway
    const httpApi = new HttpApi(this, "Api", {
      corsPreflight: {
        allowHeaders: ["Authorization"],
        allowMethods: [CorsHttpMethod.ANY],
        allowOrigins: ["*"],
        maxAge: Duration.days(10),
      },
    })

    // transmute your app code into infrastructure
    new ResourceGeneratorConstruct(this, "Generator", {
      resources: [
          // supply your functions and view classes here
          topSongsHandler,
          
          // can add additional lambda attributes here if desired
          ApiViewCdk({ memorySize: 1024, bundling: { minify: true }})(AlbumApi)
      ], 
      httpApi,
    })
  }
}

How It Works

This library provides decorators that can be attached to view classes, methods, and functions. The decorator attaches metadata in the form of options for constructing the Lambda function and optionally API Gateway routes.

It also includes some convenient CDK L3 constructs to generate the Lambda functions and API Gateway routes from your decorated application code.

Local Development

AWS SAM supports running CDK applications locally (in beta).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].