In this guide, we'll demonstrate how to integrate CommandK with your Remix application. By using CommandK, you can efficiently manage secrets and configuration in your Remix projects, enhancing security and simplifying your development workflow.


Before you begin the integration process, make sure you have the following:

  1. API Access Token: To authenticate your Remix application with CommandK, you'll need an API access token. If you haven't obtained one yet, refer to this link for instructions on how to acquire it.

Integration Steps

Follow these steps to integrate CommandK with your Remix application:

Step 1: Create a Remix Application

If you haven't already created a Remix application, you can set up a new project using the Remix CLI or any other preferred method. Here, we'll use the Remix CLI for demonstration:

  1. Install the Remix CLI globally if you haven't already:

    npm install -g create-remix
  2. Create a new Remix project using the following command:

    remix create my-remix-app

    Replace my-remix-app with your desired project name.

  3. Follow the prompts to configure your Remix project. You can choose options such as the programming language (JavaScript/TypeScript), package manager, and more based on your project requirements.

Step 2: Access Secrets in Your Remix Application

Inside your Remix application, you can access secrets as environment variables. Open the appropriate file (e.g., server.ts or app.ts) and add the following code snippet to access an environment variable:

import { createServer, json, LoaderFunction } from '@remix-run/node';

export let loader: LoaderFunction = async ({ request }) => {
  let name = process.env.REMIX_PUBLIC_NAME;
  return json({ name });

let server = createServer();


This code uses Remix's createServer function to set up a server and access the REMIX_PUBLIC_NAME environment variable.

Running Your Remix Application

To run your Remix application with the CommandK CLI, you can use the following command:

$ cmdk run <application-name> --environment development -- npm run dev

Replace <application-name> with the actual name of your Remix application. This command will execute your Remix application in the development environment.

Running with dotenv

If your Remix application uses dotenv to manage environment variables, you can utilize the CommandK CLI to write these variables to a .env file and then run your service. Follow these steps:

  1. Execute the following command:
$ cmdk run <application-name> --environment development \
     --run-type file-store \
     --file-name .env.local \
     --file-format env \
     -- npm run dev

Replace <application-name> with the actual name of your Remix application. This command will write your environment variables to the .env.local file in the specified env format and then run your Remix service.

Adjust the file name and format to match your project's configuration if necessary.

By following these instructions, you can seamlessly integrate the CommandK CLI with your Remix application, making it easy to manage secrets and run your application securely.