Commands
Did you ever play Command & Conquer? No? Continue, comrade... and you will find yourself on the floor, with Kukov! ☭
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.

Synopsis

To get a list of all commands, call cs help:
1
cs help
Copied!

Basic usage

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.

Authentication

1
$ cs help auth
2
Authentication commands, login, logout, whoami
3
4
USAGE
5
$ codestore auth:COMMAND
6
7
COMMANDS
8
auth:login Authenticate at code.store platform
9
auth:logout Clears user credentials and invalidates local session
10
auth:whoami Display the currently logged in user
Copied!
To be able to use the CLI you have to login into your code.store account. To do that use the following command:
1
cs auth:login
Copied!
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:
1
cs auth:whoami
Copied!
In order to finish your session and logout use the following command:
1
cs auth:logout
Copied!
You can also use short aliases of the above commands: cs login, cs whoami and cs logout.

Services

1
$ cs service help
2
Manage your services
3
4
USAGE
5
$ codestore service:COMMAND
6
7
COMMANDS
8
service:create Create new service
9
service:dev Launch your service locally
10
service:info Displays detailed information about a service
11
service:list List services in your organization
12
service:logs Print the logs for your services
13
service:promote Promotes service from private env to demo
14
service:pull Download an existing service
15
service:push Push local changes to Private environment
16
service:remove Remove a service
Copied!

List

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.
1
$ cs service:list # or cs service:ls
2
Service ID Name Status
3
amazing-service-1 Amazing service #1 ACTIVE
4
amazing-service-2 Amazing service #2 ACTIVE
Copied!

Create

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.
1
$ cs service:create
Copied!

Info

Displays more detailed information about the service:
1
$ cs service:info
2
Private Demo
3
version 0.0.3 0.0.2
4
deployed 8/31/2020, 10:01:44 PM 8/31/2020, 2:48:30 PM
5
url ... ...
Copied!

Delete

Deletes the service. Deletes it for real, so please make sure that you are sure about what you are doing.
1
$ cs service:delete
Copied!

Dev

Launches a service locally. Requires PostgreSQL and configuration in codestore.yaml.
1
$ cs service:dev # or cs dev
Copied!

Generate

This command has been moved to cs generate:models

List

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.
1
$ cs service:list
Copied!

Logs

Print out the logs of your service. Available options are:
1
$ cs service:logs --help
2
Print the logs for your services
3
4
USAGE
5
$ codestore service:logs
6
7
OPTIONS
8
-e, --env=(private|demo|development|staging|production) [default: development] Project environment.
9
-f, --follow Specify if the logs should be streamed.
10
-n, --num=num [default: 20] Number of most recent log lines to display.
11
-p, --projectId=projectId Project ID
12
-s, --serviceId=serviceId Service ID
13
14
ALIASES
15
$ codestore logs
Copied!

Promote

Pushes your service from Private to Demo environment.
1
$ cs service:promote [ID] --help
2
Promotes service from private env to demo
3
4
USAGE
5
$ codestore service:promote [SERVICEID]
6
7
ARGUMENTS
8
SERVICEID An (optional) Service ID
Copied!
When launched without the optional Service ID argument, the command will look for codestore.yaml file and will promote the current service.

Pull

Downloads a service to the current directory.
1
$ cs service:pull --help
2
Download an existing service
3
4
USAGE
5
$ codestore service:pull [SERVICEID]
6
7
ARGUMENTS
8
SERVICEID An (optional) Service ID
9
10
ALIASES
11
$ codestore pull
Copied!
hen launched without the optional Service ID argument, the command will look for codestore.yaml file and will promote the current service.

Push

Push local changes to Private environment.
1
$ cs service:push --help
2
Push local changes to Private environment
3
4
USAGE
5
$ codestore service:push
6
7
ALIASES
8
$ codestore push
Copied!

Projects

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.
1
$ cs project --help
2
🚧 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 billing
3
4
USAGE
5
$ codestore project:COMMAND
6
7
COMMANDS
8
project:create Creates a new project, where you can add services
9
project:delete Removes project (only if there are no more services inside)
10
project:list List projects in your organization
11
project:service Adds and existing service to your project
Copied!

Create

Launches a project creation dialogue:
1
$ cs project:create
2
? What is your project's name? Test project
3
? Please add a short description of your project (255 chars max): Project description
4
? Is everything ok, can I create this project? Yes
5
⠹ Creating Project Test project
Copied!

