Git Product home page Git Product logo

caopengau / aws-pdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws/aws-pdk

0.0 0.0 0.0 248.53 MB

The AWS PDK provides building blocks for common patterns together with development tools to manage and build your projects.

Home Page: https://aws.github.io/aws-pdk/

License: Apache License 2.0

Shell 1.04% JavaScript 0.20% Python 0.14% TypeScript 75.41% HTML 0.01% Handlebars 3.53% Mustache 19.00% Dockerfile 0.46% Java 0.24%

aws-pdk's Introduction

Getting started

What is the AWS PDK?

The AWS Project Development Kit (AWS PDK) provides building blocks for common patterns together with development tools to manage and build your projects.

The AWS PDK lets you define your projects programatically via the expressive power of type safe constructs available in one of 3 languages (typescript, python or java). This approach yields many benefits, including:

  • Ability to set up new projects within seconds, with all boilerplate already pre-configured.
  • Receive updates to previously bootstrapped projects when new versions become available i.e: updated dependenies or lint configurations.
  • Build polyglot monorepos, with build caching, cross-language build dependencies, dependency visualization and much more.
  • Leverage codified patterns which vend project and infrastructure (CDK) code.

The AWS PDK is built on top of Projen and as such all constructs that you compose together need to be defined via a projenrc file.

Why use the AWS PDK?

It's much easier to show than explain! Here is some PDK code (within projenrc file) that creates a Polyglot monorepo, with a React Website pre-configured with Cognito Auth and pre-integrated with a Smithy Type Safe Api.

import { CloudscapeReactTsWebsiteProject } from "@aws/pdk/cloudscape-react-ts-website";
import { InfrastructureTsProject } from "@aws/pdk/infrastructure";
import { MonorepoTsProject } from "@aws/pdk/monorepo";
import {
    DocumentationFormat,
    Language,
    Library,
    ModelLanguage,
    TypeSafeApiProject,
} from "@aws/pdk/type-safe-api";
import { javascript } from "projen";

const monorepo = new MonorepoTsProject({
    name: "my-project",
    packageManager: javascript.NodePackageManager.PNPM,
    projenrcTs: true,
});

const api = new TypeSafeApiProject({
    parent: monorepo,
    outdir: "packages/api",
    name: "myapi",
    infrastructure: {
        language: Language.TYPESCRIPT,
    },
    model: {
        language: ModelLanguage.SMITHY,
        options: {
        smithy: {
            serviceName: {
            namespace: "com.aws",
            serviceName: "MyApi",
            },
        },
        },
    },
    runtime: {
        languages: [Language.TYPESCRIPT],
    },
    documentation: {
        formats: [DocumentationFormat.HTML_REDOC],
    },
    library: {
        libraries: [Library.TYPESCRIPT_REACT_QUERY_HOOKS],
    },
    handlers: {
        languages: [Language.TYPESCRIPT],
    },
});

const website = new CloudscapeReactTsWebsiteProject({
    parent: monorepo,
    outdir: "packages/website",
    name: "website",
    typeSafeApi: api,
});

new InfrastructureTsProject({
    parent: monorepo,
    outdir: "packages/infra",
    name: "infra",
    cloudscapeReactTsWebsite: website,
    typeSafeApi: api,
});

monorepo.synth();

This code (also available in Python and Java), produces all the source code, packages and infrastructure needed to deploy a fully-operable application in the AWS cloud. All that's left to do is build and deploy it!

From this ~70 lines of code above, the AWS PDK produces the following packages on your behalf:

  • monorepo: Root level project that manages interdependencies between projects within the Monorepo, provides build caching and dependency visualziation.
  • api/model: A project that allows you to define your API using Smithy (or OpenAPI) IDL.
  • api/generated/documentation: A project that automatically creates API documentation in a variety of formats.
  • api/generated/infrastructure: A project that automatically creates API infrastructure constructs in a type-safe manner.
  • api/generated/libraries: A project that automatically generates a react hooks library that can be used to call your API from a React based website.
  • api/generated/runtime: A project that contains server bindings for handlers to ensure type safety.
  • api/handlers: A project that automatically creates handler stubs, preconfigured with type-safety and a variety of value added features based on your defined API's.
  • website: A project which creates a React based website built using Cloudscape that comes pre-integrated with Cognito Auth and your created API. This provides you with the ability to call your API securely.
  • infra: A project which sets up all CDK related infrastructure needed to deploy your application. It also comes pre-configured to generate a diagram based on your CDK code everytime you build.

Bootstrapped Source

Generated Website

Generated Diagram

As you can see, the AWS PDK provides you with valuable time savings so you can focus on working on what matters most to your project.

Developing with the AWS PDK

Please refer to the full documentation website.

https://aws.github.io/aws-pdk

Contributing to the AWS PDK

https://aws.github.io/aws-pdk/contributing/index.html

License

This project is licensed under the Apache-2.0 License.

aws-pdk's People

Contributors

agdimech avatar cogwirrel avatar jeremyjonas avatar sperka avatar dboyd13 avatar swap-aws avatar jstrunk avatar dependabot[bot] avatar mteichtahl avatar zsstiers avatar mirgj avatar martenpayne avatar jongwooo avatar joshuatoth avatar trivikr avatar valebedu avatar valter-silva-au avatar pcozzi avatar wawajo avatar walmsles avatar zetashift avatar drskur avatar jessieweiyi avatar janeklb avatar himan085 avatar garysassano avatar em-xqm avatar donatoaz avatar caopengau avatar bhrutledge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.