To download and install CLI, follow the instructions here.
You can invoke code.store CLI either by using the full codestore
command, or by using the short version cs
.
To get a list of all commands, call cs help
:
cs help
Most of the commands accept some specific arguments which can be provided while invoking the command in a long or short format:
Long format: cs command --argumentName argumentValue
Short format: cs command -a argumentValue
Use cs help command
to know more about the specific command and its arguments.
$ cs help authAuthentication commands, login, logout, whoamiUSAGE$ codestore auth:COMMANDCOMMANDSauth:login Authenticate at code.store platformauth:logout Clears user credentials and invalidates local sessionauth:whoami Display the currently logged in user
To be able to use the CLI you have to login into your code.store account. To do that use the following command:
cs auth:login
cs login
will try to authenticate through the browser (it is going to open the default browser in your system).
At any time you can check under which user you are being authenticated:
cs auth:whoami
In order to finish your session and logout use the following command:
cs auth:logout
You can also use short aliases of the above commands: cs login
, cs whoami
and cs logout
.
$ cs service helpManage your servicesUSAGE$ codestore service:COMMANDCOMMANDSservice:create Create new serviceservice:dev Launch your service locallyservice:info Displays detailed information about a serviceservice:list List services in your organizationservice:logs Print the logs for your servicesservice:promote Promotes service from private env to demoservice:pull Download an existing serviceservice:push Push local changes to Private environmentservice:remove Remove a service
The cs service:list
command that can be shortened to cs service:ls
, and is used to provide a list of your services along with their status.
$ cs service:list # or cs service:lsService ID Name Statusamazing-service-1 Amazing service #1 ACTIVEamazing-service-2 Amazing service #2 ACTIVE
Create a new service by calling cs service:create
which will display a wizard and ask for some necessary information in order to create a service.
$ cs service:create
Displays more detailed information about the service:
$ cs service:infoPrivate Demoversion 0.0.3 0.0.2deployed 8/31/2020, 10:01:44 PM 8/31/2020, 2:48:30 PMurl ... ...
Deletes the service. Deletes it for real, so please make sure that you are sure about what you are doing.
$ cs service:delete
Launches a service locally. Requires PostgreSQL and configuration in codestore.yaml.
$ cs service:dev # or cs dev
This command has been moved to cs generate:models
List the services in your organization. You can also use a short version of this command: cs service:ls.
Note: don't be surprised to see some services when you just created an account as those may be the services created by the colleagues in your organization.
$ cs service:list
Print out the logs of your service. Available options are:
$ cs service:logs --helpPrint the logs for your servicesUSAGE$ codestore service:logsOPTIONS-e, --env=(private|demo|development|staging|production) [default: development] Project environment.-f, --follow Specify if the logs should be streamed.-n, --num=num [default: 20] Number of most recent log lines to display.-p, --projectId=projectId Project ID-s, --serviceId=serviceId Service IDALIASES$ codestore logs
Pushes your service from Private to Demo environment.
$ cs service:promote [ID] --helpPromotes service from private env to demoUSAGE$ codestore service:promote [SERVICEID]ARGUMENTSSERVICEID An (optional) Service ID
When launched without the optional Service ID argument, the command will look for codestore.yaml
file and will promote the current service.
Downloads a service to the current directory.
$ cs service:pull --helpDownload an existing serviceUSAGE$ codestore service:pull [SERVICEID]ARGUMENTSSERVICEID An (optional) Service IDALIASES$ codestore pull
hen launched without the optional Service ID argument, the command will look for codestore.yaml
file and will promote the current service.
Push local changes to Private environment.
$ cs service:push --helpPush local changes to Private environmentUSAGE$ codestore service:pushALIASES$ codestore push
In order for your Services to be published, they have to be added to Projects. Projects can be created and managed either by using the web-site or via CLI.
$ cs project --help🚧 A project is a particular app or website, where you can (re)use your existing services. It might be your e-commerce project or a logistics mobile application or business web-app. Each time you add a service to a project, we create a separate, isolated instance of your service. Each service reused in a project has its own environments, databases, logs, and billingUSAGE$ codestore project:COMMANDCOMMANDSproject:create Creates a new project, where you can add servicesproject:delete Removes project (only if there are no more services inside)project:list List projects in your organizationproject:service Adds and existing service to your project
Launches a project creation dialogue:
$ cs project:create? What is your project's name? Test project? Please add a short description of your project (255 chars max): Project description? Is everything ok, can I create this project? Yes⠹ Creating Project Test project
Deletes the project but only if there are no existing services inside it. Make sure that you remove all services from the project before removing the project itself.
$ cs service:delete --helpRemoves the project (only if there are no more services inside)USAGE$ codestore project:delete [PROJECTID]ARGUMENTSPROJECTID ID of the Project that should be removed
Get a list of all your projects (you can also use a shorthand alias cs project:ls
:
cs project:list
In order to manage services inside your project, you can use cs project:service
sub-commands. Most of the commands are quite similar to those of cs service
.
$ cs project:service --helpManage services inside your projectUSAGE$ codestore project:service:COMMANDCOMMANDSproject:service:add Adds and existing service to your projectproject:service:info Displays detailed information about project's serviceproject:service:list Lists services in your projectproject:service:promote Promotes service inside the project between Development, Stating and Production environmentsproject:service:remove Exclude service from project. This is a potentially destructive operation that might result in a loss of data.
Adds an existing service to a project. Requires a Project ID as an argument.
$ cs project:service:add --helpAdds and existing service to your projectUSAGE$ codestore project:service:add [SERVICEID]ARGUMENTSSERVICEID Id of the serviceOPTIONS--project-id=project-id (required) Id of the project
Lists services in your project:
$ cs project:service:list --helpLists services in your projectUSAGE$ codestore project:service:list PROJECTIDARGUMENTSPROJECTID (required) Project IDALIASES$ codestore project:service:ls
Displays detailed information about project's service, in a similar way to cs service:info
.
cs project:service:info {PROJECT} {SERVICE}
Promotes your service inside the project between Development, Staging and Production environments.
$ cs project:service:promote --helpPromotes service inside the project between Development, Stating and Production environmentsUSAGE$ codestore project:service:promote [SERVICEID]ARGUMENTSSERVICEID ID of the serviceOPTIONS--project-id=project-id (required) ID of the project
Removes the service from the project.
This is a destructive operation that might result in the loss of data! Please make sure that you definitely want to remove the service from the project.
$ cs project:service:remove --helpExclude service from project. This is a potentially destructive operation that might result in a loss of data.USAGE$ codestore project:service:remove [SERVICEID]ARGUMENTSSERVICEID ID of the serviceOPTIONS--project-id=project-id (required) ID of the project
This group of commands generate scaffolding (templates) of some important files.
$ cs generateGenerates scaffolding (templates) of some important filesUSAGE$ codestore generate:COMMANDCOMMANDSgenerate:handler Generates auth.handler or context.handlergenerate:models Generates database entities and migrationsgenerate:resolver Generates a GraphQL resolvergenerate:rest Generates a REST API handler
Generates auth
and context
handlers.
$ cs generate:handler --helpGenerates auth.handler or context.handlerUSAGE$ codestore generate:handlerOPTIONS-f, --force Force overwrite file if it already exists-t, --handlerType=context|auth Handler type, can be one of: context, auth.
Read more about the usage of those handlers in our dedicated tutorial here.
Generates the entity models and database migrations for your GraphQL types and puts them into src/entities
.
$ cs generate:models
Entity and database generation functionalities are still in alpha version. We are iterating fast to bring the best features as soon as possible. We would be happy to hear from you about what do you think about it in our community chat here: https://spectrum.chat/code-store
Generate a template of a GraphQL resolver:
$ cs generate:resolver --help 12.18.3Generates a GraphQL resolverUSAGE$ codestore generate:resolverOPTIONS-f, --force Force overwrite file if it already exists-n, --name=name Resolver name-t, --resolverType=query|mutation Resolver type, one of: 'query' or 'mutation'
Generates a template of a REST API endpoint handler:
$ cs generate:rest --help 3s 12.18.3Generates a REST API handlerUSAGE$ codestore generate:restOPTIONS-f, --force Force overwrite file if it already exists-m, --method=get|post|put|delete HTTP method, one of: get, post, put, delete-n, --name=name REST endpoint name