Quick Start
Installation
Once you've installed Rust, install the CLI with:
cargo install saas-rs-cli
Login
To begin using the CLI, you first need to login to the SaaS RS API service running at https://api.saas-rs.com.
The login
command is used like this:
$ saas-rs login
Logged in. Greetings David Rauschenbach!
If you have a favorite browser, you can login like this:
$ saas-rs login --browser chrome
After a successful login, a 24-hour session token gets cached in a config file, and is used to authorize subsequent CLI operations. This config file is located here:
~/.saas-rs/config
(Unix)%APPDATA%\saas-rs\config
(Windows)
Initialize your Git Repo
A SaaS RS Managed Rust Workspace must first be initialized with the init
command. It establishes the requisite
workspace layout, and defines your brand which will be used to namespace your gRPC protocols.
Use the init
command to initialize your empty Git repo:
saas-rs init --brand acme
The following Rust workspace is laid out for you:
crates/
├── common/
├── config_store/
├── object_store/
└── session_store/
.rustfmt.toml
.saas-rs.toml
CHANGELOG.md
Cargo.lock
Cargo.toml
Makefile
README.md
After running the init
command, you'll notice that the CLI will indicate that your git workspace is now dirty, and
that this would be a good time to run make
and to then commit the generated changes before modifying anything.
$ saas-rs init --brand acme
Response received
Patch applied to local workspace
Workspace is dirty; now would be a good time to run `make` and then commit
$ make
cargo fmt --all
cargo build
Updating crates.io index
Locking 301 packages to latest compatible versions
Adding matchit v0.8.4 (available: v0.8.6)
Adding prost v0.13.5 (available: v0.14.1)
Compiling common v0.1.0 (/Users/davidr/workspaces/foo/crates/common)
Compiling config-store v0.1.0 (/Users/davidr/workspaces/foo/crates/config_store)
Compiling object-store v0.1.0 (/Users/davidr/workspaces/foo/crates/object_store)
Compiling session-store v0.1.0 (/Users/davidr/workspaces/foo/crates/session_store)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.73s
$ git add -A
$ git commit -m "saas-rs init --brand acme"
Enable MongoDB Support
Your SaaS RS Managed Workspace supports 3 storage adapters:
- the ConfigStore is your primary store that holds Account records and all your other business domain managed objects
- the ObjectStore can store files and large blobs, if you need that
- the SessionStore holds temporary things like login sessions or shopping carts, and frequently accessed things like API keys
To configure your workspace to support MongoDB, perform:
$ saas-rs enable storage-provider MongoDB
You will notice the following files have been changed in your workspace:
crates/
├── config_store/
│ ├── src/
│ │ ├── factory.rs
├── object_store/
│ ├── src/
│ │ ├── factory.rs
Cargo.toml
MongoDB support includes ConfigStore
and ObjectStore
adapters, that can be configured like this:
CONFIG_STORE_URL=mongodb://myhost:27017/saas-rs-prod
OBJECT_STORE_URL=mongodb://myhost:27017/saas-rs-objects-prod
Perform make
and then stage and commit the generated files before you make any further changes:
$ make
cargo fmt --all
cargo build
Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.73s
$ git add -A
$ git commit -m "saas-rs use-storage-provider MongoDB"