From ad7d11a3f5df7dc5556126031e8344f320f2de71 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Mon, 24 Jul 2023 18:06:34 +0000 Subject: [PATCH 01/13] docs: adds intro and installatn guide part Signed-off-by: Afzal Ansari --- docs/installation.md | 18 ++++++++++++++++++ docs/intro.md | 9 +++++++++ 2 files changed, 27 insertions(+) create mode 100644 docs/installation.md create mode 100644 docs/intro.md diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 000000000..94d6f82ee --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,18 @@ +--- +title: 'Installation guide' +weight: 30 +--- + +## Glee Installation + +Before installing Glee framework into your project, make sure you have pre-installed AsyncAPI CLI tool under the hood. + +The best way to get started with Glee is by using AsyncAPI CLI, which sets up everything automatically for you. +To create a project, run: +```sh +asyncapi new glee +``` + + +For more information on how to install AsynAPI CLI, you can review CLI installation documentation. + \ No newline at end of file diff --git a/docs/intro.md b/docs/intro.md new file mode 100644 index 000000000..4d38766e0 --- /dev/null +++ b/docs/intro.md @@ -0,0 +1,9 @@ +--- +title: 'Introduction' +weight: 20 +--- + +[Glee][https://github.com/asyncapi/glee) is a spec-first framework that helps you build server-side applications. It leverages the AsyncAPI specification to make you more productive: + +- It makes sure your code and AsyncAPI definition are on par, eliminating the problem of outdated documentation. Glee takes care of this automatically for you. +- Glee lets you focus on what matters and handles the rest for you. You only write the code for your business use-case. Glee takes care of performance, scalability, resilience, and everything you need to make your application production-ready. \ No newline at end of file From 61331b118d4288c7020cfc0c57d3af7dd142af2b Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Wed, 26 Jul 2023 14:10:35 +0000 Subject: [PATCH 02/13] updates minor typos Signed-off-by: Afzal Ansari --- docs/installation.md | 18 ------------------ docs/pages/installation.md | 16 ++++++++++++++++ docs/{ => pages}/intro.md | 4 ++-- 3 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 docs/installation.md create mode 100644 docs/pages/installation.md rename docs/{ => pages}/intro.md (64%) diff --git a/docs/installation.md b/docs/installation.md deleted file mode 100644 index 94d6f82ee..000000000 --- a/docs/installation.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: 'Installation guide' -weight: 30 ---- - -## Glee Installation - -Before installing Glee framework into your project, make sure you have pre-installed AsyncAPI CLI tool under the hood. - -The best way to get started with Glee is by using AsyncAPI CLI, which sets up everything automatically for you. -To create a project, run: -```sh -asyncapi new glee -``` - - -For more information on how to install AsynAPI CLI, you can review CLI installation documentation. - \ No newline at end of file diff --git a/docs/pages/installation.md b/docs/pages/installation.md new file mode 100644 index 000000000..9880610b7 --- /dev/null +++ b/docs/pages/installation.md @@ -0,0 +1,16 @@ +--- +title: 'Installation guide' +weight: 30 +--- + +## Glee Installation + +Before installing Glee into your project, make sure you have pre-installed [AsyncAPI CLI](https://github.com/asyncapi/cli) tool. + +The best way to get started with Glee is by using AsyncAPI CLI, which sets up everything automatically for you. +To create a project, run: +```sh +asyncapi new glee +``` + +> For more information on how to install the AsynAPI CLI, you can review the [CLI installation guide](https://www.asyncapi.com/docs/tools/cli/installation). \ No newline at end of file diff --git a/docs/intro.md b/docs/pages/intro.md similarity index 64% rename from docs/intro.md rename to docs/pages/intro.md index 4d38766e0..281444c0e 100644 --- a/docs/intro.md +++ b/docs/pages/intro.md @@ -3,7 +3,7 @@ title: 'Introduction' weight: 20 --- -[Glee][https://github.com/asyncapi/glee) is a spec-first framework that helps you build server-side applications. It leverages the AsyncAPI specification to make you more productive: +[Glee](https://github.com/asyncapi/glee) is a spec-first framework that helps you build server-side applications. It leverages the AsyncAPI specification to make you more productive: -- It makes sure your code and AsyncAPI definition are on par, eliminating the problem of outdated documentation. Glee takes care of this automatically for you. +- Glee ensures your code and AsyncAPI definition are on par, eliminating the problem of outdated documentation. Glee takes care of this automatically for you. - Glee lets you focus on what matters and handles the rest for you. You only write the code for your business use-case. Glee takes care of performance, scalability, resilience, and everything you need to make your application production-ready. \ No newline at end of file From 1a49d8a09ac077fa5a9ddabee19ef778f81940d2 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Wed, 26 Jul 2023 14:28:34 +0000 Subject: [PATCH 03/13] adds usage Signed-off-by: Afzal Ansari --- docs/pages/usage.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docs/pages/usage.md diff --git a/docs/pages/usage.md b/docs/pages/usage.md new file mode 100644 index 000000000..7dbb260e4 --- /dev/null +++ b/docs/pages/usage.md @@ -0,0 +1,9 @@ +Glee as a spec-driven framework, makes it easier to work with applications in Generating documentation. + +While working with the CLI, it's always necessary to have docs and code always in sync. Glee will automatically generate documentation for your application or you can also generate your documentation yourself by running: + +``` +glee docs +``` + + \ No newline at end of file From e4192b00f6297dd9b3c154575ea7863b293f0365 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Wed, 26 Jul 2023 14:58:53 +0000 Subject: [PATCH 04/13] modifies the header Signed-off-by: Afzal Ansari --- docs/pages/usage.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/pages/usage.md b/docs/pages/usage.md index 7dbb260e4..832a9b4d4 100644 --- a/docs/pages/usage.md +++ b/docs/pages/usage.md @@ -1,3 +1,8 @@ +--- +title: 'Usage' +weight: 20 +--- + Glee as a spec-driven framework, makes it easier to work with applications in Generating documentation. While working with the CLI, it's always necessary to have docs and code always in sync. Glee will automatically generate documentation for your application or you can also generate your documentation yourself by running: From 020f4d698dcd99a340dbf3d3d3cf49ac6a25e676 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Mon, 31 Jul 2023 11:15:02 +0000 Subject: [PATCH 05/13] adds extra info to installation guide Signed-off-by: Afzal Ansari --- docs/pages/installation.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/pages/installation.md b/docs/pages/installation.md index 9880610b7..70b1f523c 100644 --- a/docs/pages/installation.md +++ b/docs/pages/installation.md @@ -9,8 +9,34 @@ Before installing Glee into your project, make sure you have pre-installed [Asyn The best way to get started with Glee is by using AsyncAPI CLI, which sets up everything automatically for you. To create a project, run: + ```sh asyncapi new glee ``` -> For more information on how to install the AsynAPI CLI, you can review the [CLI installation guide](https://www.asyncapi.com/docs/tools/cli/installation). \ No newline at end of file +> For more information on how to install the AsynAPI CLI, you can review the [CLI installation guide](https://www.asyncapi.com/docs/tools/cli/installation). + +On installation, you'll find next steps after your project created: + +``` +Your project "project" has been created successfully! + +Next steps: + + cd project + npm install + npm run dev + +Also, you can already open the project in your favorite editor and start tweaking it +``` + +On following the next steps, you'll be able to view your application running, +essentiaaly when you run the development server `npm run dev`: + +``` +> glee-hello-world@0.1.0 dev +> glee dev + + TS Compiling TypeScript sources... + +``` From c42a11ff6cd68e29642368efd5a5553391105498 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Tue, 1 Aug 2023 14:13:04 +0000 Subject: [PATCH 06/13] adds glee feature points and its diagram way Signed-off-by: Afzal Ansari --- docs/pages/intro.md | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/pages/intro.md b/docs/pages/intro.md index 281444c0e..e6647bcf3 100644 --- a/docs/pages/intro.md +++ b/docs/pages/intro.md @@ -3,7 +3,29 @@ title: 'Introduction' weight: 20 --- -[Glee](https://github.com/asyncapi/glee) is a spec-first framework that helps you build server-side applications. It leverages the AsyncAPI specification to make you more productive: +[Glee](https://github.com/asyncapi/glee) is a spec-first framework that helps you build server-side applications. That means it operates on the principle of defining the API specification (AsyncAPI) before diving into the actual implementation of the application logic. It leverages that principle to make you more productive: -- Glee ensures your code and AsyncAPI definition are on par, eliminating the problem of outdated documentation. Glee takes care of this automatically for you. -- Glee lets you focus on what matters and handles the rest for you. You only write the code for your business use-case. Glee takes care of performance, scalability, resilience, and everything you need to make your application production-ready. \ No newline at end of file +- Glee ensures your code and AsyncAPI definition are on par, eliminating the problem of outdated documentation. By having both the code and the AsyncAPI definition in sync, you can ensure that the API documentation is always up to date, accurate, and reflects the current state of the application. Glee takes care of this automatically for you. +- Glee lets you focus on what matters and handles the rest for you. You only write the code for your business use-case. Glee takes care of performance, scalability, resilience, and everything you need to make your application production-ready. +- Glee validates the schema of the payload that it receives, if it doesn't conform to the schema that is defined in the AsyncAPI document, it throw an error telling user that the server received an invalid payload. + +To summarize, the Glee offers the following features and process flow, as shown in the diagram below: + +```mermaid +graph TD; +A[AsyncAPI Glee CLI] +B[Creation] +H[Generation] +I[Optimization] +D[Validation] +F[Apps/Docs] +K[Bundling] +E[Conversion] +A-->B; +A-->D; +A-->H +H-->F +A-->I; +A-->E; +A-->K; +``` From 61f2f6d78106942e01117cae853be9cc2e532122 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Thu, 31 Aug 2023 15:00:39 +0530 Subject: [PATCH 07/13] minor gm correction --- docs/pages/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/installation.md b/docs/pages/installation.md index 70b1f523c..dc8d5688e 100644 --- a/docs/pages/installation.md +++ b/docs/pages/installation.md @@ -31,7 +31,7 @@ Also, you can already open the project in your favorite editor and start tweakin ``` On following the next steps, you'll be able to view your application running, -essentiaaly when you run the development server `npm run dev`: +essentially when you run the development server `npm run dev`: ``` > glee-hello-world@0.1.0 dev From b3be4b6f4a4fd7ec07ad05a0148fbe0c63be5573 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Mon, 11 Sep 2023 00:16:38 +0530 Subject: [PATCH 08/13] subjugates the commits --- docs/pages/installation.md | 13 ++----------- docs/pages/intro.md | 20 +------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/docs/pages/installation.md b/docs/pages/installation.md index dc8d5688e..48215120b 100644 --- a/docs/pages/installation.md +++ b/docs/pages/installation.md @@ -5,7 +5,7 @@ weight: 30 ## Glee Installation -Before installing Glee into your project, make sure you have pre-installed [AsyncAPI CLI](https://github.com/asyncapi/cli) tool. +Before installing Glee into your project, make sure you have pre-installed NPM, NodeJs and [AsyncAPI CLI](https://github.com/asyncapi/cli) tools on your system. The best way to get started with Glee is by using AsyncAPI CLI, which sets up everything automatically for you. To create a project, run: @@ -30,13 +30,4 @@ Next steps: Also, you can already open the project in your favorite editor and start tweaking it ``` -On following the next steps, you'll be able to view your application running, -essentially when you run the development server `npm run dev`: - -``` -> glee-hello-world@0.1.0 dev -> glee dev - - TS Compiling TypeScript sources... - -``` +While making twist to your application, you can follow along with our getting started guide on the relevant page. diff --git a/docs/pages/intro.md b/docs/pages/intro.md index e6647bcf3..0033fcbab 100644 --- a/docs/pages/intro.md +++ b/docs/pages/intro.md @@ -10,22 +10,4 @@ weight: 20 - Glee validates the schema of the payload that it receives, if it doesn't conform to the schema that is defined in the AsyncAPI document, it throw an error telling user that the server received an invalid payload. To summarize, the Glee offers the following features and process flow, as shown in the diagram below: - -```mermaid -graph TD; -A[AsyncAPI Glee CLI] -B[Creation] -H[Generation] -I[Optimization] -D[Validation] -F[Apps/Docs] -K[Bundling] -E[Conversion] -A-->B; -A-->D; -A-->H -H-->F -A-->I; -A-->E; -A-->K; -``` + From 7097af07ccca3a002defda3fce39766c77b708fa Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Mon, 11 Sep 2023 23:51:17 +0530 Subject: [PATCH 09/13] rmvs intro part --- docs/pages/intro.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 docs/pages/intro.md diff --git a/docs/pages/intro.md b/docs/pages/intro.md deleted file mode 100644 index 0033fcbab..000000000 --- a/docs/pages/intro.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 'Introduction' -weight: 20 ---- - -[Glee](https://github.com/asyncapi/glee) is a spec-first framework that helps you build server-side applications. That means it operates on the principle of defining the API specification (AsyncAPI) before diving into the actual implementation of the application logic. It leverages that principle to make you more productive: - -- Glee ensures your code and AsyncAPI definition are on par, eliminating the problem of outdated documentation. By having both the code and the AsyncAPI definition in sync, you can ensure that the API documentation is always up to date, accurate, and reflects the current state of the application. Glee takes care of this automatically for you. -- Glee lets you focus on what matters and handles the rest for you. You only write the code for your business use-case. Glee takes care of performance, scalability, resilience, and everything you need to make your application production-ready. -- Glee validates the schema of the payload that it receives, if it doesn't conform to the schema that is defined in the AsyncAPI document, it throw an error telling user that the server received an invalid payload. - -To summarize, the Glee offers the following features and process flow, as shown in the diagram below: - From 4c0eef67fb034220ba46087758507675e48ce0cf Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Mon, 18 Sep 2023 09:44:14 +0000 Subject: [PATCH 10/13] updtes guide for usage --- docs/pages/installation.md | 2 +- docs/pages/usage.md | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/pages/installation.md b/docs/pages/installation.md index 48215120b..ffc9afba2 100644 --- a/docs/pages/installation.md +++ b/docs/pages/installation.md @@ -30,4 +30,4 @@ Next steps: Also, you can already open the project in your favorite editor and start tweaking it ``` -While making twist to your application, you can follow along with our getting started guide on the relevant page. +While making twists to your application, you can follow along with our getting started guide on the relevant page. diff --git a/docs/pages/usage.md b/docs/pages/usage.md index 832a9b4d4..8dc6593ff 100644 --- a/docs/pages/usage.md +++ b/docs/pages/usage.md @@ -3,7 +3,20 @@ title: 'Usage' weight: 20 --- -Glee as a spec-driven framework, makes it easier to work with applications in Generating documentation. +Glee as a spec-driven framework, makes it easier to work with applications in generating documentation and running the development server. + +Following the below json config from `package.json`, let's understand the usage of glee defined under `scripts` object. + +```js +{ + "scripts": { + "docs": "glee docs", + "dev": "glee dev", + "start": "glee start", + } +} +``` +These scripts refer to the different stages of developing an application. While working with the CLI, it's always necessary to have docs and code always in sync. Glee will automatically generate documentation for your application or you can also generate your documentation yourself by running: From 0a78b2829a4c274a25b34315bd09009854f71d46 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Mon, 18 Sep 2023 17:57:17 +0000 Subject: [PATCH 11/13] extends the script desc --- docs/pages/usage.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/pages/usage.md b/docs/pages/usage.md index 8dc6593ff..91756e0bd 100644 --- a/docs/pages/usage.md +++ b/docs/pages/usage.md @@ -5,7 +5,7 @@ weight: 20 Glee as a spec-driven framework, makes it easier to work with applications in generating documentation and running the development server. -Following the below json config from `package.json`, let's understand the usage of glee defined under `scripts` object. +By following the below json config from `package.json`, let's understand the usage of glee defined under `scripts` object. ```js { @@ -18,10 +18,10 @@ Following the below json config from `package.json`, let's understand the usage ``` These scripts refer to the different stages of developing an application. -While working with the CLI, it's always necessary to have docs and code always in sync. Glee will automatically generate documentation for your application or you can also generate your documentation yourself by running: +`glee docs`: This script generates documentation for your project using the "Glee" documentation tool. This documentation includes information about your project's APIs, modules, and usage instructions. -``` -glee docs -``` +`glee dev`: This script is used for starting a development server. It launches a local development server, build your project in development mode, or perform other development-related tasks. + +`glee start`: This script is responsible for starting your project or application. It is used to launch a production-ready server or application instance. - \ No newline at end of file +To get more familiar with these scripts on how they are configured, next dive into our getting started guide. \ No newline at end of file From 1017fe51fcb5eb3fbf738518fb201304d90c18c8 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Tue, 19 Sep 2023 17:52:03 +0000 Subject: [PATCH 12/13] adds the manual installation --- docs/pages/installation.md | 86 ++++++++++++++++++++++++++++++++++++++ docs/pages/usage.md | 27 ------------ 2 files changed, 86 insertions(+), 27 deletions(-) delete mode 100644 docs/pages/usage.md diff --git a/docs/pages/installation.md b/docs/pages/installation.md index ffc9afba2..5b11505e8 100644 --- a/docs/pages/installation.md +++ b/docs/pages/installation.md @@ -7,6 +7,8 @@ weight: 30 Before installing Glee into your project, make sure you have pre-installed NPM, NodeJs and [AsyncAPI CLI](https://github.com/asyncapi/cli) tools on your system. +### Automatic Installation + The best way to get started with Glee is by using AsyncAPI CLI, which sets up everything automatically for you. To create a project, run: @@ -31,3 +33,87 @@ Also, you can already open the project in your favorite editor and start tweakin ``` While making twists to your application, you can follow along with our getting started guide on the relevant page. + +### Manual Installation + +To manually create a new app, create a folder e.g. `myapp` and install the required packages: + +```js +npm init -y +npm install @asyncapi/glee +``` + +Open your package.json file and add the following scripts: + +```js +{ + "scripts": { + "docs": "glee docs", + "dev": "glee dev", + "start": "glee start", + } +} +``` + +These scripts refer to the different stages of developing an application. + +- `glee docs`: This script generates documentation for your project using the "Glee" documentation tool. This documentation includes information about your project's APIs, modules, and usage instructions. + +- `glee dev`: This script is used for starting a development server. It launches a local development server, build your project in development mode, or perform other development-related tasks. + +- `glee start`: This script is responsible for starting your project or application. It is used to launch a production-ready server or application instance. + +#### Creating `asyncapi.yaml` file and other required directories + +Create a yaml file that supports capable of receiving a "hello {name}" message with the protocol as `ws` and the channel name as `hello` the hello API will subscribe to. The operationId property is `onHello` that's the name of function and the payload property is type string publishing to that channel. + +```yaml +asyncapi: 2.6.0 +info: + title: Hello, Glee! + version: 0.1.0 + +servers: + websockets: + url: ws://0.0.0.0:3000 + protocol: ws + +channels: + hello: + publish: + operationId: onHello + message: + $ref: '#/components/messages/hello' + subscribe: + message: + $ref: '#/components/messages/hello' + +components: + messages: + hello: + payload: + type: string +``` + +Create an operation function `onHello.js` inside `myapp/functions`: + +```js +export default async function (event) { + return { + reply: [{ + payload: `Hello from Glee! You said: "${event.payload}".` + }] + } +} + +``` +Finally, create a `.env` file specifying a server name: + +``` +GLEE_SERVER_NAMES=websockets +``` + +#### Run the Development Server + +- Run `npm run dev` to start the development server. +- Connect to `ws://localhost:3000/hello` and send a WebSocket request with a payload e.g. {"john"} diff --git a/docs/pages/usage.md b/docs/pages/usage.md deleted file mode 100644 index 91756e0bd..000000000 --- a/docs/pages/usage.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: 'Usage' -weight: 20 ---- - -Glee as a spec-driven framework, makes it easier to work with applications in generating documentation and running the development server. - -By following the below json config from `package.json`, let's understand the usage of glee defined under `scripts` object. - -```js -{ - "scripts": { - "docs": "glee docs", - "dev": "glee dev", - "start": "glee start", - } -} -``` -These scripts refer to the different stages of developing an application. - -`glee docs`: This script generates documentation for your project using the "Glee" documentation tool. This documentation includes information about your project's APIs, modules, and usage instructions. - -`glee dev`: This script is used for starting a development server. It launches a local development server, build your project in development mode, or perform other development-related tasks. - -`glee start`: This script is responsible for starting your project or application. It is used to launch a production-ready server or application instance. - -To get more familiar with these scripts on how they are configured, next dive into our getting started guide. \ No newline at end of file From 48a860123715710cd24cf68d9f862f6f98f21514 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Wed, 20 Sep 2023 16:17:11 +0000 Subject: [PATCH 13/13] adds the folder structure --- docs/pages/installation.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/pages/installation.md b/docs/pages/installation.md index 5b11505e8..cc7e724be 100644 --- a/docs/pages/installation.md +++ b/docs/pages/installation.md @@ -36,7 +36,22 @@ While making twists to your application, you can follow along with our getting s ### Manual Installation -To manually create a new app, create a folder e.g. `myapp` and install the required packages: +To manually create a new app, create a new folder e.g. `myapp` so the folder structure would look like below; + +``` +├─ functions (required) +│ ├─ onHello.js +│ └─ ... +├─ lifecycle (optional) +│ ├─ onConnect.js +│ └─ ... +├─ .env (optional) +├─ asyncapi.(yaml | yml | json) (required) +├─ glee.config.js (optional) +├─ package.json (required) +``` + +Install the required packages inside a new folder: ```js npm init -y @@ -106,13 +121,6 @@ export default async function (event) { } } -``` -Finally, create a `.env` file specifying a server name: - -``` -GLEE_SERVER_NAMES=websockets -``` - #### Run the Development Server - Run `npm run dev` to start the development server.