{"id":18772319,"url":"https://github.com/panacloud/cli","last_synced_at":"2025-04-13T07:33:00.889Z","repository":{"id":39055068,"uuid":"401763078","full_name":"panacloud/cli","owner":"panacloud","description":"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. ","archived":false,"fork":false,"pushed_at":"2023-03-01T20:00:27.000Z","size":8278,"stargazers_count":25,"open_issues_count":112,"forks_count":6,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-10-30T18:08:16.149Z","etag":null,"topics":["aws","cdk","graphql","openapi","serverless"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panacloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-31T15:59:42.000Z","updated_at":"2024-02-28T10:41:59.000Z","dependencies_parsed_at":"2023-02-13T20:17:08.161Z","dependency_job_id":null,"html_url":"https://github.com/panacloud/cli","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panacloud%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panacloud%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panacloud%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panacloud%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panacloud","download_url":"https://codeload.github.com/panacloud/cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223576330,"owners_count":17167848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cdk","graphql","openapi","serverless"],"created_at":"2024-11-07T19:28:35.410Z","updated_at":"2024-11-07T19:28:36.102Z","avatar_url":"https://github.com/panacloud.png","language":"TypeScript","readme":"[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)\n[![Version](https://img.shields.io/npm/v/@panacloud/cli.svg)](https://www.npmjs.org/package/@panacloud/cli)\n[![Downloads/week](https://img.shields.io/npm/dw/@panacloud/cli.svg)](https://www.npmjs.org/package/@panacloud/cli)\n[![License](https://img.shields.io/npm/l/@panacloud/cli.svg)](https://github.com/panacloud/cli/blob/master/package.json)\n\n# Panacloud Command Line Interface (CLI)\n\n[Panacloud CLI Discord Channel](https://discord.gg/uQ7vPXuu5v)\n\nIn a recent [report](https://venturebeat.com/2021/12/09/report-75-of-devs-indicate-that-participating-in-api-economy-is-top-priority/) 75% of developers indicate that participating in API economy is ‘top priority’. Panacloud is an unified API development, fundraising, and ownership economy platform.  It provides services, libraries, tools, and frameworks for developing totally open multi-tenant, serverless cloud services with integrated multi-tenant billing, crowdfunding, and ownership economy constructs.  This allows developers to concentrate solely on creating specialised code related to their domain, leaving the rest to the Panacloud platform and services. This model has the potential to disrupt both the software and venture investment industries and making the API developers rich and owners of their own destiny and unicorn startups.\n\nPanacloud CLI accelerates the building of modern multi-tenant serverless SaaS APIs. The CLI applies the design-first paradigm and implements the best practices for designing GraphQL APIs using public cloud serverless and infrastructure as code technologies. The CLI takes a [GraphQL API](https://graphql.org/) [schema](https://graphql.org/learn/schema/) that has been augmented with Panacloud directives and creates [infrastructure as code (IaC)](https://acloudguru.com/blog/engineering/cloudformation-terraform-or-cdk-guide-to-iac-on-aws), mock lambdas, tests, and scaffolding for genuine lambdas that include business logic and database requests. It makes use of [AWS CDK](https://aws.amazon.com/cdk/) for IaC. It now only supports AWS, TypeScript and GraphQL, but future versions will also support Azure and Google Cloud, OpenAPI and other languages as well.\n\n![CLI Flow](img/cli.png \"CLI Diagram\")\n\n\nThe generated serverless SaaS API project supports multi-tenant usage based billing and monetering and is closely integrated with the [Panacloud portal](https://www.panacloud.org). The developer just needs to write the specific code required by the Multi-Tenant SaaS project. This greatly reduces custom developer coding and increases speed to market. GraphQL and Open REST APIs can be built by using the Panacloud CLI. The APIs may use Graph or Relational databases, etc.\n\nWe have also published detailed [Tutorials](https://github.com/panacloud-modern-global-apps/full-stack-serverless-cdk) to help you to learn AWS CDK. \n\nBefore getting started you need to install the following packages and libraries:\n\n1. Install [Node.js](https://nodejs.org/en/)\n2. Install [AWS CLI Version 2.x](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)\n3. Install [AWS CDK Version 2](https://docs.aws.amazon.com/cdk/latest/guide/work-with-cdk-v2.html)\n4. Install Globally [TypeScript](https://www.typescriptlang.org/download)\n\nBefore starting your API project learn to develop APIs using this [bootcamp](https://github.com/panacloud/bootcamp-2021#part-3-introduction-to-serverless-and-cloud-computing-using-cdk) and [learning API repo](https://github.com/panacloud-modern-global-apps/api-design-prototype-testing)\n\nThe first step in developing a GraphQL [schema](https://dgraph.io/blog/post/designing-graphql-schemas/) for your APIs. Once you have built your GraphQL schema and enhanced it with Panacloud directives, we will now use this CLI to develop the serverless cloud APIs.\n\nThe code generated by the CLI will consist of two parts:\n\n1. Code that will be managed and updated by the CLI. As we add and update the API schema, we will update the generated code using the CLI.\n2. Code that is editable by the API developer and is contained in the editiable_src directory. This code code contains the buisiness logic and is edited and updated by the developer.\n\nNote: The developer can also modify and add the IaC CDK code by using [CDK aspects](https://docs.aws.amazon.com/cdk/latest/guide/aspects.html).\n\nNow Globally Install Panacloud CLI:\n\nnpm install @panacloud/cli -g \n\n\u003c!-- toc --\u003e\n* [Panacloud Command Line Interface (CLI)](#panacloud-command-line-interface-cli)\n* [Getting Started](#getting-started)\n* [Usage](#usage)\n* [Panacloud Commands](#panacloud-commands)\n* [Project NPM Commands](#project-npm-commands)\n\u003c!-- tocstop --\u003e\n\n# Getting Started\nPlease read these articles to understand the approach:\n\n[API-First, API Design-First, or Code-First: Which Should You](https://blog.stoplight.io/api-first-api-design-first-or-code-first-which-should-you-choose)\n\n[Schema-First GraphQL: The Road Less Travelled](https://blog.mirumee.com/schema-first-graphql-the-road-less-travelled-cf0e50d5ccff)\n\nIn order to start learning to develop Serverless GraphQL APIs we have developed a very simple schema in the `user.graphql` file at the root of this tutorial.\n\nYou can learn how to develop GraphQL schemas from [the schema official documentation](https://graphql.org/learn/schema/)\n\n1.  Now we will generate an AWS CDK project using the panacloud cli.\n\n  ```\n  mkdir my_user_api\n\n  cd my_user_api\n\n  panacloud init\n  ```\n2. On the command promt answer the question:\n  ```\n  GraphQL Schema File Path? ../user.graphql\n  API Name? MyUserAPI\n  Select Database? Neptune (Graph) \n  Select Query Language? Gremlin\n  ```\nNow the MyUserAPI code is generated and available in the `my_user_api` directory.\n\nPlease review [tutorials](https://github.com/panacloud/cli/tree/main/tutorials) for a detailed introduction to the project generated by CLI.\n\n# Usage\n\n\u003c!-- usage --\u003e\n```sh-session\n$ npm install -g @panacloud/cli\n$ panacloud COMMAND\nrunning command...\n$ panacloud (-v|--version|version)\n@panacloud/cli/0.0.9 darwin-arm64 node-v16.13.2\n$ panacloud --help [COMMAND]\nUSAGE\n  $ panacloud COMMAND\n...\n```\n\u003c!-- usagestop --\u003e\n\n# Panacloud Commands\n\n\u003c!-- commands --\u003e\n* [`panacloud client [FILE]`](#panacloud-client-file)\n* [`panacloud config:customData`](#panacloud-configcustomdata)\n* [`panacloud config:memory [QUERY_NAME] [MEMORY_SIZE]`](#panacloud-configmemory-query_name-memory_size)\n* [`panacloud config:mock [QUERY_NAME]`](#panacloud-configmock-query_name)\n* [`panacloud config:stage [STAGE_NAME]`](#panacloud-configstage-stage_name)\n* [`panacloud config:timeout [QUERY_NAME] [TIMEOUT]`](#panacloud-configtimeout-query_name-timeout)\n* [`panacloud help [COMMAND]`](#panacloud-help-command)\n* [`panacloud init`](#panacloud-init)\n* [`panacloud login`](#panacloud-login)\n* [`panacloud merge`](#panacloud-merge)\n* [`panacloud status`](#panacloud-status)\n* [`panacloud update`](#panacloud-update)\n\n## `panacloud client [FILE]`\n\ndescribe the command here\n\n```\nUSAGE\n  $ panacloud client [FILE]\n\nOPTIONS\n  -h, --help  show CLI help\n```\n\n_See code: [src/commands/client.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/client.ts)_\n\n## `panacloud config:customData`\n\nUpate panacloudconfig.json\n\n```\nUSAGE\n  $ panacloud config:customData\n\nOPTIONS\n  -f, --false  Set is_custom false\n  -h, --help   show CLI help\n  -t, --true   Set is_custom true\n```\n\n_See code: [src/commands/config/customData.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/config/customData.ts)_\n\n## `panacloud config:memory [QUERY_NAME] [MEMORY_SIZE]`\n\nUpate panacloudconfig.json\n\n```\nUSAGE\n  $ panacloud config:memory [QUERY_NAME] [MEMORY_SIZE]\n\nOPTIONS\n  -h, --help  show CLI help\n```\n\n_See code: [src/commands/config/memory.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/config/memory.ts)_\n\n## `panacloud config:mock [QUERY_NAME]`\n\nUpate panacloudconfig.json\n\n```\nUSAGE\n  $ panacloud config:mock [QUERY_NAME]\n\nOPTIONS\n  -f, --false  Set is_mock false\n  -h, --help   show CLI help\n  -t, --true   Set is_mock true\n```\n\n_See code: [src/commands/config/mock.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/config/mock.ts)_\n\n## `panacloud config:stage [STAGE_NAME]`\n\nUpate panacloudconfig.json\n\n```\nUSAGE\n  $ panacloud config:stage [STAGE_NAME]\n\nOPTIONS\n  -a, --add     Add New Stage\n  -h, --help    show CLI help\n  -r, --remove  Remove Stage\n```\n\n_See code: [src/commands/config/stage.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/config/stage.ts)_\n\n## `panacloud config:timeout [QUERY_NAME] [TIMEOUT]`\n\nUpate panacloudconfig.json\n\n```\nUSAGE\n  $ panacloud config:timeout [QUERY_NAME] [TIMEOUT]\n\nOPTIONS\n  -h, --help  show CLI help\n```\n\n_See code: [src/commands/config/timeout.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/config/timeout.ts)_\n\n## `panacloud help [COMMAND]`\n\ndisplay help for panacloud\n\n```\nUSAGE\n  $ panacloud help [COMMAND]\n\nARGUMENTS\n  COMMAND  command to show help for\n\nOPTIONS\n  --all  see all commands in CLI\n```\n\n_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.3/src/commands/help.ts)_\n\n## `panacloud init`\n\nGenerates CDK code based on the given schema\n\n```\nUSAGE\n  $ panacloud init\n\nOPTIONS\n  -d, --database=(DynamoDB (NoSQL)|Neptune (Graph)|Aurora Serverless (Relational))\n  -h, --help                                                                        show CLI help\n  -t, --test\n```\n\n_See code: [src/commands/init.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/init.ts)_\n\n## `panacloud login`\n\nLogin into your Panacloud Portal Account\n\n```\nUSAGE\n  $ panacloud login\n```\n\n_See code: [src/commands/login.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/login.ts)_\n\n## `panacloud merge`\n\nMerge multiple GraphQL schema in one\n\n```\nUSAGE\n  $ panacloud merge\n\nOPTIONS\n  -h, --help  show CLI help\n```\n\n_See code: [src/commands/merge.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/merge.ts)_\n\n## `panacloud status`\n\ndescribe the command here\n\n```\nUSAGE\n  $ panacloud status\n\nOPTIONS\n  -h, --help  show CLI help\n```\n\n_See code: [src/commands/status.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/status.ts)_\n\n## `panacloud update`\n\nUpdates the Generated Code.\n\n```\nUSAGE\n  $ panacloud update\n\nOPTIONS\n  -h, --help  show CLI help\n```\n\n_See code: [src/commands/update.ts](https://github.com/panacloud/cli/blob/v0.0.9/src/commands/update.ts)_\n\u003c!-- commandsstop --\u003e\n\n# Project NPM Commands\n\nOnce the project is generated you may run the following npm scripts\n\n\u003c!-- npm commands --\u003e\n* `npm run deploy-dev` Deploy Development Stage\n* `npm run deploy-prd` Deploy Production Stage\n* `npm run destroy-dev` Destroy Development Stage\n* `npm run destroy-prd` Destroy Production Stage\n* `npm run test-dev` Run Tests for the Development Stage\n* `npm run test-prd` Run Tests for the Production Stage\n\n\n## Details about the Project Generated by the CLI\n\nThe CLI generates project for Multi-Tenant Serverless API development with [AWS Cloud Development Kit (CDK)](https://docs.aws.amazon.com/cdk/latest/guide/home.html) using TypeScript. It comes with all the necessary code to develop and deploy a Serverless GraphQL API in the AWS Cloud.  This includes the provisioning of cloud infrastructure in code and Serverless stubs where developers may easily include their business logic. The project also provides pre-built mock lambda functions and unit tests to test your deployed APIs. \n\nThe project code may be conceptually divided into two parts:\n\n1. The code that is generated by the Panacloud CLI, and will continuously be updated by the CLI as your API schema evolves. If the developer edits and updated this code, it will be overwritten next time the schema is updated and Panacloud CLI update command is given.\n2. The code that the developer edits and updates and contains the business logic for the APIs. This code is contained in the `editable_src/` directory. \n\nIt is highly recommended that the developer only edit and update the code contained in the `editable_src/` directory because the rest of the code is generated and updated by the Panacloud CLI.\n\nThe generated project code includes the mock lambdas contained in the `mock_lambda` directory in the root project folder. Typically, the developer will write business logic in the stub lambdas contained in the `editable_src/lambdas/` directory. The configuration contained in the `editable_src/panacloudconfig.json` file decides which lambda the APIs will call. Therefore, the project may be using mock lambdas in some calls and the real stub lambdas in other calls. This flexibility allows the developer to seamlessly transition from mock APIs towards real APIs, without the API users and testers even noticing it. Also, the mock APIs may be deployed right away.\n\nThe API CDK stack (cloud infrastructure in code) is generated by the Panacloud CLI `panacloud init` command given the API schema. API development is an iterative process, therefore when the developer updates the API schema in the `editable_src/graphql/schema/` directory and runs the `panacloud update` command the project's CDK code is updated. Given this cycle, most of the CDK stack is generated and updated by the Panacloud CLI. However, the developer has the flexibility to add and update the CDK stack by adding and updating visitors in the `editable_src/aspects/` directory. The Panacloud framework uses [Aspects](https://docs.aws.amazon.com/cdk/latest/guide/aspects.html) to enhance generated constructs and add cloud constructs written by the API developers.\n\nThe `editable_src/` directory contains all the code which the developer edits.  \n\nThe `editable_src/lambdas/` directory contains all the lambda stubs where the developer writes the business logic.  \n\nThe `editable_src/panacloudconfig.json` file tells the Panacloud framework which lambda functions to call.\n\nThe `editable_src/aspects` directory contains all the CDK code which the developer adds to the project CDK stack.  \n\nThe `cdk.json` file tells the CDK Toolkit how to execute your app.\n\n## The Panacloud Dapp and Protocol Complements the CLI\n\n The [Panacloud Dapp](https://www.panacloud.org/) and [protocol](https://github.com/panacloud/protocol) complements this CLI and facilitates the API developer to: \n \n 1. [Tokenize](https://cryptonews.com/news/tokenization-crowdfunding-in-the-era-of-cryptocurrency-and-b-10972.htm) the APIs and raise funding for API development.\n 2. Document the developer ownership of the API by issuing you an [NFT](https://ethereum.org/en/nft/).\n 3. Market the APIs to the application developers in the API bazaar/store.\n 4. Create a decentralized [autonomous organization (DAO)](https://ethereum.org/en/dao/) for the APIs for governance in which the API token holders i.e. developer, investors, and users can participate.\n 5. Monitor APIs and do multi-tenant billing and clearing on the Ethereum blockchain using smart contracts. \n 6. Issue tokens to API early adopters and users to incentivize them to subscribe and use the APIs and become a participant in the [Owership Economy](https://variant.fund/writing/the-ownership-economy-crypto-and-consumer-software).\n 8. Allow the stakeholders to cash out whenever they require liquidity by selling API tokens.\n\n\n ## The Panacloud CLI Roadmap\n\n### First Public Release\n\nRelease Date: December 25, 2021\n\nFunctionality:\n\n1. DynamoDB \n2. Neptune \u0026 AuroraDB\n3. Microservice dirrective\n4. Multiple stacks\n5. MockData \u0026 MockLambda \n6. panacloud status\n7. panacloud client\n \n### Second Release\n\nExpected Date: January 15, 2022\n\nFunctionality: \n\n1. API Tests\n2. Async Dirrective\n3. Nested Resolver \n4. Return Type ( Issues with DynamoDB \u0026 Neptune )\n\n### Third Release\n\nExpected Date: Feburary 1, 2022\n\nFunctionality: \n\nMulti-Tenant monetering and billing data live streamed to Amazon Timestream Database deployed in Panacloud AWS Account. \n\n### Fourth Release\n\nExpected Date: March 1, 2022\n\nFunctionality: Basic OpenAPI speficication support.\n","funding_links":[],"categories":["API-First Tools"],"sub_categories":["Design and Specification"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanacloud%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanacloud%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanacloud%2Fcli/lists"}