Skip to content

codemonger-io/cdk-qwik-bundle

Repository files navigation

English / 日本語

cdk-qwik-bundle

Deploy a Qwik app through AWS Cloud Development Kit (CDK).

cdk-qwik-bundle provides a CDK construct to deploy a Qwik app to AWS as a AWS Lambda function for an HTTP API integration or REST API proxy integration on Amazon AWS API Gateway (API Gateway).

Getting started

Prerequisites

This library is intended to be combined with the CDK version 2.

Install

npm install https://github.com/codemonger-io/cdk-qwik-bundle.git#v0.2.0

There is no package published to npm yet. I would like to publish this library to npm if it could earn enought stars (maybe 10 or more?).

Qwik City Adapter

There is no Qwik City Adapter dedicated to this library so far, instead, please add Qwik City AWS Adapter to your Qwik project. You may need additional tweaks on it.

npm run qwik add aws-lambda

Please note that the configuration file (serverless.yml) for serverless is not used.

Bundling Qwik app with CDK

Please create QwikHandler to bundle your Qwik app as a Lambda function.

import * as path from 'path';
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { QwikHandler } from '@codemonger-io/cdk-qwik-bundle';

export class SimpleStack extends Stack {
    constructor(scope: Construct, id: string, props?: StackProps) {
        super(scope, id, props);
        const qwikApp = new QwikHandler(this, 'QwikApp', {
            entry: path.resolve('../qwik-app'),
        });
    }
}

You can find working examples in the examples folder.

API documentation

Please see the api-docs folder.

Acknowledgements

Most of the code was learned and taken from aws-cdk-lib/aws-lambda-nodejs.

License

MIT