remodel init

Initializes a new ReModel project. This command creates the models directory, a Providers component, installs @blue-functor/remodel, and writes a .remodel config file.


Usage

Interactive:

remodel
# then select "Initialize Project"

Non-interactive:

remodel init --ts --platform react --dir ./src/models

Options

FlagTypeDefaultDescription
--tsbooleantrueUse TypeScript
--jsbooleanfalseUse JavaScript
--platform <platform>stringreactTarget platform (react or react-native)
--dir <directory>stringauto-detectModels directory path

If --dir is not provided, the CLI looks for an existing models/, src/models/, or app/models/ directory. If none is found, it defaults to ./src/models.


What It Does

The init command performs four steps:

1. Creates the models directory and index file

      • index.ts
src/models/index.ts
import type { ModelProps } from '@blue-functor/remodel';
 
const config: ModelProps = {
  reducers: {},
  epics: {},
};
 
export default config;

This file serves as the central registry for all your models. When you generate new models, the CLI automatically adds them here.

2. Creates a Providers component

src/Providers.tsx
import React from 'react';
import { ModelProvider } from '@blue-functor/remodel';
import models from './models';
 
interface ProvidersProps {
  children: React.ReactNode;
}
 
export function Providers({ children }: ProvidersProps) {
  return (
    <ModelProvider config={models}>
      {children}
    </ModelProvider>
  );
}

Wrap your app root with this component to integrate ReModel.

3. Installs @blue-functor/remodel

The CLI detects your package manager (npm, yarn, pnpm, or bun) by looking for lock files and runs the appropriate install command.

4. Writes .remodel config

.remodel
{
  "language": "typescript",
  "platform": "react",
  "modelsDirectory": "./src/models"
}

This config file persists your project settings so future commands use the correct defaults automatically.


Interactive Flow

When running interactively, the init command walks you through a multi-step wizard:

  1. Language — Select TypeScript or JavaScript
  2. Platform — Select React or React Native
  3. Models directory — Confirm or change the directory path (with filesystem autocomplete)
  4. Setup — The CLI creates files, installs dependencies, and writes config
  5. Next step — Optionally jump straight into creating your first model
💡

If a .remodel config already exists, the CLI will overwrite it. Make sure to back up any custom settings before re-running init.