From 4e7c1e6e9f02e3fe317c2c0d3467cdd3a220667d Mon Sep 17 00:00:00 2001 From: dswbx Date: Wed, 20 Nov 2024 10:20:10 +0100 Subject: [PATCH] docs: added cli instructions --- docs/cli.mdx | 66 +++++++++++++++++++++++++++++++++++++++++++ docs/introduction.mdx | 1 + docs/mint.json | 2 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 docs/cli.mdx diff --git a/docs/cli.mdx b/docs/cli.mdx new file mode 100644 index 0000000..7106774 --- /dev/null +++ b/docs/cli.mdx @@ -0,0 +1,66 @@ +--- +title: 'Using the CLI' +description: 'How to start a bknd instance using the CLI.' +--- + +Instead of running **bknd** using a framework, you can also use the CLI to quickly spin up a +full functional instance. To see all available options, run: + +``` +npx bknd +``` + +Here is the output: +``` +$ npx bknd +Usage: bknd [options] [command] + +bknd cli + +Options: + -V, --version output the version number + -h, --help display help for command + +Commands: + user create and update user (auth) + schema [options] get schema + run [options] + config [options] get default config + help [command] display help for command +``` + +## Starting an instance (`run`) +To see all available `run` options, execute `npx bknd run --help`. + +``` +$ npx bknd run --help +Usage: bknd run [options] + +Options: + -p, --port port to run on (default: 1337, env: PORT) + -c, --config config file + --db-url database url, can be any valid libsql url + --db-token database token + --server server type (choices: "node", "bun", default: "node") + -h, --help display help for command +``` + +### In-memory database +To start an instance with an ephemeral in-memory database, run the following: +``` +npx bknd run +``` +Keep in mind that the database is not persisted and will be lost when the process is terminated. + +### File-based database +To start an instance with a file-based database, run the following: +``` +npx bknd run --db-url file:data.db +``` + +### Turso/LibSQL database +To start an instance with a Turso/LibSQL database, run the following: +``` +npx bknd run --db-url libsql://your-db.turso.io --db-token +``` +The `--db-token` option is optional and only required if the database is protected. \ No newline at end of file diff --git a/docs/introduction.mdx b/docs/introduction.mdx index 7b059d2..38c4e63 100644 --- a/docs/introduction.mdx +++ b/docs/introduction.mdx @@ -20,6 +20,7 @@ Enter the following command to spin up an instance: bunx bknd run ``` +To learn more about the CLI, check out the [Using the CLI](/cli) guide. ## Start with a Framework/Runtime diff --git a/docs/mint.json b/docs/mint.json index b9f94b3..2c86a32 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -72,7 +72,7 @@ "navigation": [ { "group": "Getting Started", - "pages": ["introduction", "setup", "sdk"] + "pages": ["introduction", "setup", "sdk", "cli"] }, { "group": "Modules",