CLI

Configuration

The motionuikit.config.json file, its fields and import aliases, and where the CLI finds your API key.

init writes motionuikit.config.json in your project's root. It tells the CLI which framework you use, whether the project is TypeScript, and where installed files go. Commit it: it never holds your API key.

motionuikit.config.json
{
  "$schema": "https://motionuikit.io/schema/config.json",
  "aliases": {
    "components": "@/components/motionuikit",
    "ui": "@/components/motionuikit/ui",
    "sections": "@/components/motionuikit/sections",
    "hooks": "@/hooks",
    "lib": "@/lib"
  },
  "typescript": true,
  "framework": "react",
  "apiKey": "${MOTIONUIKIT_API_KEY}"
}

Every field is optional, so {} is a valid config: a missing field takes its default. The $schema line gives your editor autocomplete and checks the file as you type.

Fields

FieldWhat it doesDefault
frameworkWhich version of each item to install: react or html (no HTML versions are published yet).react
typescriptfalse converts TypeScript files to JavaScript on install (.tsx → .jsx, .ts → .js).true
aliasesHow your code imports each kind of file. See Aliases.as above
apiKeyThe name of the variable that holds your API key, as ${MOTIONUIKIT_…}. Never the key itself.unset: reads MOTIONUIKIT_API_KEY
importStylerelative makes installed files import each other with relative paths, for a project without the @/ alias.unset: @/, checked on every add
tailwindfalse means you declined the Tailwind CSS setup, and the CLI won't offer it again.unset: checked on every add

Aliases

Installed files import each other through these aliases, so they have to match how your project resolves imports.

Aliases are for React projects. An HTML project's config has none: its pages import nothing, and every section goes to sections/<name>.html at the project root.

AliasHoldsDefault folder
componentseverything MotionUIKit installscomponents/motionuikit
uicomponents, one file eachcomponents/motionuikit/ui/meteor-grid.tsx
sectionssections, one folder eachcomponents/motionuikit/sections/arcline/
hookshookshooks
libhelperslib

In a project with a src/ folder, every folder above is inside src/. In Astro, they are inside the folder its srcDir setting names (src by default).

ui and sections follow components unless you set them: change components to @/ui/motionuikit, and ui becomes @/ui/motionuikit/ui.

Using your own alias

To put files somewhere else, change an alias and add a matching paths entry to tsconfig.json (or jsconfig.json in a JavaScript project). The CLI reads paths to find the folder:

motionuikit.config.json
{
  "aliases": {
    "components": "~/components/motionuikit"
  }
}
tsconfig.json
{
  "compilerOptions": {
    "paths": {
      "~/*": ["./src/*"]
    }
  }
}

On install, every import in the downloaded files is rewritten from the default to your alias, and the files are written to the folder the alias points to. If an alias doesn't match any paths entry, add stops before downloading anything and names the fix.

Other assets

Some files don't belong to an alias. They always go to the same place:

WhatWhere
SVG components of a sectionassets/motionuikit/svg/ (under src/ if you have one)
Images, videos and 3D modelspublic/motionuikit/images/, videos/, models/

The code already points at /motionuikit/…, so nothing needs changing after install.

Your API key

The CLI looks for your key in this order and uses the first it finds:

  1. --auth <key> on the command line;
  2. the variable named in the config's apiKey (${MOTIONUIKIT_API_KEY});
  3. MOTIONUIKIT_API_KEY in your environment.

A variable is read from your shell first, then from .env.local and .env in your project (and in the folders above it, up to your workspace root). init saves the key to .env and adds .env to .gitignore. Each command prints where the key came from, never the key itself.

Never put the key in motionuikit.config.json

The config is committed, so anyone with your repository would see it. The CLI refuses a config whose apiKey holds a key instead of ${VARIABLE}, and only accepts variables whose names start with MOTIONUIKIT_.

To use a different variable, for example a team key, name it in the config and put it in .env:

motionuikit.config.json
{
  "apiKey": "${MOTIONUIKIT_TEAM_KEY}"
}
.env
MOTIONUIKIT_TEAM_KEY=your_key

The CLI reads only MOTIONUIKIT_ variables from your env files. Nothing else in them is read, sent or logged.

On this page