Giter VIP home page Giter VIP logo
Buttonize photo

buttonize Goto Github PK

repos: 4.0 gists: 0.0

Name: Buttonize

Type: Organization

Bio: Hook-up UI components directly to AWS Lambda functions. Just install Buttonize and deploy your CDK. That's it. People behind: @FilipPyrek @chromale

Twitter: buttonizeio

Blog: https://buttonize.io

Buttonize.io


Discord npm Build status

Buttonize enables you to build internals tools with AWS CDK.

Hook-up UI components directly to AWS Lambda functions. Just install Buttonize and deploy your CDK. That's it.

Getting started

Sign-up at app.buttonize.io

Setup fresh new CDK project

npm

$ npx create-buttonize
$ cd my-buttonize-app && npm install
$ npx buttonize dev --profile=YOUR_AWS_PROFILE bin/cdk.ts

pnpm

$ pnpm create buttonize
$ cd my-buttonize-app && pnpm install
$ pnpm buttonize dev --profile=YOUR_AWS_PROFILE bin/cdk.ts

Install to existing CDK project

Modify CDK bin code to export the App

export const app = new cdk.App()

npm

$ npm install -D buttonize
$ npx buttonize dev --profile=YOUR_AWS_PROFILE bin/cdk.ts

pnpm

$ pnpm add -D buttonize
$ pnpm buttonize dev --profile=YOUR_AWS_PROFILE bin/cdk.ts

Constructs Library

With Buttonize you have two options how to build your internal apps

  1. Build your own custom app by using ButtonizeApp construct. Learn more in the next section.
  2. Use Constructs Library with ready-made customizable constructs for different AWS services.

Learn more about library.

Constructs Library

Build your own Buttonize app

.
├── bin
│   └── cdk.ts
├── lib
│   └── example-stack.ts
├── src
│   └── discountGenerator.ts
├── cdk.json
└── package.json
// bin/cdk.ts

#!/usr/bin/env node
import 'source-map-support/register'

import * as cdk from 'aws-cdk-lib'

import { ExampleStack } from '../lib/example-stack'

export const app = new cdk.App()
new ExampleStack(app, 'ExampleStack')
// lib/example-stack.ts

import * as cdk from 'aws-cdk-lib'
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs'
import { Action, Buttonize, ButtonizeApp, Display, Input } from 'buttonize/cdk'
import { Construct } from 'constructs'
import * as path from 'path'

export class ExampleStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props)

    Buttonize.init(this, {
      apiKey: 'btnz_mybuttonizekey1234567'
    })

    const discountGenerator = new NodejsFunction(this, 'DiscountGenerator', {
      entry: path.join(__dirname, '../', 'src', 'discountGenerator.ts')
    })

    new ButtonizeApp(this, 'DemoApp', {
      name: 'Discount code generator',
      description:
        'Select the discount amount and you will get the discount code on the next page.'
    })
      .page('InputPage', {
        body: [
          Display.heading('Generate discount code for customer'),
          Input.select({
            id: 'discount',
            label: 'Discount value',
            options: [
              { label: '30%', value: 30 },
              { label: '60%', value: 60 }
            ]
          }),
          Display.button({
            label: 'Generate discount',
            onClick: Action.aws.lambda.invoke(
              discountGenerator,
              { Payload: { discountValue: '{{discount}}' } },
              { id: 'discountGenerator' }
            ),
            onClickFinished: Action.buttonize.app.changePage('DonePage')
          })
        ]
      })
      .page('DonePage', {
        body: [
          Display.heading('Discount generated'),
          Display.text('Discount code: {{InputPage.discountGenerator.code}}')
        ]
      })
  }
}
// src/discountGenerator.ts

export const handler = async (event: { discountValue: number }) => {
  console.log(`Generating discount of value ${event.discountValue}`)

  return {
    discountValue: event.discountValue,
    code: `${Math.random()}`.split('.')[1]
  }
}

Result


CLI

Options

--profile

AWS profile name to used for fetching stack metadata. You can also set AWS_PROFILE environment variable instead.

$ npx buttonize dev --profile=YOUR_AWS_PROFILE bin/cdk.ts

--region

AWS region used for fetching stack metadata. You can also set AWS_REGION environment variable instead.

$ npx buttonize dev --region=eu-central-1 bin/cdk.ts

--help

Prints out CLI help information.

$ npx buttonize --help

Arguments

<entrypoint>

Path to JS/TS file where the CDK app is defined.

$ npx buttonize dev bin/cdk.ts

Docs

Learn more at docs.buttonize.io


Join our community Discord | Twitter

Buttonize's Projects

buttonize icon buttonize

🎨 All you need to hook-up UI components directly to your AWS Lambda functions. Just install Buttonize and deploy your CDK. That's it.

docs icon docs

📖 Documentation of Buttonize

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.