### Install Keyshade CLI with Bun Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/installing-the-cli.md Install the Keyshade CLI globally using Bun. ```shell bun i -g @keyshade/cli ``` -------------------------------- ### Install Keyshade CLI on Windows Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/installing-the-cli.md Use Scoop to add the Keyshade bucket and install the CLI. ```shell scoop bucket add keyshade https://github.com/keyshade-xyz/keyshade.git scoop install keyshade ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-web-app.md Installs all necessary dependencies for the project. Run this in the project root. ```sh pnpm i ``` -------------------------------- ### Install Keyshade CLI with pnpm Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/installing-the-cli.md Install the Keyshade CLI globally using pnpm. ```shell pnpm i -g @keyshade/cli ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/setting-things-up.md Install all project dependencies using pnpm. Ensure pnpm is installed globally first. ```bash pnpm install ``` -------------------------------- ### Test Keyshade CLI Profile Setup Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/installing-the-cli.md Verify your profile configuration by listing available workspaces. This command confirms successful authentication and setup. ```shell keyshade workspace list ``` -------------------------------- ### Add Gin Dependency to Go Project Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-go.md Install the Gin web framework dependency for your Go project. This is a prerequisite for the example HTTP server. ```bash go get github.com/gin-gonic/gin ``` -------------------------------- ### Run Next.js App with Keyshade CLI Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/running-your-app.md Example of running a Next.js application using the Keyshade CLI. This command starts the development server with injected environment variables. ```shell keyshade run -- npm run dev ``` -------------------------------- ### Start Web App Development Server (App Directory) Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-web-app.md Starts the web app development server by navigating into the 'apps/web' directory first. Use this if you prefer working within the app's specific directory. ```sh pnpm dev ``` -------------------------------- ### Install Keyshade CLI on MacOS Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/installing-the-cli.md Use Homebrew to tap the Keyshade repository and install the CLI. ```shell brew tap keyshade-xyz/keyshade https://github.com/keyshade-xyz/keyshade brew install keyshade ``` -------------------------------- ### Verify Keyshade CLI Installation Source: https://github.com/keyshade-xyz/keyshade/blob/develop/apps/cli/README.md Verify that the Keyshade CLI has been installed correctly by running the help command. This will display available commands and options. ```sh keyshade --help ``` -------------------------------- ### Install pnpm Globally with Sudo (Linux) Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/setting-things-up.md If the standard pnpm installation fails due to permissions on Linux, use sudo to install it globally. ```bash sudo npm install -g pnpm ``` -------------------------------- ### Verify Keyshade CLI Installation Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/installing-the-cli.md Run this command to check the installed version of the Keyshade CLI. ```sh keyshade --version ``` -------------------------------- ### Start API Service Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-cli.md Start the API service using Docker Compose and then run the development server for the API. ```bash docker compose up -d pnpm dev:api ``` -------------------------------- ### Copy Example .env File Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/setting-things-up.md Create the .env file by copying the .env.example. This file will store your environment variables. ```bash cp .env.example .env ``` -------------------------------- ### Start Web App Development Server (Project Root) Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-web-app.md Starts the web app development server from the project root directory. This command ensures all configurations are correctly applied. ```sh pnpm dev:web ``` -------------------------------- ### Start Platform App Development Server (Root) Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-platform.md Starts the Platform App development server from the project root. This command sets up the platform app for development. ```sh pnpm dev:platform ``` -------------------------------- ### Install Turbo Globally Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/setting-things-up.md Install Turbo, the monorepo management tool, globally. This is a final step in setting up the development environment. ```bash npm install turbo --global ``` -------------------------------- ### Install Keyshade CLI Source: https://github.com/keyshade-xyz/keyshade/blob/develop/apps/cli/README.md Install the Keyshade CLI globally using npm. This command makes the keyshade executable available on your system. ```sh npm install -g @keyshade/cli ``` -------------------------------- ### Run App with Keyshade CLI Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/running-your-app.md Use this command to run your application and have Keyshade inject environment variables. Replace '' with your actual application start command. ```shell keyshade run -- ``` -------------------------------- ### Initialize Keyshade Interactively Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/add-keyshade-to-your-project.md Run this command to start the interactive Keyshade initialization process. Follow the prompts to select your workspace, project, environment, and enter your private key. ```shell keyshade init ``` -------------------------------- ### Running Project in Development Mode Source: https://github.com/keyshade-xyz/keyshade/blob/develop/CONTRIBUTING.md Start the project in development mode to test your changes locally and confirm they work as expected. ```bash pnpm run dev ``` -------------------------------- ### Start All Docker Services Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/docker-support.md Quickly starts all Docker containers for the Web, API, and Platform services in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Get Project Details Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/project.md Use this command to fetch details of a specific project by providing its slug. ```bash keyshade project get [options] ``` -------------------------------- ### Node.js Express Server with Keyshade Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nodejs.md Create a basic Express server that will have secrets injected by Keyshade. Ensure you have Express installed (`npm install express`). ```javascript const express = require('express'); const app = express(); const port = 3000; app.get('/', (req, res) => { // Access secrets injected by Keyshade const apiKey = process.env.API_KEY; const dbPassword = process.env.DB_PASSWORD; res.send(`API Key: ${apiKey}
DB Password: ${dbPassword}`); }); app.listen(port, () => { console.log(`Server listening at http://localhost:${port}`); }); ``` -------------------------------- ### Install pnpm Package Manager Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/setting-things-up.md Install pnpm globally using npm. This is the project's chosen package manager. ```bash npm install -g pnpm ``` -------------------------------- ### Start API Development Server Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-api.md Starts the NestJS API server in development mode. This command is used for local development and debugging. ```bash pnpm run dev:api ``` -------------------------------- ### Run Node.js App via npm Script with Keyshade Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nodejs.md Execute your Node.js application using `keyshade run` when your start command is defined as an npm script in `package.json`. ```bash keyshade run -- npm start ``` -------------------------------- ### Add Common Web Dependencies in Go Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-go.md Install popular web framework dependencies like Gin and Mux for your Go web application. ```bash go get github.com/gin-gonic/gin go get github.com/gorilla/mux ``` -------------------------------- ### Add common web dependencies to Cargo.toml Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-rust.md Example of adding tokio and serde dependencies for web applications in Rust. ```toml [dependencies] tokio = { version = "1", features = ["full"] } serde = { version = "1.0", features = ["derive"] } ``` -------------------------------- ### Get Keyshade Environment Details Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/environment.md Retrieve detailed information about a specific environment using its slug. This command fetches the environment's properties. ```bash keyshade environment get [options] ``` -------------------------------- ### Example Flask Application Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-python.md Create a basic Flask application file named 'app.py'. This snippet shows the minimal structure required to run a Flask app that can receive injected secrets. ```python from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "Hello, World!" if __name__ == "__main__": app.run(debug=True) ``` -------------------------------- ### Create a Go Project with Modules Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-go.md Use these commands to create a new Go project and initialize Go modules for dependency management. ```bash mkdir cd go mod init ``` -------------------------------- ### Initialize Keyshade Project Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/init.md Use this command to initialize your project with Keyshade. It creates a `keyshade.json` file in your project root. ```bash keyshade init [options] ``` -------------------------------- ### Create Python Project and Virtual Environment Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-python.md Create a new directory for your application, navigate into it, and set up a Python virtual environment. Activate the virtual environment before proceeding. ```bash mkdir cd python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` -------------------------------- ### Basic run command usage Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/run.md Execute your application using the default `keyshade.json` configuration file. ```bash keyshade run "npm run dev" ``` -------------------------------- ### Initialize Keyshade in Project (Interactive) Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nodejs.md Link your local project to your Keyshade project and environment by running the init command. This will prompt you for workspace, project, and environment details. ```bash cd keyshade init ``` -------------------------------- ### Install NestJS CLI Globally Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/setting-things-up.md Install the NestJS CLI globally. This is required if you plan to work on the API, which is built with NestJS. ```bash npm install -g @nestjs/cli ``` -------------------------------- ### Create a Node.js Project Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nodejs.md Use npm to create a new Node.js project directory and initialize it with a package.json file. ```bash mkdir cd npm init -y ``` -------------------------------- ### Example IAM Policy Resource ARN Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/platforms/set-up-with-aws_lambda.md An example of how the 'Resource' field in the IAM policy should be formatted with actual AWS values. ```json "Resource": "arn:aws:lambda:us-east-1:123456789012:function:keyshade-demo-function" ``` -------------------------------- ### Initialize Keyshade in Project (Non-Interactive) Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nodejs.md Link your local project to Keyshade using command-line arguments to specify workspace, project, environment, and private key, bypassing interactive prompts. ```bash keyshade init --workspace-slug --project-slug --environment-slug --private-key ``` -------------------------------- ### Create a New Project Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/project.md Use this command to create a new project within a specified workspace. You can provide a name, description, and configure private key storage and access level. ```bash keyshade project create [options] ``` -------------------------------- ### List All Keyshade Profiles Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/profile.md View all configured profiles. Use the --verbose flag to include API keys and base URLs in the output. ```bash keyshade profile list [options] ``` -------------------------------- ### Build Platform Docker Image Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/docker-support.md Builds the Docker image for the Keyshade Platform. ```bash pnpm docker:build:platform ``` -------------------------------- ### Add TypeScript Dependencies for Node.js Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nodejs.md For TypeScript projects, install necessary development dependencies and initialize the TypeScript compiler. ```bash npm install --save-dev typescript @types/node ts-node npx tsc --init ``` -------------------------------- ### Create a Next.js Project Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nextjs.md Use the official Next.js CLI to create a new Next.js application. ```bash npx create-next-app ``` -------------------------------- ### Build Web Application Docker Image Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/docker-support.md Builds the Docker image for the Keyshade Web Application. ```bash pnpm docker:build:web ``` -------------------------------- ### List Variables with Verbose Output Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/variable.md To get more detailed information about each variable, use the --verbose flag when listing them. ```bash keyshade variable list project-1 --verbose ``` -------------------------------- ### Use an Existing Keyshade Profile Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-python.md If you have previously set up a Keyshade profile, use this command to activate it for your local environment. Verify the active profile with 'keyshade workspace list'. ```bash keyshade profile use ``` ```bash keyshade workspace list ``` -------------------------------- ### Create a New Keyshade Profile Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/profile.md Use this command to create a new profile. Specify the profile name, API key, and optionally the base URL. The --set-default flag can be used to make this the active profile. ```bash keyshade profile create [options] ``` -------------------------------- ### Create Keyshade Environment Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/environment.md Use this command to create a new environment within a specified project. You must provide the project slug and can optionally set the environment's name and description. ```bash keyshade environment create [options] ``` -------------------------------- ### Command Action Function Example Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/design-of-our-code/cli.md Illustrates how to access arguments and options within the action function of a CLI command. Use `data.args` for positional arguments and `data.options` for flags. ```typescript // ... snip public async action({ options, args }: CommandActionData): Promise { const profileName = args[0] const { name } = options // Your logic here } // ... snip ``` -------------------------------- ### Node.js Lambda Handler Example Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/platforms/set-up-with-aws_lambda.md A basic Node.js Lambda function handler that accesses environment variables like PORT_NUMBER and API_TOKEN. It provides default values if the variables are not set. ```javascript export const handler = async (event) => { const response = { statusCode: 200, body: { PORT_NUMBER: process.env.PORT_NUMBER || '3000', API_TOKEN: process.env.API_TOKEN || 'supersecret' }, }; return response; }; ``` -------------------------------- ### Use custom config file with run command Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/run.md Specify a custom configuration file path to use instead of the default `keyshade.json` for running your application. ```bash keyshade run --config-file keyshade.stage.json "npm run dev" ``` -------------------------------- ### Access Injected Variables in Python Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-python.md Access secrets and variables injected by Keyshade at runtime using Python's built-in 'os.environ' object. No additional imports or setup are required within your Python code. ```python import os db_url = os.environ.get("DATABASE_URL") port = int(os.environ.get("PORT", 5000)) api_key = os.environ.get("API_KEY") ``` -------------------------------- ### Project Initialization Configuration Interface Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/internals/how-the-cli-works.md Defines the structure for the project configuration file (`keyshade.json`). This file links your project to a specific workspace, project, and environment on the platform. ```typescript interface ProjectRootConfig { workspace: string project: string environment: string } ``` -------------------------------- ### Initialize Keyshade with Flags Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/add-keyshade-to-your-project.md Use this command for a non-interactive Keyshade initialization. Provide all necessary details as command-line arguments. ```shell keyshade init --workspace --project --environment --private-key ``` -------------------------------- ### Use an Existing Keyshade Profile Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/frameworks/set-up-with-nodejs.md Switch to an existing Keyshade profile to connect your local environment with your Keyshade workspace. ```bash keyshade profile use ``` -------------------------------- ### Keyshade Configuration File Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/add-keyshade-to-your-project.md The keyshade.json file is generated after initialization and contains essential connection details for the Keyshade CLI. ```json { "workspace": "my-workspace-630", "project": "my-app-3", "environment": "default-223", "quitOnDecryptionFailure": false } ``` -------------------------------- ### Keyshade CLI Project Command Usage Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/project.md This is the general usage pattern for the `project` command in the Keyshade CLI. ```bash keyshade project [options] ``` -------------------------------- ### Build API Docker Image Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/docker-support.md Builds the Docker image for the Keyshade API. ```bash pnpm docker:build:api ``` -------------------------------- ### Build Internal Packages Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-cli.md Build the necessary internal packages, `@keyshade/api-client` and `@keyshade/secret-scan`, before running the CLI. ```bash pnpm build:api-client pnpm build:secret-scan ``` -------------------------------- ### Run Platform Docker Container Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/docker-support.md Runs the Docker container for the Keyshade Platform. ```bash pnpm docker:run:platform ``` -------------------------------- ### List Keyshade Workspaces Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/cli/workspace.md Usage for listing available workspaces. Supports pagination, sorting, and searching options. ```bash keyshade workspace list [options] ``` -------------------------------- ### Create a new Rust project Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/integration/languages/set-up-with-rust.md Use Cargo to create a new Rust project. This sets up the basic file structure including Cargo.toml and src/main.rs. ```bash cargo new cd ``` -------------------------------- ### Import Environment Variables using CLI Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/importing-your-environment-variables.md Use this command to initiate the import process from your project directory via the command line interface. Follow the prompts to specify the .env file path, workspace, project, and environment. ```bash keyshade import ``` -------------------------------- ### Build All Packages Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/setting-things-up.md Build all required packages (secret-scan, schema, api-client) simultaneously for efficiency. This command streamlines the build process. ```bash pnpm build:packages ``` -------------------------------- ### Run Web App Tests Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/running-the-web-app.md Executes the unit and mock tests for the web application. This command should be run from the project root. ```sh pnpm test:web ``` -------------------------------- ### Run Web Application Docker Container Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/contributing-to-keyshade/running-things-locally/docker-support.md Runs the Docker container for the Keyshade Web Application. ```bash pnpm docker:run:web ``` -------------------------------- ### Authenticate Keyshade CLI Source: https://github.com/keyshade-xyz/keyshade/blob/develop/docs/getting-started/installing-the-cli.md Log in to your Keyshade profile using the CLI. This command initiates the authentication process. ```shell keyshade login ```