Godspeed CLI
CLI to create and manage Godspeed projects.
About
Godspeed CLI is the primary way to interact with your Godspeed project from the command line. It provides a bunch of useful functionalities during the project development lifecycle.
How to install
npm install -g @godspeedsystems/godspeed
or
yarn global add @godspeedsystems/godspeed
Once Godspeed CLI is installed, the godspeed
command can be called from command line. When called without arguments, it displays its help and command usage.
$ godspeed
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
Usage: Godspeed CLI [options] [command]
CLI tool for godspeed framework.
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
create [options] <projectName> create a new godspeed project.
serve run the development server in watch mode.
build build the godspeed project.
clean clean the previous build.
preview run the build in a hosted environment like production or development.
gen-crud-api scans your prisma datasources and generate
CRUD APIs events and workflows
plugin manage(add, remove, update) eventsource and
datasource plugins for godspeed.
prisma proxy to prisma commands with some add-on
commands to handle prisma datasources.
help [command] display help for command
Godspeed Commands
Create: To create a new project
The create
command creates project structure for your microservice. When called without arguments, it creates project structure with default examples.
$ godspeed create my-service
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
… waiting Cloning project template.
✔ success Cloning template successful.
… waiting Generating project with default examples.
… waiting Generating project files.
✔ success Successfully generated godspeed project files.
dependencies installed successfully!
Successfully created the project my-service.
Use `godspeed help` command for available commands.
Happy building microservices with Godspeed! 🚀🎉
Serve: To Run the service for local development
You can run your Godspeed project using godspeed serve
command. This will build and run your project in auto-watch mode.
godspeed serve
In order to run a full stack application with Godspeed service as your backend, you can use Lerna. Check the example of full stack application in gs-node-templates repository.
Build: Building the service for hosted deployment
You can build your Godspeed project using godspeed build
command. This will build your project and copy the contents in /dist
folder.
godspeed build
Preview: Running the service in hosted environment
You can run your Godspeed project using godspeed preview
command. This will require godspeed build
to be run prior because preview renders the project from the dist
folder.
godspeed preview
Help plugin: To get help in Plugin commands
Godspeed plugins are the way to extend the core Meta Framework. Currently we support adding eventsource and datasource as plugin.
$ godspeed help plugin
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
Usage: Godspeed CLI plugin [options] [command]
manage(add, remove, update) eventsource and datasource plugins for godspeed.
Options:
-h, --help display help for command
Commands:
add [pluginName] Add an eventsource/datasource plugin.
remove [pluginName] Remove an eventsource/datasource plugin.
update Update an eventsource/datasource plugin.
help [command] display help for command
For detailed documentation visit https://godspeed.systems
Plugin Add: To install godspeed plugin
The godspeed plugin add
command allows the user to select a plugin from the list of available plugins and add them to the project.
$ godspeed plugin add
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
? Please select godspeed plugin to install: (Press <space> to select, <Up and Down> to move rows)
┌──────┬────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
│ │ Name │ Description │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ❯◯ │ aws-as-datasource │ aws as datasource plugin for Godspeed Framework │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ excel-as-datasource │ excel as datasource plugin for Godspeed Framework │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ mailer-as-datasource │ mailer as datasource plugin for Godspeed Framework │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ kafka-as-datasource-as-eventsource │ kafka as datasource-as-eventsource plugin for Godspeed Framework │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ cron-as-eventsource │ Cron as eventsource plugin for Godspeed Framework │
└──────┴────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘
plugin remove
The godspeed plugin remove
command allows the user to select a plugin from the list of available plugins and remove them from the project.
$ godspeed plugin remove
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
? Please select godspeed plugin to uninstall: (Press <space> to select, <Up and Down> to move rows)
┌──────┬────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
│ │ Name │ Description │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ❯◯ │ express-as-http │ Godspeed event source plugin for express as http server │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ prisma-as-datastore │ Prisma as a datasource plugin for Godspeed Framework. │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ axios-as-datasource │ Axios as datasource plugin for Godspeed Framework │
└──────┴────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘
plugin update
The godspeed plugin update
command allows the user to select a plugin from the list of available plugins and update them.
$ godspeed plugin update
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
? Please select godspeed plugin to update: (Press <space> to select, <Up and Down> to move rows)
┌──────┬────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
│ │ Name │ Description │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ❯◯ │ express-as-http │ Godspeed event source plugin for express as http server │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ prisma-as-datastore │ Prisma as a datasource plugin for Godspeed Framework. │
├──────┼────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
│ ◯ │ axios-as-datasource │ Axios as datasource plugin for Godspeed Framework │
└──────┴────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘
Enabling and disabling Open Telemetry
CLI provides otel
command to enable/disable observability in Godspeed.
$ godspeed help otel
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
Usage: Godspeed CLI otel [options] [command]
enable/disable Observability in Godspeed.
Options:
-h, --help display help for command
Commands:
enable enable Observability in project.
disable disable Observability in project.
help [command] display help for command
For detailed documentation visit https://godspeed.systems
otel enable
The godspeed otel enable
command allows the user to enable observability in Godspeed to collect traces, metrics and logs.
$ godspeed otel enable
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
otel installed successfully!
Observability has been enabled
The above command performs these two functions:
A. Installs @godspeedsystems/tracing
package
This package includes auto-instrumentation of the following plugins to collect traces:
1. http and https requests.
2. Prisma datasource plugin.
B. Sets OTEL_ENABLED env variable to true
By setting OTEL_ENABLED
to true, the following actions are performed:
1. Traces: starts the auto-instrumentation of traces present in the @godspeedsystems/tracing
package.
2. Metrics: starts exposing application metrics at /metrics
endpoint of the service. Currently, the framework exposes HTTP and Prisma datasource metrics.
3. Logs: starts dumping the service logs in OTEL log format in console provided NODE_ENV is not equal to 'dev'
Follow this Github issue to know how auto-instrumentation can be enabled for the other custom eventsource and datasource plugins.
Follow this Github issue to know how prometheus based metrics can be exposed for the other custom eventsource and datasource plugins.
otel disable
The godspeed otel disable
command allows the user to disable observability in Godspeed.
$ godspeed otel disable
,_, ╔════════════════════════════════════╗
(o,o) ║ Welcome to Godspeed ║
({___}) ║ World's First Meta Framework ║
" " ╚════════════════════════════════════╝
otel uninstalled successfully!
Observability has been disabled in the project
The above command performs these two functions:
A. Uninstalls @godspeedsystems/tracing
package from your service.
B. Sets OTEL_ENABLED env variable to false
Setting OTEL_ENABLED
to false stops all the actions performed in otel enable command