Skip to content

Installation

This page covers all the ways to install and access SkyState tooling.


CLI

The SkyState CLI (@skystate/cli) is the primary tool for pushing configs, managing projects, and authenticating from the terminal.

Requirements

  • Node.js 18 or later
  • npm 8 or later (or any compatible package manager)

Global Install

bash
npm install -g @skystate/cli

Verify:

bash
skystate --version

Project-Local Install

If you prefer to pin the CLI version per project, install it as a dev dependency:

bash
npm install --save-dev @skystate/cli

Then run it via npx or through a package.json script:

bash
npx skystate --version
json
{
  "scripts": {
    "push:dev": "skystate push config.json --env development"
  }
}

Updating

bash
npm update -g @skystate/cli

SDKs

SkyState ships two JavaScript/TypeScript SDK packages.

@skystate/core

A framework-agnostic client for Node.js, browser, and any JavaScript environment. Use this for non-React apps, server-side usage, or when you want to build your own integration layer.

bash
npm install @skystate/core

Basic Usage

ts
import { createSkyStateClient } from '@skystate/core';

const client = createSkyStateClient({
  projectSlug: 'my-app',
  environment: 'production',
});

// Fetch a single key with a fallback default
const maintenanceEnabled = await client.get<boolean>(
  'maintenance.enabled',
  false,
);

// Fetch the full config object
const config = await client.getAll();

TypeScript Support

@skystate/core ships full TypeScript type definitions. No @types/ package is required.

@skystate/react

React hooks and context provider built on top of @skystate/core. Designed for React 18+.

bash
npm install @skystate/react

Setup

Wrap your root component with SkyStateProvider:

tsx
// main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import { SkyStateProvider } from '@skystate/react';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <SkyStateProvider
      projectSlug="my-app"
      environment={import.meta.env.PROD ? 'production' : 'development'}
      devKey={import.meta.env.VITE_SKYSTATE_DEV_KEY}
    >
      <App />
    </SkyStateProvider>
  </React.StrictMode>
);

Hooks

tsx
import { useProjectConfig } from '@skystate/react';

function AnnouncementBanner() {
  const { data: enabled, isLoading } = useProjectConfig<boolean>(
    'banner.enabled',
    false,
  );
  const { data: text } = useProjectConfig<string>(
    'banner.text',
    '',
  );

  if (isLoading || !enabled) return null;

  return <div className="banner">{text}</div>;
}

The useProjectConfig hook returns:

PropertyTypeDescription
dataTThe resolved value. defaultValue until the fetch completes.
isLoadingbooleantrue while the initial fetch is in flight.
errorError | nullPopulated if the fetch fails. data stays on defaultValue.

Environment Variables

In Vite Apps

Vite exposes variables prefixed with VITE_ to the client bundle. To pass your dev key to the SDK:

# .env
VITE_SKYSTATE_DEV_KEY=sk_dev_abc123...
ts
const devKey = import.meta.env.VITE_SKYSTATE_DEV_KEY;

In Next.js Apps

Next.js exposes variables prefixed with NEXT_PUBLIC_ to the browser:

# .env.local
NEXT_PUBLIC_SKYSTATE_DEV_KEY=sk_dev_abc123...
ts
const devKey = process.env.NEXT_PUBLIC_SKYSTATE_DEV_KEY;

In Node.js / Server Environments

For server-side usage (e.g. reading config in a Next.js API route or an Express server), use the full JWT token from the CLI credentials, or generate a project API key from the dashboard:

# .env
SKYSTATE_API_KEY=your-api-key-here

Server-side credentials should never be exposed to the browser bundle. Always use environment variables that are not prefixed with VITE_ or NEXT_PUBLIC_.


Dashboard

The SkyState dashboard is a web application — no installation required.

Access it at: https://app.skystate.io

Sign in with your GitHub account. The dashboard provides:

  • A project overview showing all your projects and their environments.
  • A Remote Config editor with syntax highlighting and diff view.
  • Version history with the ability to view and restore any past version.
  • Usage page showing your API request counts and billing status.
  • Settings for managing dev API keys, account details, and subscription.

Browser Requirements

The dashboard works in any modern browser. Chrome, Firefox, Safari, and Edge are all supported. JavaScript must be enabled.


CI/CD Integration

To use the CLI in CI pipelines, provide credentials via environment variables instead of running skystate login interactively.

Using a Token

Set SKYSTATE_TOKEN to your JWT from ~/.config/skystate/credentials.json:

yaml
# GitHub Actions example
- name: Push config
  env:
    SKYSTATE_TOKEN: ${{ secrets.SKYSTATE_TOKEN }}
  run: |
    npm install -g @skystate/cli
    skystate push config.json --env staging --yes

The CLI reads SKYSTATE_TOKEN automatically — no skystate login step is needed.

Project Slug Override

If your pipeline does not have a skystate.json in the working directory, provide the project slug via environment variable:

bash
SKYSTATE_PROJECT=my-app skystate push config.json --env production

Non-Interactive Mode

Pass --yes to skip confirmation prompts in scripts:

bash
skystate push config.json --env production --yes

Uninstalling

Remove the CLI

bash
npm uninstall -g @skystate/cli

Remove Stored Credentials and Config

bash
rm -rf ~/.config/skystate

This removes your stored token and CLI config. You will need to run skystate login again after reinstalling.

Built with VitePress