Delete

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.
1
$ cs service:delete --help
2
Removes the project (only if there are no more services inside)
3
4
USAGE
5
$ codestore project:delete [PROJECTID]
6
7
ARGUMENTS
8
PROJECTID ID of the Project that should be removed
Copied!

List

Get a list of all your projects (you can also use a shorthand alias cs project:ls:
1
cs project:list
Copied!

Services inside the Project

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.
1
$ cs project:service --help
2
Manage services inside your project
3
4
USAGE
5
$ codestore project:service:COMMAND
6
7
COMMANDS
8
project:service:add Adds and existing service to your project
9
project:service:info Displays detailed information about project's service
10
project:service:list Lists services in your project
11
project:service:promote Promotes service inside the project between Development, Stating and Production environments
12
project:service:remove Exclude service from project. This is a potentially destructive operation that might result in a loss of data.
Copied!

Add

Adds an existing service to a project. Requires a Project ID as an argument.
1
$ cs project:service:add --help
2
Adds and existing service to your project
3
4
USAGE
5
$ codestore project:service:add [SERVICEID]
6
7
ARGUMENTS
8
SERVICEID Id of the service
9
10
OPTIONS
11
--project-id=project-id (required) Id of the project
Copied!

List

Lists services in your project:
1
$ cs project:service:list --help
2
Lists services in your project
3
4
USAGE
5
$ codestore project:service:list PROJECTID
6
7
ARGUMENTS
8
PROJECTID (required) Project ID
9
10
ALIASES
11
$ codestore project:service:ls
Copied!

Info

Displays detailed information about project's service, in a similar way to cs service:info.
1
cs project:service:info {PROJECT} {SERVICE}
Copied!

Promote

Promotes your service inside the project between Development, Staging and Production environments.
1
$ cs project:service:promote --help
2
Promotes service inside the project between Development, Stating and Production environments
3
4
USAGE
5
$ codestore project:service:promote [SERVICEID]
6
7
ARGUMENTS
8
SERVICEID ID of the service
9
10
OPTIONS
11
--project-id=project-id (required) ID of the project
Copied!

Remove

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.
1
$ cs project:service:remove --help
2
Exclude service from project. This is a potentially destructive operation that might result in a loss of data.
3
4
USAGE
5
$ codestore project:service:remove [SERVICEID]
6
7
ARGUMENTS
8
SERVICEID ID of the service
9
10
OPTIONS
11
--project-id=project-id (required) ID of the project
Copied!

Generate

This group of commands generate scaffolding (templates) of some important files.
1
$ cs generate
2
Generates scaffolding (templates) of some important files
3
4
USAGE
5
$ codestore generate:COMMAND
6
7
COMMANDS
8
generate:handler Generates auth.handler or context.handler
9
generate:models Generates database entities and migrations
10
generate:resolver Generates a GraphQL resolver
11
generate:rest Generates a REST API handler
Copied!

Handler

Generates auth and context handlers.
1
$ cs generate:handler --help
2
Generates auth.handler or context.handler
3
4
USAGE
5
$ codestore generate:handler
6
7
OPTIONS
8
-f, --force Force overwrite file if it already exists
9
-t, --handlerType=context|auth Handler type, can be one of: context, auth.
Copied!
Read more about the usage of those handlers in our dedicated tutorial here.

Models

Generates the entity models and database migrations for your GraphQL types and puts them into src/entities.
1
$ cs generate:models
Copied!
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

Resolver

Generate a template of a GraphQL resolver:
1
$ cs generate:resolver --help  12.18.3
2
Generates a GraphQL resolver
3
4
USAGE
5
$ codestore generate:resolver
6
7
OPTIONS
8
-f, --force Force overwrite file if it already exists
9
-n, --name=name Resolver name
10
-t, --resolverType=query|mutation Resolver type, one of: 'query' or 'mutation'
Copied!

REST

Generates a template of a REST API endpoint handler:
1
$ cs generate:rest --help  3s  12.18.3
2
Generates a REST API handler
3
4
USAGE
5
$ codestore generate:rest
6
7
OPTIONS
8
-f, --force Force overwrite file if it already exists
9
-m, --method=get|post|put|delete HTTP method, one of: get, post, put, delete
10
-n, --name=name REST endpoint name
Copied!