Concepts
Nativra has two parts: a registry of source files and a CLI that copies them into your project. Nothing from Nativra runs in your app.
01
Registry
Static JSON. registry.json indexes the items; items/<id>.json holds each item's source, dependencies and SHA-256 hashes.
02
CLI
Resolves dependencies, verifies hashes, picks your styling target and rewrites imports to your paths.
03
Your project
Plain .tsx files in the folders you chose, plus nativra.lock.json recording what was written.
The output is ordinary source: you can read it, commit it and change it. There is no Nativra package in your dependencies, and nothing changes in your project unless you run a command.
componentsDir.blocksDir, or componentsDir when that is unset.componentsDir.useThemeColors and useHaptics. Installed to hooksDir.cn(). Installed to utilsDir.theme.ts in themesDir.style.ts in themesDir.Each item lists the registry items it needs. add walks that graph and installs dependencies first. For example, add login-form installs 10 items: zinc, soft, use-theme-colors, card, button, input, label, separator, text and login-form.
npm packages an item needs, such as react-native-reanimated, are listed separately. The CLI checks which are missing and offers to install them with your package manager. Pass --install to install without asking, or --no-install to skip.
Every item is written twice: once with NativeWind v4 classes and once with StyleSheet.create, with the same props and behaviour. stylingTarget in nativra.json decides which one you get. Both read colors from the installed theme, so they look the same. See NativeWind and StyleSheet.
Registry source always imports through canonical aliases: @/components/ui, @/lib/utils, @/hooks and @/blocks. When the CLI writes a file, it rewrites them to match your directories and the path alias from tsconfig.json. That covers import … from, export … from, side-effect import "…", import() and require(). add, update and diff share one renderer, so diff never reports a change that is only an import path.
// As authored in the registry: canonical aliases only
import { Text } from "@/components/ui/Text";
import { useThemeColors } from "@/hooks/use-theme-colors";// Installed with aliasPrefix "~/", componentsDir "ui", hooksDir "lib/hooks"
import { Text } from "~/ui/Text";
import { useThemeColors } from "~/lib/hooks/use-theme-colors";Every file the CLI writes is hashed into nativra.lock.json, together with the item's version and the items it depends on. Commit it: update, diff, remove and doctor use it to tell your edits apart from the original.
{
"items": {
"zinc": {
"version": "0.1.0",
"files": { "lib/themes/theme.ts": "1e37f57f…28a55c" }
},
"use-theme-colors": {
"version": "0.1.0",
"files": { "hooks/use-theme-colors.ts": "b950bc44…718fb8" },
"dependencies": ["zinc"]
},
"button": {
"version": "0.1.0",
"files": { "components/ui/Button.tsx": "…" },
"dependencies": ["use-theme-colors"]
}
}
}Updating & rollback explains what each command does with these hashes.