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.
{
"$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
| Field | What it does | Default |
|---|---|---|
framework | Which version of each item to install: react or html (no HTML versions are published yet). | react |
typescript | false converts TypeScript files to JavaScript on install (.tsx → .jsx, .ts → .js). | true |
aliases | How your code imports each kind of file. See Aliases. | as above |
apiKey | The name of the variable that holds your API key, as ${MOTIONUIKIT_…}. Never the key itself. | unset: reads MOTIONUIKIT_API_KEY |
importStyle | relative makes installed files import each other with relative paths, for a project without the @/ alias. | unset: @/, checked on every add |
tailwind | false 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.
| Alias | Holds | Default folder |
|---|---|---|
components | everything MotionUIKit installs | components/motionuikit |
ui | components, one file each | components/motionuikit/ui/meteor-grid.tsx |
sections | sections, one folder each | components/motionuikit/sections/arcline/ |
hooks | hooks | hooks |
lib | helpers | lib |
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:
{
"aliases": {
"components": "~/components/motionuikit"
}
}{
"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:
| What | Where |
|---|---|
| SVG components of a section | assets/motionuikit/svg/ (under src/ if you have one) |
| Images, videos and 3D models | public/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:
--auth <key>on the command line;- the variable named in the config's
apiKey(${MOTIONUIKIT_API_KEY}); MOTIONUIKIT_API_KEYin 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:
{
"apiKey": "${MOTIONUIKIT_TEAM_KEY}"
}MOTIONUIKIT_TEAM_KEY=your_keyThe CLI reads only MOTIONUIKIT_ variables from your env files. Nothing else in them is read, sent or logged.