Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: Update file-structure of /frontend (#328)

Myles Scolnicka4674eee2f92
diff --git a/frontend/.storybook/preview.tsx b/frontend/.storybook/preview.tsx
index e8af99616b..e75806aee3 100644
--- a/frontend/.storybook/preview.tsx
+++ b/frontend/.storybook/preview.tsx
@@ -4,7 +4,7 @@ import "../src/css/App.css";
import "./sb.css";
import "tailwindcss/tailwind.css";
import { useEffect } from "react";
-import { cn } from "../src/lib/utils";
+import { cn } from "../src/utils/cn";
import { TooltipProvider } from "../src/components/ui/tooltip";
const withTheme: Decorator = (Story, context) => {
diff --git a/frontend/src/README.md b/frontend/src/README.md
new file mode 100644
index 0000000000..dd6c1ff8ce
--- /dev/null
+++ b/frontend/src/README.md
@@ -0,0 +1,18 @@
+# File Structure
+
+```
+┣ 📂assets - contains images assets
+┣ 📂components - contains "connected" components (i.e connected to state/store), split up by domain
+┣ 📂components/ui - re-usable "dumb" components
+┣ 📂core - core logic of the app, split up by domain
+┣ 📂css - various global css files
+┣ 📂fonts - app fonts
+┣ 📂hooks - shared, re-usable hooks
+┣ 📂mocks - shared mocks
+┣ 📂plugins - plugin logic
+┣ 📂plugins/impl - individual plugin implementations
+┣ 📂plugins/layout - individual "stateless" plugin implementations
+┣ 📂stories - storybook stories
+┣ 📂theme - app theme
+┣ 📂utils - shared utils
+```
diff --git a/frontend/src/components/app-config/app-config-button.tsx b/frontend/src/components/app-config/app-config-button.tsx
index 523f23e447..c312eb19ad 100644
--- a/frontend/src/components/app-config/app-config-button.tsx
+++ b/frontend/src/components/app-config/app-config-button.tsx
@@ -4,7 +4,7 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
-import { Button } from "../../editor/inputs/Inputs";
+import { Button } from "../editor/inputs/Inputs";
import { SettingsIcon } from "lucide-react";
import { UserConfigForm } from "./user-config-form";
import { Tooltip } from "../ui/tooltip";
diff --git a/frontend/src/components/app-config/app-config-form.tsx b/frontend/src/components/app-config/app-config-form.tsx
index 215740b43d..a6c0cabe32 100644
--- a/frontend/src/components/app-config/app-config-form.tsx
+++ b/frontend/src/components/app-config/app-config-form.tsx
@@ -8,9 +8,9 @@ import {
FormItem,
FormLabel,
} from "@/components/ui/form";
-import { AppConfig, AppConfigSchema } from "../../core/config/config";
+import { AppConfig, AppConfigSchema } from "../../core/config/config-schema";
import { toast } from "../ui/use-toast";
-import { useAppConfig } from "@/core/state/config";
+import { useAppConfig } from "@/core/config/config";
import { Switch } from "@/components/ui/switch";
import { saveAppConfig } from "@/core/network/requests";
import { SettingTitle, SettingDescription } from "./common";
diff --git a/frontend/src/components/app-config/user-config-form.tsx b/frontend/src/components/app-config/user-config-form.tsx
index 07930bb3f6..6ed6f7e433 100644
--- a/frontend/src/components/app-config/user-config-form.tsx
+++ b/frontend/src/components/app-config/user-config-form.tsx
@@ -10,12 +10,12 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
-import { UserConfig, UserConfigSchema } from "../../core/config/config";
+import { UserConfig, UserConfigSchema } from "../../core/config/config-schema";
import { Checkbox } from "../ui/checkbox";
import { Input } from "../ui/input";
import { toast } from "../ui/use-toast";
import { saveUserConfig } from "../../core/network/requests";
-import { useUserConfig } from "../../core/state/config";
+import { useUserConfig } from "../../core/config/config";
import { NativeSelect } from "../ui/native-select";
import { KEYMAP_PRESETS } from "@/core/codemirror/keymaps/keymaps";
import { CopilotConfig } from "@/core/codemirror/copilot/copilot-config";
diff --git a/frontend/src/components/audio/audio-recorder.tsx b/frontend/src/components/audio/audio-recorder.tsx
index e9389d88f9..59488111a1 100644
--- a/frontend/src/components/audio/audio-recorder.tsx
+++ b/frontend/src/components/audio/audio-recorder.tsx
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import React from "react";
import { Button } from "../ui/button";
import { CircleIcon, SquareIcon } from "lucide-react";
diff --git a/frontend/src/components/data-table/column-header.tsx b/frontend/src/components/data-table/column-header.tsx
index 16758d8317..3aa00f0add 100644
--- a/frontend/src/components/data-table/column-header.tsx
+++ b/frontend/src/components/data-table/column-header.tsx
@@ -2,7 +2,7 @@
import { Column } from "@tanstack/react-table";
import { ChevronsUpDown, SortAsc, SortDesc } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
diff --git a/frontend/src/components/data-table/data-table.tsx b/frontend/src/components/data-table/data-table.tsx
index 614e8fc4da..7169e57882 100644
--- a/frontend/src/components/data-table/data-table.tsx
+++ b/frontend/src/components/data-table/data-table.tsx
@@ -23,7 +23,7 @@ import {
} from "@/components/ui/table";
import { DataTablePagination } from "./pagination";
import { DownloadActionProps, DownloadAs } from "./download-actions";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface DataTableProps<TData, TValue> extends Partial<DownloadActionProps> {
className?: string;
diff --git a/frontend/src/components/data-table/mime-cell.tsx b/frontend/src/components/data-table/mime-cell.tsx
index ff29ee63d4..605733bc38 100644
--- a/frontend/src/components/data-table/mime-cell.tsx
+++ b/frontend/src/components/data-table/mime-cell.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { cn } from "@/lib/utils";
-import { formatOutput } from "../../editor/Output";
+import { cn } from "@/utils/cn";
+import { formatOutput } from "../editor/Output";
import { OutputMessage } from "../../core/kernel/messages";
interface MimeCellProps {
diff --git a/frontend/src/components/dependency-graph/custom-node.tsx b/frontend/src/components/dependency-graph/custom-node.tsx
index f31eeb5234..831ebd4318 100644
--- a/frontend/src/components/dependency-graph/custom-node.tsx
+++ b/frontend/src/components/dependency-graph/custom-node.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { TinyCode } from "@/editor/cell/TinyCode";
-import { cn } from "@/lib/utils";
+import { TinyCode } from "@/components/editor/cell/TinyCode";
+import { cn } from "@/utils/cn";
import { useAtomValue } from "jotai";
import { memo } from "react";
import { Handle, Position, useStore } from "reactflow";
diff --git a/frontend/src/components/dependency-graph/dependency-graph.tsx b/frontend/src/components/dependency-graph/dependency-graph.tsx
index 2828af5607..0c8426ccc8 100644
--- a/frontend/src/components/dependency-graph/dependency-graph.tsx
+++ b/frontend/src/components/dependency-graph/dependency-graph.tsx
@@ -14,8 +14,8 @@ import ReactFlow, {
import React, { useEffect, useMemo, useState } from "react";
import { CustomNode } from "@/components/dependency-graph/custom-node";
import { Variables } from "@/core/variables/types";
-import { CellId } from "@/core/model/ids";
-import { CellData } from "@/core/model/cells";
+import { CellId } from "@/core/cells/ids";
+import { CellData } from "@/core/cells/types";
import { Atom } from "jotai";
import "reactflow/dist/style.css";
diff --git a/frontend/src/components/dependency-graph/elements.ts b/frontend/src/components/dependency-graph/elements.ts
index 114c602806..9db800a513 100644
--- a/frontend/src/components/dependency-graph/elements.ts
+++ b/frontend/src/components/dependency-graph/elements.ts
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { CellData } from "@/core/model/cells";
-import { CellId } from "@/core/model/ids";
+import { CellData } from "@/core/cells/types";
+import { CellId } from "@/core/cells/ids";
import { store } from "@/core/state/jotai";
import { Variables } from "@/core/variables/types";
import { Edge, MarkerType, Node, NodeProps } from "reactflow";
diff --git a/frontend/src/editor/Cell.tsx b/frontend/src/components/editor/Cell.tsx
similarity index 95%
rename from frontend/src/editor/Cell.tsx
rename to frontend/src/components/editor/Cell.tsx
index 8244b23775..8f1199e963 100644
--- a/frontend/src/editor/Cell.tsx
+++ b/frontend/src/components/editor/Cell.tsx
@@ -18,10 +18,10 @@ import {
import { sendRun } from "@/core/network/requests";
import { autocompletionKeymap, setupCodeMirror } from "@/core/codemirror/cm";
-import { UserConfig } from "../core/config/config";
-import { CellData, CellRuntimeState } from "../core/model/cells";
-import { CellActions, useCellActions } from "../core/state/cells";
-import { derefNotNull } from "../utils/dereference";
+import { UserConfig } from "../../core/config/config-schema";
+import { CellData, CellRuntimeState } from "../../core/cells/types";
+import { CellActions, useCellActions } from "../../core/cells/cells";
+import { derefNotNull } from "../../utils/dereference";
import { OutputArea } from "./Output";
import { ConsoleOutput } from "./output/ConsoleOutput";
import { CreateCellButton } from "./cell/CreateCellButton";
@@ -29,14 +29,14 @@ import { RunButton } from "./cell/RunButton";
import { DeleteButton } from "./cell/DeleteButton";
import { CellStatusComponent } from "./cell/CellStatus";
import clsx from "clsx";
-import { renderShortcut } from "../components/shortcuts/renderShortcut";
-import { useCellRenderCount } from "../hooks/useCellRenderCount";
-import { Functions } from "../utils/functions";
-import { Logger } from "../utils/Logger";
-import { SerializedEditorState } from "../core/codemirror/types";
+import { renderShortcut } from "../shortcuts/renderShortcut";
+import { useCellRenderCount } from "../../hooks/useCellRenderCount";
+import { Functions } from "../../utils/functions";
+import { Logger } from "../../utils/Logger";
+import { SerializedEditorState } from "../../core/codemirror/types";
import { CellDragHandle, SortableCell } from "./SortableCell";
-import { HTMLCellId } from "../core/model/ids";
-import { Theme } from "../theme/useTheme";
+import { HTMLCellId } from "../../core/cells/ids";
+import { Theme } from "../../theme/useTheme";
import { CellActionsDropdown } from "./cell/cell-actions";
import { CellActionsContextMenu } from "./cell/cell-context-menu";
import { AppMode } from "@/core/mode";
diff --git a/frontend/src/editor/CommandPallette.tsx b/frontend/src/components/editor/CommandPallette.tsx
similarity index 94%
rename from frontend/src/editor/CommandPallette.tsx
rename to frontend/src/components/editor/CommandPallette.tsx
index e637407016..38e1b9ee5f 100644
--- a/frontend/src/editor/CommandPallette.tsx
+++ b/frontend/src/components/editor/CommandPallette.tsx
@@ -10,10 +10,10 @@ import {
CommandSeparator,
CommandShortcut,
} from "@/components/ui/command";
-import { useRegisteredActions } from "../core/state/actions";
-import { useRecentCommands } from "../hooks/useRecentCommands";
-import { Kbd } from "../components/ui/kbd";
-import { prettyPrintHotkey } from "../components/shortcuts/renderShortcut";
+import { useRegisteredActions } from "../../core/hotkeys/actions";
+import { useRecentCommands } from "../../hooks/useRecentCommands";
+import { Kbd } from "../ui/kbd";
+import { prettyPrintHotkey } from "../shortcuts/renderShortcut";
import { HOTKEYS, HotkeyAction, isHotkeyAction } from "@/core/hotkeys/hotkeys";
import { atom, useAtom } from "jotai";
import { useNotebookActions } from "./actions/useNotebookActions";
diff --git a/frontend/src/editor/Controls.tsx b/frontend/src/components/editor/Controls.tsx
similarity index 87%
rename from frontend/src/editor/Controls.tsx
rename to frontend/src/components/editor/Controls.tsx
index 95e32abf48..9ed6c58e4a 100644
--- a/frontend/src/editor/Controls.tsx
+++ b/frontend/src/components/editor/Controls.tsx
@@ -8,20 +8,20 @@ import {
SquareIcon,
} from "lucide-react";
-import { cn } from "@/lib/utils";
-import { Button } from "@/editor/inputs/Inputs";
-import { KeyboardShortcuts } from "editor/KeyboardShortcuts";
-import { ShutdownButton } from "editor/ShutdownButton";
-import { RecoveryButton } from "editor/RecoveryButton";
-
-import { Tooltip } from "../components/ui/tooltip";
-import { renderShortcut } from "../components/shortcuts/renderShortcut";
-import { useCellActions } from "../core/state/cells";
-import { AppConfigButton } from "../components/app-config/app-config-button";
+import { cn } from "@/utils/cn";
+import { Button } from "@/components/editor/inputs/Inputs";
+import { KeyboardShortcuts } from "@/components/editor/KeyboardShortcuts";
+import { ShutdownButton } from "@/components/editor/ShutdownButton";
+import { RecoveryButton } from "@/components/editor/RecoveryButton";
+
+import { Tooltip } from "../ui/tooltip";
+import { renderShortcut } from "../shortcuts/renderShortcut";
+import { useCellActions } from "../../core/cells/cells";
+import { AppConfigButton } from "../app-config/app-config-button";
import { LayoutSelect } from "./renderers/layout-select";
-import { NotebookMenuDropdown } from "@/editor/notebook-menu-dropdown";
+import { NotebookMenuDropdown } from "@/components/editor/notebook-menu-dropdown";
import { FindReplace } from "@/components/find-replace/find-replace";
-import { AppConfig } from "@/core/config/config";
+import { AppConfig } from "@/core/config/config-schema";
import { useShouldShowInterrupt } from "./cell/useShouldShowInterrupt";
interface ControlsProps {
diff --git a/frontend/src/editor/DirCompletionInput.tsx b/frontend/src/components/editor/DirCompletionInput.tsx
similarity index 98%
rename from frontend/src/editor/DirCompletionInput.tsx
rename to frontend/src/components/editor/DirCompletionInput.tsx
index 9762b3053b..439e34dc77 100644
--- a/frontend/src/editor/DirCompletionInput.tsx
+++ b/frontend/src/components/editor/DirCompletionInput.tsx
@@ -9,9 +9,9 @@ import {
import { sendDirectoryAutocompleteRequest } from "@/core/network/requests";
import { Input } from "./inputs/Inputs";
-import { Logger } from "../utils/Logger";
-import { Functions } from "../utils/functions";
-import { cn } from "../lib/utils";
+import { Logger } from "../../utils/Logger";
+import { Functions } from "../../utils/functions";
+import { cn } from "../../utils/cn";
function extractBasename(path: string): string {
const basename = path.split(/[/\\]/).pop();
diff --git a/frontend/src/editor/Disconnected.tsx b/frontend/src/components/editor/Disconnected.tsx
similarity index 100%
rename from frontend/src/editor/Disconnected.tsx
rename to frontend/src/components/editor/Disconnected.tsx
diff --git a/frontend/src/editor/FilenameForm.tsx b/frontend/src/components/editor/FilenameForm.tsx
similarity index 97%
rename from frontend/src/editor/FilenameForm.tsx
rename to frontend/src/components/editor/FilenameForm.tsx
index d413340bb9..72792e282a 100644
--- a/frontend/src/editor/FilenameForm.tsx
+++ b/frontend/src/components/editor/FilenameForm.tsx
@@ -2,11 +2,11 @@
import { useRef, useState } from "react";
import { CheckIcon, XIcon } from "lucide-react";
-import { Button } from "@/editor/inputs/Inputs";
+import { Button } from "@/components/editor/inputs/Inputs";
import {
DirCompletionInput,
DirCompletionInputHandle,
-} from "editor/DirCompletionInput";
+} from "@/components/editor/DirCompletionInput";
import { useImperativeModal } from "@/components/modal/ImperativeModal";
import {
AlertDialogDescription,
diff --git a/frontend/src/editor/KeyboardShortcuts.tsx b/frontend/src/components/editor/KeyboardShortcuts.tsx
similarity index 87%
rename from frontend/src/editor/KeyboardShortcuts.tsx
rename to frontend/src/components/editor/KeyboardShortcuts.tsx
index 5593e2fac1..13cdf98446 100644
--- a/frontend/src/editor/KeyboardShortcuts.tsx
+++ b/frontend/src/components/editor/KeyboardShortcuts.tsx
@@ -2,10 +2,10 @@
import { useRef } from "react";
import { KeyboardIcon } from "lucide-react";
-import { Button } from "@/editor/inputs/Inputs";
-import { useHotkey } from "../hooks/useHotkey";
-import { Tooltip } from "../components/ui/tooltip";
-import { Kbd } from "../components/ui/kbd";
+import { Button } from "@/components/editor/inputs/Inputs";
+import { useHotkey } from "../../hooks/useHotkey";
+import { Tooltip } from "../ui/tooltip";
+import { Kbd } from "../ui/kbd";
import {
Dialog,
DialogContent,
@@ -13,11 +13,8 @@ import {
DialogOverlay,
DialogTrigger,
DialogTitle,
-} from "../components/ui/dialog";
-import {
- prettyPrintHotkey,
- renderShortcut,
-} from "../components/shortcuts/renderShortcut";
+} from "../ui/dialog";
+import { prettyPrintHotkey, renderShortcut } from "../shortcuts/renderShortcut";
import { HOTKEYS, HotkeyAction, HotkeyGroup } from "@/core/hotkeys/hotkeys";
export const KeyboardShortcuts = (): JSX.Element => {
diff --git a/frontend/src/editor/Output.tsx b/frontend/src/components/editor/Output.tsx
similarity index 96%
rename from frontend/src/editor/Output.tsx
rename to frontend/src/components/editor/Output.tsx
index 0a2301cc93..b7d5e782a6 100644
--- a/frontend/src/editor/Output.tsx
+++ b/frontend/src/components/editor/Output.tsx
@@ -3,15 +3,15 @@ import React, { useMemo } from "react";
import { OutputMessage } from "@/core/kernel/messages";
-import { logNever } from "../utils/assertNever";
+import { logNever } from "../../utils/assertNever";
import { JsonOutput } from "./output/JsonOutput";
import { HtmlOutput } from "./output/HtmlOutput";
import { ImageOutput } from "./output/ImageOutput";
import { MarimoErrorOutput } from "./output/MarimoErrorOutput";
import { TextOutput } from "./output/TextOutput";
import { VideoOutput } from "./output/VideoOutput";
-import { CellId } from "@/core/model/ids";
-import { cn } from "@/lib/utils";
+import { CellId } from "@/core/cells/ids";
+import { cn } from "@/utils/cn";
import { ErrorBoundary } from "./boundary/ErrorBoundary";
import "./output/Outputs.css";
diff --git a/frontend/src/editor/RecoveryButton.tsx b/frontend/src/components/editor/RecoveryButton.tsx
similarity index 90%
rename from frontend/src/editor/RecoveryButton.tsx
rename to frontend/src/components/editor/RecoveryButton.tsx
index 034dbd3ea7..b8c71a636f 100644
--- a/frontend/src/editor/RecoveryButton.tsx
+++ b/frontend/src/components/editor/RecoveryButton.tsx
@@ -1,17 +1,17 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { Button as EditorButton } from "@/editor/inputs/Inputs";
+import { Button as EditorButton } from "@/components/editor/inputs/Inputs";
import { Button } from "components/ui/button";
-import { useHotkey } from "../hooks/useHotkey";
+import { useHotkey } from "../../hooks/useHotkey";
import { SaveIcon } from "lucide-react";
-import { Tooltip } from "../components/ui/tooltip";
-import { renderShortcut } from "../components/shortcuts/renderShortcut";
-import { useImperativeModal } from "../components/modal/ImperativeModal";
+import { Tooltip } from "../ui/tooltip";
+import { renderShortcut } from "../shortcuts/renderShortcut";
+import { useImperativeModal } from "../modal/ImperativeModal";
import {
DialogContent,
DialogDescription,
DialogFooter,
DialogTitle,
-} from "../components/ui/dialog";
+} from "../ui/dialog";
const RecoveryModal = (props: {
proposedName: string;
diff --git a/frontend/src/editor/ShutdownButton.tsx b/frontend/src/components/editor/ShutdownButton.tsx
similarity index 94%
rename from frontend/src/editor/ShutdownButton.tsx
rename to frontend/src/components/editor/ShutdownButton.tsx
index 806b355622..92b93a134b 100644
--- a/frontend/src/editor/ShutdownButton.tsx
+++ b/frontend/src/components/editor/ShutdownButton.tsx
@@ -11,9 +11,9 @@ import {
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
-} from "../components/ui/alert-dialog";
+} from "../ui/alert-dialog";
import { Button } from "./inputs/Inputs";
-import { Tooltip } from "../components/ui/tooltip";
+import { Tooltip } from "../ui/tooltip";
interface ShutdownButtonProps {
onShutdown: (e: React.MouseEvent<HTMLButtonElement>) => void;
diff --git a/frontend/src/editor/SortableCell.tsx b/frontend/src/components/editor/SortableCell.tsx
similarity index 95%
rename from frontend/src/editor/SortableCell.tsx
rename to frontend/src/components/editor/SortableCell.tsx
index c803c59e88..fa3dddde0c 100644
--- a/frontend/src/editor/SortableCell.tsx
+++ b/frontend/src/components/editor/SortableCell.tsx
@@ -1,10 +1,10 @@
/* Copyright 2023 Marimo. All rights reserved. */
import React, { memo, useContext } from "react";
-import { mergeRefs } from "../utils/mergeRefs";
+import { mergeRefs } from "../../utils/mergeRefs";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { GripVerticalIcon } from "lucide-react";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
interface Props extends React.HTMLAttributes<HTMLDivElement> {
cellId: CellId;
diff --git a/frontend/src/editor/actions/types.ts b/frontend/src/components/editor/actions/types.ts
similarity index 100%
rename from frontend/src/editor/actions/types.ts
rename to frontend/src/components/editor/actions/types.ts
diff --git a/frontend/src/editor/actions/useCellActionButton.tsx b/frontend/src/components/editor/actions/useCellActionButton.tsx
similarity index 96%
rename from frontend/src/editor/actions/useCellActionButton.tsx
rename to frontend/src/components/editor/actions/useCellActionButton.tsx
index 81013da53b..b450f6c47a 100644
--- a/frontend/src/editor/actions/useCellActionButton.tsx
+++ b/frontend/src/components/editor/actions/useCellActionButton.tsx
@@ -2,7 +2,7 @@
import { downloadCellOutput } from "@/components/export/export-output-button";
import { Switch } from "@/components/ui/switch";
import { formatEditorViews } from "@/core/codemirror/format";
-import { useCellActions } from "@/core/state/cells";
+import { useCellActions } from "@/core/cells/cells";
import {
ImageIcon,
Code2Icon,
@@ -18,8 +18,8 @@ import {
} from "lucide-react";
import { ActionButton } from "./types";
import { MultiIcon } from "@/components/icons/multi-icon";
-import { CellConfig, CellStatus } from "@/core/model/cells";
-import { CellId } from "@/core/model/ids";
+import { CellConfig, CellStatus } from "@/core/cells/types";
+import { CellId } from "@/core/cells/ids";
import { saveCellConfig } from "@/core/network/requests";
import { EditorView } from "@codemirror/view";
import { useRunCell } from "../cell/useRunCells";
diff --git a/frontend/src/editor/actions/useNotebookActions.tsx b/frontend/src/components/editor/actions/useNotebookActions.tsx
similarity index 99%
rename from frontend/src/editor/actions/useNotebookActions.tsx
rename to frontend/src/components/editor/actions/useNotebookActions.tsx
index 1936051da0..c92ca042df 100644
--- a/frontend/src/editor/actions/useNotebookActions.tsx
+++ b/frontend/src/components/editor/actions/useNotebookActions.tsx
@@ -16,7 +16,7 @@ import {
enabledCellIds,
useCellActions,
useNotebook,
-} from "@/core/state/cells";
+} from "@/core/cells/cells";
import { saveCellConfig } from "@/core/network/requests";
import { Objects } from "@/utils/objects";
import { ActionButton } from "./types";
diff --git a/frontend/src/editor/boundary/ErrorBoundary.tsx b/frontend/src/components/editor/boundary/ErrorBoundary.tsx
similarity index 93%
rename from frontend/src/editor/boundary/ErrorBoundary.tsx
rename to frontend/src/components/editor/boundary/ErrorBoundary.tsx
index a24c88f6d9..66824892ec 100644
--- a/frontend/src/editor/boundary/ErrorBoundary.tsx
+++ b/frontend/src/components/editor/boundary/ErrorBoundary.tsx
@@ -4,7 +4,7 @@ import {
ErrorBoundary as ReactErrorBoundary,
FallbackProps,
} from "react-error-boundary";
-import { Button } from "../../components/ui/button";
+import { Button } from "../../ui/button";
export const ErrorBoundary: React.FC<PropsWithChildren> = (props) => {
return (
diff --git a/frontend/src/editor/cell/CellStatus.tsx b/frontend/src/components/editor/cell/CellStatus.tsx
similarity index 97%
rename from frontend/src/editor/cell/CellStatus.tsx
rename to frontend/src/components/editor/cell/CellStatus.tsx
index 98038d3563..ca70ffe0be 100644
--- a/frontend/src/editor/cell/CellStatus.tsx
+++ b/frontend/src/components/editor/cell/CellStatus.tsx
@@ -5,9 +5,9 @@ import {
WorkflowIcon,
RefreshCwIcon,
} from "lucide-react";
-import { Tooltip } from "../../components/ui/tooltip";
-import { CellStatus } from "../../core/model/cells";
-import { useElapsedTime } from "../../hooks/useElapsedTime";
+import { Tooltip } from "../../ui/tooltip";
+import { CellStatus } from "../../../core/cells/types";
+import { useElapsedTime } from "../../../hooks/useElapsedTime";
import { Logger } from "@/utils/Logger";
import { MultiIcon } from "@/components/icons/multi-icon";
diff --git a/frontend/src/editor/cell/CreateCellButton.tsx b/frontend/src/components/editor/cell/CreateCellButton.tsx
similarity index 86%
rename from frontend/src/editor/cell/CreateCellButton.tsx
rename to frontend/src/components/editor/cell/CreateCellButton.tsx
index eace93c868..3249509695 100644
--- a/frontend/src/editor/cell/CreateCellButton.tsx
+++ b/frontend/src/components/editor/cell/CreateCellButton.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { PlusIcon } from "lucide-react";
-import { Button } from "@/editor/inputs/Inputs";
-import { Tooltip } from "../../components/ui/tooltip";
+import { Button } from "@/components/editor/inputs/Inputs";
+import { Tooltip } from "../../ui/tooltip";
export const CreateCellButton = ({
appClosed,
diff --git a/frontend/src/editor/cell/DeleteButton.tsx b/frontend/src/components/editor/cell/DeleteButton.tsx
similarity index 86%
rename from frontend/src/editor/cell/DeleteButton.tsx
rename to frontend/src/components/editor/cell/DeleteButton.tsx
index eb63cfbe9e..9027b5e3b7 100644
--- a/frontend/src/editor/cell/DeleteButton.tsx
+++ b/frontend/src/components/editor/cell/DeleteButton.tsx
@@ -1,9 +1,9 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { Trash2Icon } from "lucide-react";
-import { Tooltip } from "../../components/ui/tooltip";
-import { CellStatus } from "../../core/model/cells";
-import { Button } from "../../components/ui/button";
-import { cn } from "../../lib/utils";
+import { Tooltip } from "../../ui/tooltip";
+import { CellStatus } from "../../../core/cells/types";
+import { Button } from "../../ui/button";
+import { cn } from "../../../utils/cn";
export const DeleteButton = (props: {
status: CellStatus;
diff --git a/frontend/src/editor/cell/RunButton.tsx b/frontend/src/components/editor/cell/RunButton.tsx
similarity index 92%
rename from frontend/src/editor/cell/RunButton.tsx
rename to frontend/src/components/editor/cell/RunButton.tsx
index eb66630f84..a929e9c2d1 100644
--- a/frontend/src/editor/cell/RunButton.tsx
+++ b/frontend/src/components/editor/cell/RunButton.tsx
@@ -1,10 +1,10 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { HardDriveDownloadIcon, PlayIcon, SquareIcon } from "lucide-react";
-import { Button } from "@/editor/inputs/Inputs";
-import { Tooltip } from "../../components/ui/tooltip";
-import { renderShortcut } from "../../components/shortcuts/renderShortcut";
-import { cn } from "../../lib/utils";
-import { CellConfig, CellStatus } from "../../core/model/cells";
+import { Button } from "@/components/editor/inputs/Inputs";
+import { Tooltip } from "../../ui/tooltip";
+import { renderShortcut } from "../../shortcuts/renderShortcut";
+import { cn } from "../../../utils/cn";
+import { CellConfig, CellStatus } from "../../../core/cells/types";
import { sendInterrupt } from "@/core/network/requests";
import { useShouldShowInterrupt } from "./useShouldShowInterrupt";
diff --git a/frontend/src/editor/cell/TinyCode.css b/frontend/src/components/editor/cell/TinyCode.css
similarity index 100%
rename from frontend/src/editor/cell/TinyCode.css
rename to frontend/src/components/editor/cell/TinyCode.css
diff --git a/frontend/src/editor/cell/TinyCode.tsx b/frontend/src/components/editor/cell/TinyCode.tsx
similarity index 100%
rename from frontend/src/editor/cell/TinyCode.tsx
rename to frontend/src/components/editor/cell/TinyCode.tsx
diff --git a/frontend/src/editor/cell/cell-actions.tsx b/frontend/src/components/editor/cell/cell-actions.tsx
similarity index 100%
rename from frontend/src/editor/cell/cell-actions.tsx
rename to frontend/src/components/editor/cell/cell-actions.tsx
diff --git a/frontend/src/editor/cell/cell-context-menu.tsx b/frontend/src/components/editor/cell/cell-context-menu.tsx
similarity index 100%
rename from frontend/src/editor/cell/cell-context-menu.tsx
rename to frontend/src/components/editor/cell/cell-context-menu.tsx
diff --git a/frontend/src/editor/cell/cell-status.css b/frontend/src/components/editor/cell/cell-status.css
similarity index 100%
rename from frontend/src/editor/cell/cell-status.css
rename to frontend/src/components/editor/cell/cell-status.css
diff --git a/frontend/src/editor/cell/useRunCells.ts b/frontend/src/components/editor/cell/useRunCells.ts
similarity index 92%
rename from frontend/src/editor/cell/useRunCells.ts
rename to frontend/src/components/editor/cell/useRunCells.ts
index 66efadb850..5d67cc7200 100644
--- a/frontend/src/editor/cell/useRunCells.ts
+++ b/frontend/src/components/editor/cell/useRunCells.ts
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { RuntimeState } from "@/core/RuntimeState";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
import { sendRun } from "@/core/network/requests";
-import { staleCellIds, useNotebook } from "@/core/state/cells";
+import { staleCellIds, useNotebook } from "@/core/cells/cells";
import { derefNotNull } from "@/utils/dereference";
import useEvent from "react-use-event-hook";
diff --git a/frontend/src/editor/cell/useShouldShowInterrupt.ts b/frontend/src/components/editor/cell/useShouldShowInterrupt.ts
similarity index 100%
rename from frontend/src/editor/cell/useShouldShowInterrupt.ts
rename to frontend/src/components/editor/cell/useShouldShowInterrupt.ts
diff --git a/frontend/src/editor/chrome/panels/dependency-graph-panel.tsx b/frontend/src/components/editor/chrome/panels/dependency-graph-panel.tsx
similarity index 73%
rename from frontend/src/editor/chrome/panels/dependency-graph-panel.tsx
rename to frontend/src/components/editor/chrome/panels/dependency-graph-panel.tsx
index 35324d61c3..5b3df9a3d0 100644
--- a/frontend/src/editor/chrome/panels/dependency-graph-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/dependency-graph-panel.tsx
@@ -1,9 +1,9 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { useCellDataAtoms, useCellIds } from "@/core/state/cells";
+import { useCellDataAtoms, useCellIds } from "@/core/cells/cells";
import { useVariables } from "@/core/variables/state";
import React from "react";
-import { DependencyGraph } from "../../../components/dependency-graph/dependency-graph";
-import { cn } from "@/lib/utils";
+import { DependencyGraph } from "../../../dependency-graph/dependency-graph";
+import { cn } from "@/utils/cn";
export const DependencyGraphPanel: React.FC = () => {
const variables = useVariables();
diff --git a/frontend/src/editor/chrome/panels/error-panel.tsx b/frontend/src/components/editor/chrome/panels/error-panel.tsx
similarity index 89%
rename from frontend/src/editor/chrome/panels/error-panel.tsx
rename to frontend/src/components/editor/chrome/panels/error-panel.tsx
index 28564b0b99..012d39eb82 100644
--- a/frontend/src/editor/chrome/panels/error-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/error-panel.tsx
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import React from "react";
-import { useCellErrors } from "../../../core/state/cells";
+import { useCellErrors } from "../../../../core/cells/cells";
import { MarimoErrorOutput } from "../../output/MarimoErrorOutput";
-import { CellLinkError } from "@/editor/links/cell-link";
+import { CellLinkError } from "@/components/editor/links/cell-link";
import { PartyPopperIcon } from "lucide-react";
export const ErrorsPanel: React.FC = () => {
diff --git a/frontend/src/editor/chrome/panels/outline-panel.css b/frontend/src/components/editor/chrome/panels/outline-panel.css
similarity index 100%
rename from frontend/src/editor/chrome/panels/outline-panel.css
rename to frontend/src/components/editor/chrome/panels/outline-panel.css
diff --git a/frontend/src/editor/chrome/panels/outline-panel.tsx b/frontend/src/components/editor/chrome/panels/outline-panel.tsx
similarity index 95%
rename from frontend/src/editor/chrome/panels/outline-panel.tsx
rename to frontend/src/components/editor/chrome/panels/outline-panel.tsx
index 1ca576faba..4d705224e2 100644
--- a/frontend/src/editor/chrome/panels/outline-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/outline-panel.tsx
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import React from "react";
-import { notebookOutline } from "../../../core/state/cells";
+import { notebookOutline } from "../../../../core/cells/cells";
import { useAtomValue } from "jotai";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { ScrollTextIcon } from "lucide-react";
import "./outline-panel.css";
diff --git a/frontend/src/editor/chrome/panels/variable-panel.tsx b/frontend/src/components/editor/chrome/panels/variable-panel.tsx
similarity index 89%
rename from frontend/src/editor/chrome/panels/variable-panel.tsx
rename to frontend/src/components/editor/chrome/panels/variable-panel.tsx
index 5148711191..08083b9d1c 100644
--- a/frontend/src/editor/chrome/panels/variable-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/variable-panel.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { VariableTable } from "@/components/variables/variables-table";
-import { useCellIds } from "@/core/state/cells";
+import { useCellIds } from "@/core/cells/cells";
import { useVariables } from "@/core/variables/state";
import React from "react";
diff --git a/frontend/src/editor/chrome/state.ts b/frontend/src/components/editor/chrome/state.ts
similarity index 100%
rename from frontend/src/editor/chrome/state.ts
rename to frontend/src/components/editor/chrome/state.ts
diff --git a/frontend/src/editor/chrome/types.ts b/frontend/src/components/editor/chrome/types.ts
similarity index 100%
rename from frontend/src/editor/chrome/types.ts
rename to frontend/src/components/editor/chrome/types.ts
diff --git a/frontend/src/editor/chrome/wrapper/__tests__/storage.test.ts b/frontend/src/components/editor/chrome/wrapper/__tests__/storage.test.ts
similarity index 100%
rename from frontend/src/editor/chrome/wrapper/__tests__/storage.test.ts
rename to frontend/src/components/editor/chrome/wrapper/__tests__/storage.test.ts
diff --git a/frontend/src/editor/chrome/wrapper/app-chrome.css b/frontend/src/components/editor/chrome/wrapper/app-chrome.css
similarity index 100%
rename from frontend/src/editor/chrome/wrapper/app-chrome.css
rename to frontend/src/components/editor/chrome/wrapper/app-chrome.css
diff --git a/frontend/src/editor/chrome/wrapper/app-chrome.tsx b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
similarity index 97%
rename from frontend/src/editor/chrome/wrapper/app-chrome.tsx
rename to frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
index 7f30409acf..7f493abbef 100644
--- a/frontend/src/editor/chrome/wrapper/app-chrome.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
@@ -9,13 +9,13 @@ import {
import { Footer } from "./footer";
import "./app-chrome.css";
import { useChromeActions, useChromeState } from "../state";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { createStorage } from "./storage";
import { Button } from "@/components/ui/button";
import { XIcon } from "lucide-react";
import { ErrorsPanel } from "../panels/error-panel";
import { OutlinePanel } from "../panels/outline-panel";
-import { DependencyGraphPanel } from "@/editor/chrome/panels/dependency-graph-panel";
+import { DependencyGraphPanel } from "@/components/editor/chrome/panels/dependency-graph-panel";
import { VariablePanel } from "../panels/variable-panel";
export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
diff --git a/frontend/src/editor/chrome/wrapper/footer.tsx b/frontend/src/components/editor/chrome/wrapper/footer.tsx
similarity index 97%
rename from frontend/src/editor/chrome/wrapper/footer.tsx
rename to frontend/src/components/editor/chrome/wrapper/footer.tsx
index 01c721d699..4d16285013 100644
--- a/frontend/src/editor/chrome/wrapper/footer.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer.tsx
@@ -8,11 +8,11 @@ import {
ScrollTextIcon,
NetworkIcon,
} from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { useChromeActions, useChromeState } from "../state";
import { Tooltip } from "@/components/ui/tooltip";
import { useAtomValue } from "jotai";
-import { cellErrorCount } from "@/core/state/cells";
+import { cellErrorCount } from "@/core/cells/cells";
export const Footer: React.FC = () => {
const { selectedPanel, panelLocation } = useChromeState();
diff --git a/frontend/src/editor/chrome/wrapper/storage.ts b/frontend/src/components/editor/chrome/wrapper/storage.ts
similarity index 100%
rename from frontend/src/editor/chrome/wrapper/storage.ts
rename to frontend/src/components/editor/chrome/wrapper/storage.ts
diff --git a/frontend/src/editor/inputs/Inputs.css b/frontend/src/components/editor/inputs/Inputs.css
similarity index 100%
rename from frontend/src/editor/inputs/Inputs.css
rename to frontend/src/components/editor/inputs/Inputs.css
diff --git a/frontend/src/editor/inputs/Inputs.styles.ts b/frontend/src/components/editor/inputs/Inputs.styles.ts
similarity index 100%
rename from frontend/src/editor/inputs/Inputs.styles.ts
rename to frontend/src/components/editor/inputs/Inputs.styles.ts
diff --git a/frontend/src/editor/inputs/Inputs.tsx b/frontend/src/components/editor/inputs/Inputs.tsx
similarity index 100%
rename from frontend/src/editor/inputs/Inputs.tsx
rename to frontend/src/components/editor/inputs/Inputs.tsx
diff --git a/frontend/src/editor/links/cell-link.tsx b/frontend/src/components/editor/links/cell-link.tsx
similarity index 92%
rename from frontend/src/editor/links/cell-link.tsx
rename to frontend/src/components/editor/links/cell-link.tsx
index b6187b14c8..94fd74955c 100644
--- a/frontend/src/editor/links/cell-link.tsx
+++ b/frontend/src/components/editor/links/cell-link.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { CellId, HTMLCellId } from "@/core/model/ids";
-import { Logger } from "../../utils/Logger";
-import { cn } from "@/lib/utils";
+import { CellId, HTMLCellId } from "@/core/cells/ids";
+import { Logger } from "../../../utils/Logger";
+import { cn } from "@/utils/cn";
interface Props {
cellId: CellId;
diff --git a/frontend/src/editor/notebook-menu-dropdown.tsx b/frontend/src/components/editor/notebook-menu-dropdown.tsx
similarity index 91%
rename from frontend/src/editor/notebook-menu-dropdown.tsx
rename to frontend/src/components/editor/notebook-menu-dropdown.tsx
index f4dee3e70a..5adf6b4df4 100644
--- a/frontend/src/editor/notebook-menu-dropdown.tsx
+++ b/frontend/src/components/editor/notebook-menu-dropdown.tsx
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { Button } from "@/editor/inputs/Inputs";
+import { Button } from "@/components/editor/inputs/Inputs";
import { MenuIcon } from "lucide-react";
import React from "react";
import {
@@ -8,7 +8,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { renderMinimalShortcut } from "../components/shortcuts/renderShortcut";
+import { renderMinimalShortcut } from "../shortcuts/renderShortcut";
import { useNotebookActions } from "./actions/useNotebookActions";
interface Props {
diff --git a/frontend/src/editor/output/CalloutOutput.styles.ts b/frontend/src/components/editor/output/CalloutOutput.styles.ts
similarity index 100%
rename from frontend/src/editor/output/CalloutOutput.styles.ts
rename to frontend/src/components/editor/output/CalloutOutput.styles.ts
diff --git a/frontend/src/editor/output/CalloutOutput.tsx b/frontend/src/components/editor/output/CalloutOutput.tsx
similarity index 100%
rename from frontend/src/editor/output/CalloutOutput.tsx
rename to frontend/src/components/editor/output/CalloutOutput.tsx
diff --git a/frontend/src/editor/output/ConsoleOutput.tsx b/frontend/src/components/editor/output/ConsoleOutput.tsx
similarity index 95%
rename from frontend/src/editor/output/ConsoleOutput.tsx
rename to frontend/src/components/editor/output/ConsoleOutput.tsx
index bd286191d0..287e4477d4 100644
--- a/frontend/src/editor/output/ConsoleOutput.tsx
+++ b/frontend/src/components/editor/output/ConsoleOutput.tsx
@@ -2,7 +2,7 @@
import React from "react";
import { OutputMessage } from "@/core/kernel/messages";
import { formatOutput } from "../Output";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Props {
consoleOutputs: OutputMessage[];
diff --git a/frontend/src/editor/output/EmotionCacheProvider.tsx b/frontend/src/components/editor/output/EmotionCacheProvider.tsx
similarity index 100%
rename from frontend/src/editor/output/EmotionCacheProvider.tsx
rename to frontend/src/components/editor/output/EmotionCacheProvider.tsx
diff --git a/frontend/src/editor/output/HtmlOutput.tsx b/frontend/src/components/editor/output/HtmlOutput.tsx
similarity index 94%
rename from frontend/src/editor/output/HtmlOutput.tsx
rename to frontend/src/components/editor/output/HtmlOutput.tsx
index d323f22ddd..fde7cc0a3c 100644
--- a/frontend/src/editor/output/HtmlOutput.tsx
+++ b/frontend/src/components/editor/output/HtmlOutput.tsx
@@ -1,9 +1,9 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { memo, useLayoutEffect, useRef } from "react";
import { lookupScript, updateScriptCache } from "./scripts";
-import { Logger } from "../../utils/Logger";
-import { renderHTML } from "../../plugins/core/RenderHTML";
-import { cn } from "../../lib/utils";
+import { Logger } from "../../../utils/Logger";
+import { renderHTML } from "../../../plugins/core/RenderHTML";
+import { cn } from "../../../utils/cn";
interface Props {
html: string;
diff --git a/frontend/src/editor/output/ImageOutput.tsx b/frontend/src/components/editor/output/ImageOutput.tsx
similarity index 100%
rename from frontend/src/editor/output/ImageOutput.tsx
rename to frontend/src/components/editor/output/ImageOutput.tsx
diff --git a/frontend/src/editor/output/JsonOutput.tsx b/frontend/src/components/editor/output/JsonOutput.tsx
similarity index 96%
rename from frontend/src/editor/output/JsonOutput.tsx
rename to frontend/src/components/editor/output/JsonOutput.tsx
index 6079c3fc70..ae0ff6a9c3 100644
--- a/frontend/src/editor/output/JsonOutput.tsx
+++ b/frontend/src/components/editor/output/JsonOutput.tsx
@@ -6,8 +6,8 @@ import { HtmlOutput } from "./HtmlOutput";
import { ImageOutput } from "./ImageOutput";
import { TextOutput } from "./TextOutput";
import { VideoOutput } from "./VideoOutput";
-import { logNever } from "../../utils/assertNever";
-import { useThemeForPlugin } from "../../theme/useTheme";
+import { logNever } from "../../../utils/assertNever";
+import { useThemeForPlugin } from "../../../theme/useTheme";
interface Props {
/**
diff --git a/frontend/src/editor/output/MarimoErrorOutput.tsx b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
similarity index 94%
rename from frontend/src/editor/output/MarimoErrorOutput.tsx
rename to frontend/src/components/editor/output/MarimoErrorOutput.tsx
index 3414ca24d8..3279764f07 100644
--- a/frontend/src/editor/output/MarimoErrorOutput.tsx
+++ b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
@@ -1,10 +1,10 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { cn } from "../../lib/utils";
-import { logNever } from "../../utils/assertNever";
-import { MarimoError } from "../../core/kernel/messages";
-import { Alert } from "../../components/ui/alert";
-import { AlertTitle } from "../../components/ui/alert";
+import { cn } from "../../../utils/cn";
+import { logNever } from "../../../utils/assertNever";
+import { MarimoError } from "../../../core/kernel/messages";
+import { Alert } from "../../ui/alert";
+import { AlertTitle } from "../../ui/alert";
import {
Accordion,
diff --git a/frontend/src/editor/output/Outputs.css b/frontend/src/components/editor/output/Outputs.css
similarity index 100%
rename from frontend/src/editor/output/Outputs.css
rename to frontend/src/components/editor/output/Outputs.css
diff --git a/frontend/src/editor/output/TextOutput.tsx b/frontend/src/components/editor/output/TextOutput.tsx
similarity index 92%
rename from frontend/src/editor/output/TextOutput.tsx
rename to frontend/src/components/editor/output/TextOutput.tsx
index 3606b7bdce..3b2dc2fb46 100644
--- a/frontend/src/editor/output/TextOutput.tsx
+++ b/frontend/src/components/editor/output/TextOutput.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { OutputChannel } from "@/core/kernel/messages";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Props {
text: string;
diff --git a/frontend/src/editor/output/VideoOutput.tsx b/frontend/src/components/editor/output/VideoOutput.tsx
similarity index 100%
rename from frontend/src/editor/output/VideoOutput.tsx
rename to frontend/src/components/editor/output/VideoOutput.tsx
diff --git a/frontend/src/editor/output/scripts.ts b/frontend/src/components/editor/output/scripts.ts
similarity index 100%
rename from frontend/src/editor/output/scripts.ts
rename to frontend/src/components/editor/output/scripts.ts
diff --git a/frontend/src/editor/renderers/CellArray.tsx b/frontend/src/components/editor/renderers/CellArray.tsx
similarity index 85%
rename from frontend/src/editor/renderers/CellArray.tsx
rename to frontend/src/components/editor/renderers/CellArray.tsx
index 1fa2acac70..f66faab7cf 100644
--- a/frontend/src/editor/renderers/CellArray.tsx
+++ b/frontend/src/components/editor/renderers/CellArray.tsx
@@ -1,20 +1,23 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { useEffect } from "react";
import { sendDeleteCell } from "@/core/network/requests";
-import { Cell } from "editor/Cell";
-import { RuntimeState } from "../../core/RuntimeState";
-import { ConnectionStatus, WebSocketState } from "../../core/websocket/types";
+import { Cell } from "@/components/editor/Cell";
+import { RuntimeState } from "../../../core/RuntimeState";
+import {
+ ConnectionStatus,
+ WebSocketState,
+} from "../../../core/websocket/types";
import {
NotebookState,
flattenNotebookCells,
useCellActions,
-} from "../../core/state/cells";
-import { AppConfig, UserConfig } from "../../core/config/config";
-import { AppMode } from "../../core/mode";
-import { useHotkey } from "../../hooks/useHotkey";
-import { useEvent } from "../../hooks/useEvent";
-import { formatAll } from "../../core/codemirror/format";
-import { useTheme } from "../../theme/useTheme";
+} from "../../../core/cells/cells";
+import { AppConfig, UserConfig } from "../../../core/config/config-schema";
+import { AppMode } from "../../../core/mode";
+import { useHotkey } from "../../../hooks/useHotkey";
+import { useEvent } from "../../../hooks/useEvent";
+import { formatAll } from "../../../core/codemirror/format";
+import { useTheme } from "../../../theme/useTheme";
import { VerticalLayoutWrapper } from "./vertical-layout/vertical-layout-wrapper";
import { useDelayVisibility } from "./vertical-layout/useDelayVisiblity";
import { useChromeActions } from "../chrome/state";
diff --git a/frontend/src/editor/renderers/cells-renderer.tsx b/frontend/src/components/editor/renderers/cells-renderer.tsx
similarity index 86%
rename from frontend/src/editor/renderers/cells-renderer.tsx
rename to frontend/src/components/editor/renderers/cells-renderer.tsx
index 5388d3c56f..7eb53a5d24 100644
--- a/frontend/src/editor/renderers/cells-renderer.tsx
+++ b/frontend/src/components/editor/renderers/cells-renderer.tsx
@@ -1,10 +1,10 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { flattenNotebookCells, useNotebook } from "@/core/state/cells";
+import { flattenNotebookCells, useNotebook } from "@/core/cells/cells";
import React, { PropsWithChildren, memo } from "react";
import { cellRendererPlugins } from "./plugins";
-import { AppConfig } from "@/core/config/config";
+import { AppConfig } from "@/core/config/config-schema";
import { AppMode } from "@/core/mode";
-import { layoutDataAtom, layoutViewAtom } from "@/core/state/layout";
+import { layoutDataAtom, layoutViewAtom } from "@/core/layout/layout";
import { useAtom } from "jotai";
interface Props {
diff --git a/frontend/src/editor/renderers/grid-layout/grid-layout.tsx b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
similarity index 97%
rename from frontend/src/editor/renderers/grid-layout/grid-layout.tsx
rename to frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
index 1be508c355..646452dbb0 100644
--- a/frontend/src/editor/renderers/grid-layout/grid-layout.tsx
+++ b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
@@ -7,18 +7,18 @@ import {
SerializedGridLayout,
SerializedGridLayoutCell,
} from "./types";
-import { OutputArea } from "@/editor/Output";
-import { CellRuntimeState } from "@/core/model/cells";
+import { OutputArea } from "@/components/editor/Output";
+import { CellRuntimeState } from "@/core/cells/types";
import "react-grid-layout/css/styles.css";
import "./styles.css";
import { Logger } from "@/utils/Logger";
import { z } from "zod";
import { Maps } from "@/utils/maps";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
import { AppMode } from "@/core/mode";
-import { TinyCode } from "@/editor/cell/TinyCode";
-import { cn } from "@/lib/utils";
+import { TinyCode } from "@/components/editor/cell/TinyCode";
+import { cn } from "@/utils/cn";
import { LockIcon, XIcon } from "lucide-react";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
diff --git a/frontend/src/editor/renderers/grid-layout/styles.css b/frontend/src/components/editor/renderers/grid-layout/styles.css
similarity index 100%
rename from frontend/src/editor/renderers/grid-layout/styles.css
rename to frontend/src/components/editor/renderers/grid-layout/styles.css
diff --git a/frontend/src/editor/renderers/grid-layout/types.ts b/frontend/src/components/editor/renderers/grid-layout/types.ts
similarity index 100%
rename from frontend/src/editor/renderers/grid-layout/types.ts
rename to frontend/src/components/editor/renderers/grid-layout/types.ts
diff --git a/frontend/src/editor/renderers/layout-select.tsx b/frontend/src/components/editor/renderers/layout-select.tsx
similarity index 97%
rename from frontend/src/editor/renderers/layout-select.tsx
rename to frontend/src/components/editor/renderers/layout-select.tsx
index e0e6bd07f5..6abdb5e874 100644
--- a/frontend/src/editor/renderers/layout-select.tsx
+++ b/frontend/src/components/editor/renderers/layout-select.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import React from "react";
-import { layoutViewAtom } from "@/core/state/layout";
+import { layoutViewAtom } from "@/core/layout/layout";
import { useAtom } from "jotai";
import {
Select,
diff --git a/frontend/src/editor/renderers/plugins.ts b/frontend/src/components/editor/renderers/plugins.ts
similarity index 93%
rename from frontend/src/editor/renderers/plugins.ts
rename to frontend/src/components/editor/renderers/plugins.ts
index 03cfe3ca45..6c90875a90 100644
--- a/frontend/src/editor/renderers/plugins.ts
+++ b/frontend/src/components/editor/renderers/plugins.ts
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { GridLayoutPlugin } from "./grid-layout/grid-layout";
import { ICellRendererPlugin, LayoutType } from "./types";
-import { CellData } from "@/core/model/cells";
+import { CellData } from "@/core/cells/types";
// If more renderers are added, we may want to consider lazy loading them.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/frontend/src/editor/renderers/types.ts b/frontend/src/components/editor/renderers/types.ts
similarity index 92%
rename from frontend/src/editor/renderers/types.ts
rename to frontend/src/components/editor/renderers/types.ts
index 4cf96d95e0..6d7d31dba5 100644
--- a/frontend/src/editor/renderers/types.ts
+++ b/frontend/src/components/editor/renderers/types.ts
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { AppConfig } from "@/core/config/config";
-import { CellData, CellRuntimeState } from "@/core/model/cells";
+import { AppConfig } from "@/core/config/config-schema";
+import { CellData, CellRuntimeState } from "@/core/cells/types";
import { ZodType, ZodTypeDef } from "zod";
import { AppMode } from "@/core/mode";
diff --git a/frontend/src/editor/renderers/vertical-layout/useDelayVisiblity.ts b/frontend/src/components/editor/renderers/vertical-layout/useDelayVisiblity.ts
similarity index 95%
rename from frontend/src/editor/renderers/vertical-layout/useDelayVisiblity.ts
rename to frontend/src/components/editor/renderers/vertical-layout/useDelayVisiblity.ts
index 5de7eda094..1c5fdebf08 100644
--- a/frontend/src/editor/renderers/vertical-layout/useDelayVisiblity.ts
+++ b/frontend/src/components/editor/renderers/vertical-layout/useDelayVisiblity.ts
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { AppMode } from "@/core/mode";
-import { getAllEditorViews } from "@/core/state/cells";
+import { getAllEditorViews } from "@/core/cells/cells";
import { useState, useEffect } from "react";
export function useDelayVisibility(numCells: number, mode: AppMode) {
diff --git a/frontend/src/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
similarity index 87%
rename from frontend/src/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
rename to frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
index c0ac95f33d..343e740bb6 100644
--- a/frontend/src/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { PropsWithChildren } from "react";
-import { cn } from "@/lib/utils";
-import { AppConfig } from "@/core/config/config";
+import { cn } from "@/utils/cn";
+import { AppConfig } from "@/core/config/config-schema";
interface Props {
appConfig: AppConfig;
diff --git a/frontend/src/editor/renderers/vertical-layout/vertical-layout.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
similarity index 93%
rename from frontend/src/editor/renderers/vertical-layout/vertical-layout.tsx
rename to frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
index 27daa6b949..601d651f64 100644
--- a/frontend/src/editor/renderers/vertical-layout/vertical-layout.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { memo, useRef } from "react";
-import { CellRuntimeState } from "@/core/model/cells";
-import { CellId, HTMLCellId } from "@/core/model/ids";
-import { OutputArea } from "@/editor/Output";
+import { CellRuntimeState } from "@/core/cells/types";
+import { CellId, HTMLCellId } from "@/core/cells/ids";
+import { OutputArea } from "@/components/editor/Output";
import clsx from "clsx";
import { ICellRendererPlugin, ICellRendererProps } from "../types";
import { VerticalLayoutWrapper } from "./vertical-layout-wrapper";
diff --git a/frontend/src/components/export/export-output-button.tsx b/frontend/src/components/export/export-output-button.tsx
index 042b649411..927edee04e 100644
--- a/frontend/src/components/export/export-output-button.tsx
+++ b/frontend/src/components/export/export-output-button.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { downloadHTMLAsImage } from "@/utils/download";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
export function downloadCellOutput(cellId: CellId) {
const output = document.getElementById(`output-${cellId}`);
diff --git a/frontend/src/components/forms/switchable-multi-select.tsx b/frontend/src/components/forms/switchable-multi-select.tsx
index f4bf872df1..9bc4363a74 100644
--- a/frontend/src/components/forms/switchable-multi-select.tsx
+++ b/frontend/src/components/forms/switchable-multi-select.tsx
@@ -5,7 +5,7 @@ import { Combobox, ComboboxItem } from "../ui/combobox";
import { Tooltip } from "../ui/tooltip";
import { EditIcon } from "lucide-react";
import { Toggle } from "../ui/toggle";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Props {
options: string[];
diff --git a/frontend/src/components/shortcuts/renderShortcut.tsx b/frontend/src/components/shortcuts/renderShortcut.tsx
index c366032737..d7f49c4835 100644
--- a/frontend/src/components/shortcuts/renderShortcut.tsx
+++ b/frontend/src/components/shortcuts/renderShortcut.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { HotkeyAction, HOTKEYS } from "@/core/hotkeys/hotkeys";
-import { isPlatformMac } from "@/core/shortcuts/shortcuts";
+import { isPlatformMac } from "@/core/hotkeys/shortcuts";
import { Kbd } from "../ui/kbd";
import { DropdownMenuShortcut } from "../ui/dropdown-menu";
diff --git a/frontend/src/components/sort/SortableCellsProvider.tsx b/frontend/src/components/sort/SortableCellsProvider.tsx
index b6f4186f93..ba37d2f25c 100644
--- a/frontend/src/components/sort/SortableCellsProvider.tsx
+++ b/frontend/src/components/sort/SortableCellsProvider.tsx
@@ -15,9 +15,9 @@ import {
sortableKeyboardCoordinates,
verticalListSortingStrategy,
} from "@dnd-kit/sortable";
-import { useCellActions, useNotebook } from "../../core/state/cells";
+import { useCellActions, useNotebook } from "../../core/cells/cells";
import { useEvent } from "../../hooks/useEvent";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
interface SortableCellsProviderProps {
children: React.ReactNode;
diff --git a/frontend/src/components/ui/accordion.tsx b/frontend/src/components/ui/accordion.tsx
index 479d461fc4..2a3e07f0e5 100644
--- a/frontend/src/components/ui/accordion.tsx
+++ b/frontend/src/components/ui/accordion.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import * as AccordionPrimitive from "@radix-ui/react-accordion";
import { ChevronDown } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const Accordion = AccordionPrimitive.Root;
diff --git a/frontend/src/components/ui/alert-dialog.tsx b/frontend/src/components/ui/alert-dialog.tsx
index 76997c3e4f..9275c00e82 100644
--- a/frontend/src/components/ui/alert-dialog.tsx
+++ b/frontend/src/components/ui/alert-dialog.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { buttonVariants } from "@/components/ui/button";
import { useRestoreFocus } from "./use-restore-focus";
diff --git a/frontend/src/components/ui/alert.tsx b/frontend/src/components/ui/alert.tsx
index bc05c0b851..9463527950 100644
--- a/frontend/src/components/ui/alert.tsx
+++ b/frontend/src/components/ui/alert.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import { VariantProps, cva } from "class-variance-authority";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const alertVariants = cva(
"relative w-full rounded-lg border p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11",
diff --git a/frontend/src/components/ui/badge.tsx b/frontend/src/components/ui/badge.tsx
index 026e666610..dd0ac9df59 100644
--- a/frontend/src/components/ui/badge.tsx
+++ b/frontend/src/components/ui/badge.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import { VariantProps, cva } from "class-variance-authority";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const badgeVariants = cva(
"inline-flex items-center border rounded-full px-2 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
diff --git a/frontend/src/components/ui/button.tsx b/frontend/src/components/ui/button.tsx
index 0a65a20afc..33ef514f60 100644
--- a/frontend/src/components/ui/button.tsx
+++ b/frontend/src/components/ui/button.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { VariantProps, cva } from "class-variance-authority";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const activeCommon = "active:shadow-xsSolid";
diff --git a/frontend/src/components/ui/calendar.tsx b/frontend/src/components/ui/calendar.tsx
index 9ce060b12f..2ae628a31e 100644
--- a/frontend/src/components/ui/calendar.tsx
+++ b/frontend/src/components/ui/calendar.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import { ChevronLeft, ChevronRight } from "lucide-react";
import { DayPicker } from "react-day-picker";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { buttonVariants } from "@/components/ui/button";
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
diff --git a/frontend/src/components/ui/checkbox.tsx b/frontend/src/components/ui/checkbox.tsx
index c635cdd429..4ec53516e4 100644
--- a/frontend/src/components/ui/checkbox.tsx
+++ b/frontend/src/components/ui/checkbox.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import { Check } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const Checkbox = React.forwardRef<
React.ElementRef<typeof CheckboxPrimitive.Root>,
diff --git a/frontend/src/components/ui/combobox.tsx b/frontend/src/components/ui/combobox.tsx
index 75c8fa191e..f9274b265e 100644
--- a/frontend/src/components/ui/combobox.tsx
+++ b/frontend/src/components/ui/combobox.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { ChevronDownIcon, Check, XCircle } from "lucide-react";
import { createContext, useContext } from "react";
-import { cn } from "../../lib/utils";
+import { cn } from "../../utils/cn";
import { useControllableState } from "@radix-ui/react-use-controllable-state";
import {
Command,
diff --git a/frontend/src/components/ui/command.tsx b/frontend/src/components/ui/command.tsx
index dd10c3e9a1..b2a5937eb3 100644
--- a/frontend/src/components/ui/command.tsx
+++ b/frontend/src/components/ui/command.tsx
@@ -4,7 +4,7 @@ import { DialogProps } from "@radix-ui/react-dialog";
import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { Dialog, DialogContent } from "@/components/ui/dialog";
import {
MenuShortcut,
diff --git a/frontend/src/components/ui/context-menu.tsx b/frontend/src/components/ui/context-menu.tsx
index cff3f49b8d..1bbe0ddc03 100644
--- a/frontend/src/components/ui/context-menu.tsx
+++ b/frontend/src/components/ui/context-menu.tsx
@@ -7,7 +7,7 @@ import {
DotFilledIcon,
} from "@radix-ui/react-icons";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import {
MenuShortcut,
menuContentCommon,
diff --git a/frontend/src/components/ui/dialog.tsx b/frontend/src/components/ui/dialog.tsx
index 7a722b2e4e..208a635c02 100644
--- a/frontend/src/components/ui/dialog.tsx
+++ b/frontend/src/components/ui/dialog.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { useRestoreFocus } from "./use-restore-focus";
const Dialog = DialogPrimitive.Root;
diff --git a/frontend/src/components/ui/dropdown-menu.tsx b/frontend/src/components/ui/dropdown-menu.tsx
index 3460b9ab99..f608059c83 100644
--- a/frontend/src/components/ui/dropdown-menu.tsx
+++ b/frontend/src/components/ui/dropdown-menu.tsx
@@ -10,7 +10,7 @@ import {
menuSeparatorVariants,
menuSubTriggerVariants,
} from "./menu-items";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import React from "react";
import { Check, ChevronRight, Circle } from "lucide-react";
diff --git a/frontend/src/components/ui/form.tsx b/frontend/src/components/ui/form.tsx
index b3ee4be5ba..4cf185df82 100644
--- a/frontend/src/components/ui/form.tsx
+++ b/frontend/src/components/ui/form.tsx
@@ -11,7 +11,7 @@ import {
useFormContext,
} from "react-hook-form";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { Label } from "@/components/ui/label";
import { Tooltip } from "@/components/ui/tooltip";
import { AlertCircleIcon } from "lucide-react";
diff --git a/frontend/src/components/ui/input.tsx b/frontend/src/components/ui/input.tsx
index 12ab5117b4..7567d6c7e0 100644
--- a/frontend/src/components/ui/input.tsx
+++ b/frontend/src/components/ui/input.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import * as React from "react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { useDebounceControlledState } from "@/hooks/useDebounce";
import { Events } from "@/utils/events";
diff --git a/frontend/src/components/ui/label.tsx b/frontend/src/components/ui/label.tsx
index b688d56a4a..348568d7c2 100644
--- a/frontend/src/components/ui/label.tsx
+++ b/frontend/src/components/ui/label.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
import { VariantProps, cva } from "class-variance-authority";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
diff --git a/frontend/src/components/ui/menu-items.tsx b/frontend/src/components/ui/menu-items.tsx
index 7cbfebe332..591e4b66b9 100644
--- a/frontend/src/components/ui/menu-items.tsx
+++ b/frontend/src/components/ui/menu-items.tsx
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { cva } from "class-variance-authority";
import React from "react";
diff --git a/frontend/src/components/ui/native-select.tsx b/frontend/src/components/ui/native-select.tsx
index 19ca35916c..0e7d89a180 100644
--- a/frontend/src/components/ui/native-select.tsx
+++ b/frontend/src/components/ui/native-select.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import * as React from "react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
import { cva } from "class-variance-authority";
diff --git a/frontend/src/components/ui/popover.tsx b/frontend/src/components/ui/popover.tsx
index e7410fe885..5ad409175a 100644
--- a/frontend/src/components/ui/popover.tsx
+++ b/frontend/src/components/ui/popover.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import * as PopoverPrimitive from "@radix-ui/react-popover";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const Popover = PopoverPrimitive.Root;
diff --git a/frontend/src/components/ui/progress.tsx b/frontend/src/components/ui/progress.tsx
index 0c10503082..80d7309e19 100644
--- a/frontend/src/components/ui/progress.tsx
+++ b/frontend/src/components/ui/progress.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import * as ProgressPrimitive from "@radix-ui/react-progress";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const Progress = React.forwardRef<
React.ElementRef<typeof ProgressPrimitive.Root>,
diff --git a/frontend/src/components/ui/radio-group.tsx b/frontend/src/components/ui/radio-group.tsx
index c9f5436a91..3ac65d3095 100644
--- a/frontend/src/components/ui/radio-group.tsx
+++ b/frontend/src/components/ui/radio-group.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
import { Circle } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const RadioGroup = React.forwardRef<
React.ElementRef<typeof RadioGroupPrimitive.Root>,
diff --git a/frontend/src/components/ui/select.tsx b/frontend/src/components/ui/select.tsx
index 6b74a0607b..5bc8311e29 100644
--- a/frontend/src/components/ui/select.tsx
+++ b/frontend/src/components/ui/select.tsx
@@ -9,7 +9,7 @@ import {
XIcon,
} from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { selectStyles } from "./native-select";
const Select = SelectPrimitive.Root;
diff --git a/frontend/src/components/ui/skeleton.tsx b/frontend/src/components/ui/skeleton.tsx
index 2efaacc054..880e895fd1 100644
--- a/frontend/src/components/ui/skeleton.tsx
+++ b/frontend/src/components/ui/skeleton.tsx
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const Skeleton = ({
className,
diff --git a/frontend/src/components/ui/slider.tsx b/frontend/src/components/ui/slider.tsx
index c333380ec3..41648a6262 100644
--- a/frontend/src/components/ui/slider.tsx
+++ b/frontend/src/components/ui/slider.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import * as SliderPrimitive from "@radix-ui/react-slider";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import {
TooltipContent,
TooltipProvider,
diff --git a/frontend/src/components/ui/switch.tsx b/frontend/src/components/ui/switch.tsx
index 2a6eec2488..50214f0a06 100644
--- a/frontend/src/components/ui/switch.tsx
+++ b/frontend/src/components/ui/switch.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import * as SwitchPrimitives from "@radix-ui/react-switch";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { cva, VariantProps } from "class-variance-authority";
const switchVariants = cva(
diff --git a/frontend/src/components/ui/table.tsx b/frontend/src/components/ui/table.tsx
index 5720982cb4..50928f285f 100644
--- a/frontend/src/components/ui/table.tsx
+++ b/frontend/src/components/ui/table.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import * as React from "react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const Table = React.forwardRef<
HTMLTableElement,
diff --git a/frontend/src/components/ui/tabs.tsx b/frontend/src/components/ui/tabs.tsx
index feffcf32ca..afdcde35b2 100644
--- a/frontend/src/components/ui/tabs.tsx
+++ b/frontend/src/components/ui/tabs.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import * as TabsPrimitive from "@radix-ui/react-tabs";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const Tabs = TabsPrimitive.Root;
diff --git a/frontend/src/components/ui/textarea.tsx b/frontend/src/components/ui/textarea.tsx
index 2d0e8724f9..9e5c66cf26 100644
--- a/frontend/src/components/ui/textarea.tsx
+++ b/frontend/src/components/ui/textarea.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import * as React from "react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
export interface TextareaProps
diff --git a/frontend/src/components/ui/toast.tsx b/frontend/src/components/ui/toast.tsx
index 5314e8b88b..30a374e0c9 100644
--- a/frontend/src/components/ui/toast.tsx
+++ b/frontend/src/components/ui/toast.tsx
@@ -4,7 +4,7 @@ import * as ToastPrimitives from "@radix-ui/react-toast";
import { VariantProps, cva } from "class-variance-authority";
import { X } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const ToastProvider = ToastPrimitives.Provider;
diff --git a/frontend/src/components/ui/toggle.tsx b/frontend/src/components/ui/toggle.tsx
index 9454ec8f36..427bd31491 100644
--- a/frontend/src/components/ui/toggle.tsx
+++ b/frontend/src/components/ui/toggle.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import * as TogglePrimitive from "@radix-ui/react-toggle";
import { cva, type VariantProps } from "class-variance-authority";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const toggleVariants = cva(
cn(
diff --git a/frontend/src/components/ui/tooltip.tsx b/frontend/src/components/ui/tooltip.tsx
index 25d4984486..c4f96f3064 100644
--- a/frontend/src/components/ui/tooltip.tsx
+++ b/frontend/src/components/ui/tooltip.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const TooltipProvider = TooltipPrimitive.Provider;
diff --git a/frontend/src/components/ui/typography.tsx b/frontend/src/components/ui/typography.tsx
index 6a81097ee6..96501d47de 100644
--- a/frontend/src/components/ui/typography.tsx
+++ b/frontend/src/components/ui/typography.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
/* eslint-disable jsx-a11y/heading-has-content */
import * as React from "react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
const H1 = React.forwardRef<
HTMLHeadingElement,
diff --git a/frontend/src/components/variables/variables-table.tsx b/frontend/src/components/variables/variables-table.tsx
index f5436373d1..7b4322caf5 100644
--- a/frontend/src/components/variables/variables-table.tsx
+++ b/frontend/src/components/variables/variables-table.tsx
@@ -9,9 +9,9 @@ import {
Table,
} from "../ui/table";
import { Variables } from "@/core/variables/types";
-import { CellId } from "@/core/model/ids";
-import { CellLink } from "@/editor/links/cell-link";
-import { cn } from "@/lib/utils";
+import { CellId } from "@/core/cells/ids";
+import { CellLink } from "@/components/editor/links/cell-link";
+import { cn } from "@/utils/cn";
import { SquareEqualIcon, WorkflowIcon } from "lucide-react";
import { Badge } from "../ui/badge";
import { toast } from "../ui/use-toast";
diff --git a/frontend/src/App.tsx b/frontend/src/core/App.tsx
similarity index 86%
rename from frontend/src/App.tsx
rename to frontend/src/core/App.tsx
index 67e48851f5..9b7c2247f7 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/core/App.tsx
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import "./css/App.css";
+import "../css/App.css";
import { HourglassIcon, UnlinkIcon } from "lucide-react";
import { useCallback, useEffect, useState } from "react";
@@ -11,13 +11,13 @@ import {
sendShutdown,
} from "@/core/network/requests";
-import { Controls } from "editor/Controls";
-import { DirCompletionInput } from "editor/DirCompletionInput";
-import { FilenameForm } from "editor/FilenameForm";
-import { UUID } from "./utils/uuid";
+import { Controls } from "@/components/editor/Controls";
+import { DirCompletionInput } from "@/components/editor/DirCompletionInput";
+import { FilenameForm } from "@/components/editor/FilenameForm";
+import { UUID } from "../utils/uuid";
import clsx from "clsx";
-import { WebSocketState } from "./core/websocket/types";
-import { useMarimoWebSocket } from "./core/websocket/useMarimoWebSocket";
+import { WebSocketState } from "./websocket/types";
+import { useMarimoWebSocket } from "./websocket/useMarimoWebSocket";
import {
notebookCells,
notebookIsRunning,
@@ -25,36 +25,36 @@ import {
notebookNeedsSave,
useCellActions,
useNotebook,
-} from "./core/state/cells";
-import { Disconnected } from "./editor/Disconnected";
-import { AppConfig, UserConfig } from "./core/config/config";
-import { toggleAppMode, viewStateAtom } from "./core/mode";
-import { useHotkey } from "./hooks/useHotkey";
-import { Tooltip } from "./components/ui/tooltip";
-import { useImperativeModal } from "./components/modal/ImperativeModal";
+} from "./cells/cells";
+import { Disconnected } from "../components/editor/Disconnected";
+import { AppConfig, UserConfig } from "./config/config-schema";
+import { toggleAppMode, viewStateAtom } from "./mode";
+import { useHotkey } from "../hooks/useHotkey";
+import { Tooltip } from "../components/ui/tooltip";
+import { useImperativeModal } from "../components/modal/ImperativeModal";
import {
DialogContent,
DialogFooter,
DialogTitle,
-} from "./components/ui/dialog";
-import { Label } from "./components/ui/label";
-import { Button } from "./components/ui/button";
-import { useEvent } from "./hooks/useEvent";
-import { Logger } from "./utils/Logger";
-import { useAutoSave } from "./core/saving/useAutoSave";
-import { useWindowEventListener } from "./hooks/useEventListener";
-import { toast } from "./components/ui/use-toast";
-import { SortableCellsProvider } from "./components/sort/SortableCellsProvider";
-import { CellId, HTMLCellId } from "./core/model/ids";
-import { CellConfig } from "./core/model/cells";
-import { getFilenameFromDOM } from "./core/dom/htmlUtils";
-import { CellArray } from "./editor/renderers/CellArray";
-import { RuntimeState } from "./core/RuntimeState";
-import { CellsRenderer } from "./editor/renderers/cells-renderer";
-import { getSerializedLayout } from "./core/state/layout";
+} from "../components/ui/dialog";
+import { Label } from "../components/ui/label";
+import { Button } from "../components/ui/button";
+import { useEvent } from "../hooks/useEvent";
+import { Logger } from "../utils/Logger";
+import { useAutoSave } from "./saving/useAutoSave";
+import { useWindowEventListener } from "../hooks/useEventListener";
+import { toast } from "../components/ui/use-toast";
+import { SortableCellsProvider } from "../components/sort/SortableCellsProvider";
+import { CellId, HTMLCellId } from "./cells/ids";
+import { CellConfig } from "./cells/types";
+import { getFilenameFromDOM } from "./dom/htmlUtils";
+import { CellArray } from "../components/editor/renderers/CellArray";
+import { RuntimeState } from "./RuntimeState";
+import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
+import { getSerializedLayout } from "./layout/layout";
import { useAtom } from "jotai";
-import { useRunStaleCells } from "./editor/cell/useRunCells";
-import { formatAll } from "./core/codemirror/format";
+import { useRunStaleCells } from "../components/editor/cell/useRunCells";
+import { formatAll } from "./codemirror/format";
interface AppProps {
userConfig: UserConfig;
diff --git a/frontend/src/MarimoApp.tsx b/frontend/src/core/MarimoApp.tsx
similarity index 59%
rename from frontend/src/MarimoApp.tsx
rename to frontend/src/core/MarimoApp.tsx
index 6c428fe8d8..d799284a84 100644
--- a/frontend/src/MarimoApp.tsx
+++ b/frontend/src/core/MarimoApp.tsx
@@ -1,18 +1,19 @@
/* Copyright 2023 Marimo. All rights reserved. */
+import "../css/index.css";
+
import { useEffect } from "react";
-import "./css/index.css";
-import { ErrorBoundary } from "./editor/boundary/ErrorBoundary";
-import { initializePlugins } from "./plugins/plugins";
+import { ErrorBoundary } from "../components/editor/boundary/ErrorBoundary";
+import { initializePlugins } from "../plugins/plugins";
import { App } from "./App";
-import { TooltipProvider } from "./components/ui/tooltip";
-import { Toaster } from "./components/ui/toaster";
-import { ModalProvider } from "./components/modal/ImperativeModal";
+import { TooltipProvider } from "../components/ui/tooltip";
+import { Toaster } from "../components/ui/toaster";
+import { ModalProvider } from "../components/modal/ImperativeModal";
import { DayPickerProvider } from "react-day-picker";
-import { CommandPallette } from "./editor/CommandPallette";
-import { useAppConfig, useUserConfig } from "@/core/state/config";
-import { initialMode } from "./core/mode";
-import { AppChrome } from "./editor/chrome/wrapper/app-chrome";
-import { StaticBanner } from "./components/static-html/static-banner";
+import { CommandPallette } from "../components/editor/CommandPallette";
+import { useAppConfig, useUserConfig } from "@/core/config/config";
+import { initialMode } from "./mode";
+import { AppChrome } from "../components/editor/chrome/wrapper/app-chrome";
+import { StaticBanner } from "../components/static-html/static-banner";
/**
* The root component of the Marimo app.
diff --git a/frontend/src/core/state/__tests__/__snapshots__/cells.test.ts.snap b/frontend/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap
similarity index 100%
rename from frontend/src/core/state/__tests__/__snapshots__/cells.test.ts.snap
rename to frontend/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap
diff --git a/frontend/src/core/state/__tests__/cells.test.ts b/frontend/src/core/cells/__tests__/cells.test.ts
similarity index 99%
rename from frontend/src/core/state/__tests__/cells.test.ts
rename to frontend/src/core/cells/__tests__/cells.test.ts
index 65f00bb28f..4b67a5aa8e 100644
--- a/frontend/src/core/state/__tests__/cells.test.ts
+++ b/frontend/src/core/cells/__tests__/cells.test.ts
@@ -6,7 +6,7 @@ import {
flattenNotebookCells,
notebookCells,
} from "../cells";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
const { initialNotebookState, reducer, createActions } = exportedForTesting;
diff --git a/frontend/src/core/model/__tests__/collapseConsoleOutputs.test.ts b/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
similarity index 100%
rename from frontend/src/core/model/__tests__/collapseConsoleOutputs.test.ts
rename to frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
diff --git a/frontend/src/core/model/__tests__/ids.test.ts b/frontend/src/core/cells/__tests__/ids.test.ts
similarity index 100%
rename from frontend/src/core/model/__tests__/ids.test.ts
rename to frontend/src/core/cells/__tests__/ids.test.ts
diff --git a/frontend/src/core/state/cell.ts b/frontend/src/core/cells/cell.ts
similarity index 96%
rename from frontend/src/core/state/cell.ts
rename to frontend/src/core/cells/cell.ts
index 87b7f21849..2d33ec2212 100644
--- a/frontend/src/core/state/cell.ts
+++ b/frontend/src/core/cells/cell.ts
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { logNever } from "@/utils/assertNever";
import { CellMessage } from "../kernel/messages";
-import { CellRuntimeState } from "../model/cells";
-import { collapseConsoleOutputs } from "../model/collapseConsoleOutputs";
+import { CellRuntimeState } from "./types";
+import { collapseConsoleOutputs } from "./collapseConsoleOutputs";
import { parseOutline } from "../dom/outline";
export function transitionCell(
diff --git a/frontend/src/core/state/cells.ts b/frontend/src/core/cells/cells.ts
similarity index 99%
rename from frontend/src/core/state/cells.ts
rename to frontend/src/core/cells/cells.ts
index bb73bf14aa..cc0a71f4f9 100644
--- a/frontend/src/core/state/cells.ts
+++ b/frontend/src/core/cells/cells.ts
@@ -8,21 +8,21 @@ import {
CellData,
createCell,
createCellRuntimeState,
-} from "../model/cells";
+} from "./types";
import {
scrollToBottom,
scrollToTop,
focusAndScrollCellIntoView,
-} from "../model/scrollCellIntoView";
+} from "./scrollCellIntoView";
import { arrayMove } from "@dnd-kit/sortable";
-import { CellId } from "../model/ids";
+import { CellId } from "./ids";
import { prepareCellForExecution, transitionCell } from "./cell";
-import { store } from "./jotai";
+import { store } from "../state/jotai";
import { createReducer } from "../../utils/createReducer";
import { arrayInsert, arrayDelete, arrayShallowEquals } from "@/utils/arrays";
import { foldAllBulk, unfoldAllBulk } from "../codemirror/editing/commands";
import { mergeOutlines } from "../dom/outline";
-import { CellHandle } from "@/editor/Cell";
+import { CellHandle } from "@/components/editor/Cell";
import { Logger } from "@/utils/Logger";
import { Objects } from "@/utils/objects";
import { EditorView } from "@codemirror/view";
diff --git a/frontend/src/core/model/collapseConsoleOutputs.tsx b/frontend/src/core/cells/collapseConsoleOutputs.tsx
similarity index 100%
rename from frontend/src/core/model/collapseConsoleOutputs.tsx
rename to frontend/src/core/cells/collapseConsoleOutputs.tsx
diff --git a/frontend/src/core/model/ids.ts b/frontend/src/core/cells/ids.ts
similarity index 95%
rename from frontend/src/core/model/ids.ts
rename to frontend/src/core/cells/ids.ts
index 8d28adac24..1da17c5b03 100644
--- a/frontend/src/core/model/ids.ts
+++ b/frontend/src/core/cells/ids.ts
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-redeclare */
import { invariant } from "@/utils/invariant";
-import { TypedString } from "./typed";
+import { TypedString } from "../../utils/typed";
/**
* A typed CellId
diff --git a/frontend/src/core/model/outline.ts b/frontend/src/core/cells/outline.ts
similarity index 100%
rename from frontend/src/core/model/outline.ts
rename to frontend/src/core/cells/outline.ts
diff --git a/frontend/src/core/model/scrollCellIntoView.ts b/frontend/src/core/cells/scrollCellIntoView.ts
similarity index 94%
rename from frontend/src/core/model/scrollCellIntoView.ts
rename to frontend/src/core/cells/scrollCellIntoView.ts
index 04bf6c4d9b..7db7e92a15 100644
--- a/frontend/src/core/model/scrollCellIntoView.ts
+++ b/frontend/src/core/cells/scrollCellIntoView.ts
@@ -2,7 +2,7 @@
import { RefObject } from "react";
import { Logger } from "../../utils/Logger";
import { CellId, HTMLCellId } from "./ids";
-import { CellHandle } from "@/editor/Cell";
+import { CellHandle } from "@/components/editor/Cell";
export function focusAndScrollCellIntoView(
cellId: CellId,
diff --git a/frontend/src/core/model/cells.ts b/frontend/src/core/cells/types.ts
similarity index 100%
rename from frontend/src/core/model/cells.ts
rename to frontend/src/core/cells/types.ts
diff --git a/frontend/src/core/codemirror/__tests__/setup.test.ts b/frontend/src/core/codemirror/__tests__/setup.test.ts
index 0881d043dc..ec0d2f31c5 100644
--- a/frontend/src/core/codemirror/__tests__/setup.test.ts
+++ b/frontend/src/core/codemirror/__tests__/setup.test.ts
@@ -3,7 +3,7 @@ import { describe, expect, test, vi } from "vitest";
import { CodeMirrorSetupOpts, setupCodeMirror } from "../cm";
import { EditorState, Extension } from "@codemirror/state";
import { keymap } from "@codemirror/view";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
import { Objects } from "@/utils/objects";
vi.mock("@/core/config/config", () => ({
diff --git a/frontend/src/core/codemirror/cells/extensions.ts b/frontend/src/core/codemirror/cells/extensions.ts
index afab1ded4f..81cd1c3485 100644
--- a/frontend/src/core/codemirror/cells/extensions.ts
+++ b/frontend/src/core/codemirror/cells/extensions.ts
@@ -1,10 +1,10 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { HOTKEYS } from "@/core/hotkeys/hotkeys";
import { EditorView, KeyBinding, keymap } from "@codemirror/view";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
import { Extension, Prec } from "@codemirror/state";
import { formatKeymapExtension } from "../extensions";
-import { CellActions } from "@/core/state/cells";
+import { CellActions } from "@/core/cells/cells";
export interface MovementCallbacks
extends Pick<CellActions, "sendToTop" | "sendToBottom" | "moveToNextCell"> {
diff --git a/frontend/src/core/codemirror/cm.ts b/frontend/src/core/codemirror/cm.ts
index 3e63d5b5ee..bd03702160 100644
--- a/frontend/src/core/codemirror/cm.ts
+++ b/frontend/src/core/codemirror/cm.ts
@@ -45,7 +45,7 @@ import {
import { EditorState, Extension, Prec } from "@codemirror/state";
import { oneDark } from "@codemirror/theme-one-dark";
-import { CompletionConfig, KeymapConfig } from "../config/config";
+import { CompletionConfig, KeymapConfig } from "../config/config-schema";
import { Theme } from "../../theme/useTheme";
import { completer } from "@/core/codemirror/completion/completer";
@@ -56,7 +56,7 @@ import {
cellCodeEditingBundle,
cellMovementBundle,
} from "./cells/extensions";
-import { CellId } from "../model/ids";
+import { CellId } from "../cells/ids";
import { keymapBundle } from "./keymaps/keymaps";
import {
scrollActiveLineIntoView,
diff --git a/frontend/src/core/codemirror/completion/completer.ts b/frontend/src/core/codemirror/completion/completer.ts
index 7d3cd99af2..33447aed7c 100644
--- a/frontend/src/core/codemirror/completion/completer.ts
+++ b/frontend/src/core/codemirror/completion/completer.ts
@@ -3,8 +3,8 @@ import { CompletionContext, CompletionResult } from "@codemirror/autocomplete";
import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
import { Logger } from "../../../utils/Logger";
-import { CellId, HTMLCellId } from "@/core/model/ids";
-import { getCellEditorView } from "@/core/state/cells";
+import { CellId, HTMLCellId } from "@/core/cells/ids";
+import { getCellEditorView } from "@/core/cells/cells";
import { dispatchShowTooltip } from "./hints";
export async function completer(
diff --git a/frontend/src/core/codemirror/completion/hints.ts b/frontend/src/core/codemirror/completion/hints.ts
index c2610ac830..ddf5b94fe0 100644
--- a/frontend/src/core/codemirror/completion/hints.ts
+++ b/frontend/src/core/codemirror/completion/hints.ts
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { HTMLCellId } from "@/core/model/ids";
+import { HTMLCellId } from "@/core/cells/ids";
import {
EditorView,
Tooltip,
diff --git a/frontend/src/core/codemirror/copilot/getCodes.ts b/frontend/src/core/codemirror/copilot/getCodes.ts
index 2d7afacbec..b201030305 100644
--- a/frontend/src/core/codemirror/copilot/getCodes.ts
+++ b/frontend/src/core/codemirror/copilot/getCodes.ts
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { getAllEditorViews } from "@/core/state/cells";
+import { getAllEditorViews } from "@/core/cells/cells";
export function getCodes(otherCode: string) {
// Get all other cells' code
diff --git a/frontend/src/core/codemirror/copilot/state.ts b/frontend/src/core/codemirror/copilot/state.ts
index 2fc0bdc3f5..f9cbc18c31 100644
--- a/frontend/src/core/codemirror/copilot/state.ts
+++ b/frontend/src/core/codemirror/copilot/state.ts
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { getUserConfig, userConfigAtom } from "@/core/state/config";
+import { getUserConfig, userConfigAtom } from "@/core/config/config";
import { waitFor } from "@/core/state/jotai";
import { atomWithStorage } from "jotai/utils";
diff --git a/frontend/src/core/codemirror/extensions.ts b/frontend/src/core/codemirror/extensions.ts
index e06bd2c6d8..02dcc7554f 100644
--- a/frontend/src/core/codemirror/extensions.ts
+++ b/frontend/src/core/codemirror/extensions.ts
@@ -1,10 +1,10 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { EditorView, keymap, placeholder } from "@codemirror/view";
-import { CellId } from "../model/ids";
+import { CellId } from "../cells/ids";
import { formatEditorViews } from "./format";
import { smartScrollIntoView } from "../../utils/scroll";
import { HOTKEYS } from "@/core/hotkeys/hotkeys";
-import { CellActions } from "../state/cells";
+import { CellActions } from "../cells/cells";
function acceptPlaceholder(cm: EditorView, text: string) {
// if empty, insert the placeholder
diff --git a/frontend/src/core/codemirror/find-replace/navigate.ts b/frontend/src/core/codemirror/find-replace/navigate.ts
index 4656276bf9..9896dc9cb0 100644
--- a/frontend/src/core/codemirror/find-replace/navigate.ts
+++ b/frontend/src/core/codemirror/find-replace/navigate.ts
@@ -4,7 +4,7 @@ import { SearchCursor, SearchQuery } from "@codemirror/search";
import { EditorSelection, EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { findReplaceAtom } from "./state";
-import { getAllEditorViews } from "@/core/state/cells";
+import { getAllEditorViews } from "@/core/cells/cells";
type SearchResult = typeof SearchCursor.prototype.value;
diff --git a/frontend/src/core/codemirror/format.ts b/frontend/src/core/codemirror/format.ts
index 40789bbf9e..1e2c12fe74 100644
--- a/frontend/src/core/codemirror/format.ts
+++ b/frontend/src/core/codemirror/format.ts
@@ -1,13 +1,13 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { EditorView } from "@codemirror/view";
-import { CellId } from "../model/ids";
+import { CellId } from "../cells/ids";
import { Objects } from "../../utils/objects";
import { sendFormat } from "../network/requests";
import {
CellActions,
getNotebook,
notebookCellEditorViews,
-} from "../state/cells";
+} from "../cells/cells";
/**
* Format the code in the editor views via the marimo server,
diff --git a/frontend/src/core/codemirror/keymaps/keymaps.ts b/frontend/src/core/codemirror/keymaps/keymaps.ts
index 4dab4a5a69..d30f0a5466 100644
--- a/frontend/src/core/codemirror/keymaps/keymaps.ts
+++ b/frontend/src/core/codemirror/keymaps/keymaps.ts
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { KeymapConfig } from "@/core/config/config";
+import { KeymapConfig } from "@/core/config/config-schema";
import { logNever } from "@/utils/assertNever";
import { defaultKeymap } from "@codemirror/commands";
import { Extension, Prec } from "@codemirror/state";
diff --git a/frontend/src/core/config/config-schema.ts b/frontend/src/core/config/config-schema.ts
new file mode 100644
index 0000000000..9e2d4b9b44
--- /dev/null
+++ b/frontend/src/core/config/config-schema.ts
@@ -0,0 +1,91 @@
+/* Copyright 2023 Marimo. All rights reserved. */
+import { z } from "zod";
+import { assertExists } from "../../utils/assertExists";
+import { Logger } from "@/utils/Logger";
+
+export const UserConfigSchema = z
+ .object({
+ completion: z.object({
+ activate_on_typing: z.boolean(),
+ copilot: z.boolean(),
+ }),
+ save: z.object({
+ autosave: z.enum(["off", "after_delay"]).default("after_delay"),
+ autosave_delay: z
+ .number()
+ .nonnegative()
+ // Ensure that the delay is at least 1 second
+ .transform((millis) => Math.max(millis, 1000))
+ .default(1000),
+ format_on_save: z.boolean().default(false),
+ }),
+ keymap: z.object({
+ preset: z.enum(["default", "vim"]).default("default"),
+ }),
+ runtime: z
+ .object({
+ auto_instantiate: z.boolean(),
+ })
+ .default({ auto_instantiate: true }),
+ display: z
+ .object({
+ theme: z.enum(["light", "dark"]).default("light"),
+ })
+ .default({ theme: "light" }),
+ experimental: z
+ .object({
+ layouts: z.boolean().optional(),
+ static_export: z.boolean().optional(),
+ })
+ // Pass through so that we don't remove any extra keys that the user has added.
+ .passthrough()
+ .default({}),
+ })
+ // Pass through so that we don't remove any extra keys that the user has added.
+ .passthrough();
+export type UserConfig = z.infer<typeof UserConfigSchema>;
+export type SaveConfig = UserConfig["save"];
+export type CompletionConfig = UserConfig["completion"];
+export type KeymapConfig = UserConfig["keymap"];
+
+export const AppConfigSchema = z.object({
+ width: z.enum(["full", "normal"]).default("normal"),
+});
+export type AppConfig = z.infer<typeof AppConfigSchema>;
+
+export function parseAppConfig() {
+ try {
+ return AppConfigSchema.parse(JSON.parse(getConfig("app")));
+ } catch (error) {
+ throw new Error(
+ `Marimo got an unexpected value in the configuration file: ${error}`
+ );
+ }
+}
+
+export function parseUserConfig() {
+ try {
+ const parsed = UserConfigSchema.parse(JSON.parse(getConfig("user")));
+ for (const [key, value] of Object.entries(parsed.experimental)) {
+ if (value === true) {
+ Logger.log(`🧪 Experimental feature "${key}" is enabled.`);
+ }
+ }
+ return parsed;
+ } catch (error) {
+ throw new Error(
+ `Marimo got an unexpected value in the configuration file: ${error}`
+ );
+ }
+}
+
+function getConfig(kind: "user" | "app") {
+ const tagName = kind === "user" ? "marimo-user-config" : "marimo-app-config";
+ const tag = document.querySelector<HTMLElement>(tagName);
+ assertExists(tag, `internal-error: ${tagName} tag not found`);
+
+ const configData = tag.dataset.config;
+ assertExists(configData, "internal-error: missing config");
+
+ return configData;
+}
diff --git a/frontend/src/core/config/config.ts b/frontend/src/core/config/config.ts
index 9e2d4b9b44..6bae7bf174 100644
--- a/frontend/src/core/config/config.ts
+++ b/frontend/src/core/config/config.ts
@@ -1,91 +1,41 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { z } from "zod";
-import { assertExists } from "../../utils/assertExists";
-import { Logger } from "@/utils/Logger";
+import { atom, useAtom } from "jotai";
+import {
+ AppConfig,
+ UserConfig,
+ parseAppConfig,
+ parseUserConfig,
+} from "./config-schema";
+import { store } from "../state/jotai";
-export const UserConfigSchema = z
- .object({
- completion: z.object({
- activate_on_typing: z.boolean(),
- copilot: z.boolean(),
- }),
- save: z.object({
- autosave: z.enum(["off", "after_delay"]).default("after_delay"),
- autosave_delay: z
- .number()
- .nonnegative()
- // Ensure that the delay is at least 1 second
- .transform((millis) => Math.max(millis, 1000))
- .default(1000),
- format_on_save: z.boolean().default(false),
- }),
- keymap: z.object({
- preset: z.enum(["default", "vim"]).default("default"),
- }),
- runtime: z
- .object({
- auto_instantiate: z.boolean(),
- })
- .default({ auto_instantiate: true }),
- display: z
- .object({
- theme: z.enum(["light", "dark"]).default("light"),
- })
- .default({ theme: "light" }),
- experimental: z
- .object({
- layouts: z.boolean().optional(),
- static_export: z.boolean().optional(),
- })
- // Pass through so that we don't remove any extra keys that the user has added.
- .passthrough()
- .default({}),
- })
- // Pass through so that we don't remove any extra keys that the user has added.
- .passthrough();
-export type UserConfig = z.infer<typeof UserConfigSchema>;
-export type SaveConfig = UserConfig["save"];
-export type CompletionConfig = UserConfig["completion"];
-export type KeymapConfig = UserConfig["keymap"];
+/**
+ * Atom for storing the user config.
+ */
+export const userConfigAtom = atom<UserConfig>(parseUserConfig());
-export const AppConfigSchema = z.object({
- width: z.enum(["full", "normal"]).default("normal"),
-});
-export type AppConfig = z.infer<typeof AppConfigSchema>;
-
-export function parseAppConfig() {
- try {
- return AppConfigSchema.parse(JSON.parse(getConfig("app")));
- } catch (error) {
- throw new Error(
- `Marimo got an unexpected value in the configuration file: ${error}`
- );
- }
+/**
+ * Returns the user config.
+ */
+export function useUserConfig() {
+ return useAtom(userConfigAtom);
}
-export function parseUserConfig() {
- try {
- const parsed = UserConfigSchema.parse(JSON.parse(getConfig("user")));
- for (const [key, value] of Object.entries(parsed.experimental)) {
- if (value === true) {
- Logger.log(`🧪 Experimental feature "${key}" is enabled.`);
- }
- }
- return parsed;
- } catch (error) {
- throw new Error(
- `Marimo got an unexpected value in the configuration file: ${error}`
- );
- }
+export function getUserConfig() {
+ return store.get(userConfigAtom);
}
-function getConfig(kind: "user" | "app") {
- const tagName = kind === "user" ? "marimo-user-config" : "marimo-app-config";
- const tag = document.querySelector<HTMLElement>(tagName);
- assertExists(tag, `internal-error: ${tagName} tag not found`);
+/**
+ * Atom for storing the app config.
+ */
+const appConfigAtom = atom<AppConfig>(parseAppConfig());
- const configData = tag.dataset.config;
- assertExists(configData, "internal-error: missing config");
+/**
+ * Returns the app config.
+ */
+export function useAppConfig() {
+ return useAtom(appConfigAtom);
+}
- return configData;
+export function getAppConfig() {
+ return store.get(appConfigAtom);
}
diff --git a/frontend/src/core/config/feature-flag.ts b/frontend/src/core/config/feature-flag.ts
index ed1841c972..a12bf4821e 100644
--- a/frontend/src/core/config/feature-flag.ts
+++ b/frontend/src/core/config/feature-flag.ts
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { getUserConfig } from "../state/config";
+import { getUserConfig } from "./config";
export interface ExperimentalFeatures {
/**
diff --git a/frontend/src/core/dom/outline.ts b/frontend/src/core/dom/outline.ts
index 56adea871e..c26719a8a9 100644
--- a/frontend/src/core/dom/outline.ts
+++ b/frontend/src/core/dom/outline.ts
@@ -2,7 +2,7 @@
import { Logger } from "@/utils/Logger";
import { OutputMessage } from "../kernel/messages";
-import { Outline } from "../model/outline";
+import { Outline } from "../cells/outline";
function getOutline(html: string): Outline {
const items: Outline["items"] = [];
diff --git a/frontend/src/core/state/actions.ts b/frontend/src/core/hotkeys/actions.ts
similarity index 100%
rename from frontend/src/core/state/actions.ts
rename to frontend/src/core/hotkeys/actions.ts
diff --git a/frontend/src/core/hotkeys/hotkeys.ts b/frontend/src/core/hotkeys/hotkeys.ts
index 3f14ae804f..fdf27371da 100644
--- a/frontend/src/core/hotkeys/hotkeys.ts
+++ b/frontend/src/core/hotkeys/hotkeys.ts
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { isPlatformMac } from "@/core/shortcuts/shortcuts";
+import { isPlatformMac } from "@/core/hotkeys/shortcuts";
import { Objects } from "@/utils/objects";
interface Hotkey {
diff --git a/frontend/src/core/shortcuts/shortcuts.ts b/frontend/src/core/hotkeys/shortcuts.ts
similarity index 100%
rename from frontend/src/core/shortcuts/shortcuts.ts
rename to frontend/src/core/hotkeys/shortcuts.ts
diff --git a/frontend/src/core/kernel/messages.ts b/frontend/src/core/kernel/messages.ts
index 2695b95de3..ccecba3de1 100644
--- a/frontend/src/core/kernel/messages.ts
+++ b/frontend/src/core/kernel/messages.ts
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { LayoutType } from "@/editor/renderers/types";
-import { CellConfig, CellStatus } from "../model/cells";
-import { CellId } from "../model/ids";
+import { LayoutType } from "@/components/editor/renderers/types";
+import { CellConfig, CellStatus } from "../cells/types";
+import { CellId } from "../cells/ids";
import { VariableName } from "../variables/types";
import { RequestId } from "../network/DeferredRequestRegistry";
diff --git a/frontend/src/core/state/layout.ts b/frontend/src/core/layout/layout.ts
similarity index 77%
rename from frontend/src/core/state/layout.ts
rename to frontend/src/core/layout/layout.ts
index 61e9a5fd3e..852fc0e4ce 100644
--- a/frontend/src/core/state/layout.ts
+++ b/frontend/src/core/layout/layout.ts
@@ -1,11 +1,11 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { GridLayout } from "@/editor/renderers/grid-layout/types";
-import { LayoutType } from "@/editor/renderers/types";
-import { cellRendererPlugins } from "@/editor/renderers/plugins";
+import { GridLayout } from "@/components/editor/renderers/grid-layout/types";
+import { LayoutType } from "@/components/editor/renderers/types";
+import { cellRendererPlugins } from "@/components/editor/renderers/plugins";
import { Logger } from "@/utils/Logger";
import { atom } from "jotai";
-import { getNotebook, notebookCells } from "./cells";
-import { store } from "./jotai";
+import { getNotebook, notebookCells } from "../cells/cells";
+import { store } from "../state/jotai";
/**
* The currently selected layout type to show.
diff --git a/frontend/src/core/mode.ts b/frontend/src/core/mode.ts
index 9e73a3b546..ad1c240c3f 100644
--- a/frontend/src/core/mode.ts
+++ b/frontend/src/core/mode.ts
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { atom } from "jotai";
-import { CellId } from "./model/ids";
+import { CellId } from "./cells/ids";
import { store } from "./state/jotai";
/**
diff --git a/frontend/src/core/network/DeferredRequestRegistry.ts b/frontend/src/core/network/DeferredRequestRegistry.ts
index 9e3f36dc99..310fa0f534 100644
--- a/frontend/src/core/network/DeferredRequestRegistry.ts
+++ b/frontend/src/core/network/DeferredRequestRegistry.ts
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-redeclare */
import { Deferred } from "@/utils/Deferred";
import { generateUUID } from "@/utils/uuid";
-import { TypedString } from "../model/typed";
+import { TypedString } from "../../utils/typed";
export type RequestId = TypedString<"RequestId">;
export const RequestId = {
diff --git a/frontend/src/core/state/connection.ts b/frontend/src/core/network/connection.ts
similarity index 100%
rename from frontend/src/core/state/connection.ts
rename to frontend/src/core/network/connection.ts
diff --git a/frontend/src/core/network/requests.ts b/frontend/src/core/network/requests.ts
index 47731d9b0c..f1c23f8056 100644
--- a/frontend/src/core/network/requests.ts
+++ b/frontend/src/core/network/requests.ts
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { CellId } from "../model/ids";
+import { CellId } from "../cells/ids";
import { isStaticNotebook } from "../static/static-state";
import { API } from "./api";
import { createStaticRequests } from "./static-requests";
diff --git a/frontend/src/core/network/types.ts b/frontend/src/core/network/types.ts
index 8a76f85f99..53eae05dd6 100644
--- a/frontend/src/core/network/types.ts
+++ b/frontend/src/core/network/types.ts
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { AppConfig, UserConfig } from "../config/config";
-import { LayoutType } from "@/editor/renderers/types";
-import { CellId } from "../../core/model/ids";
-import { CellConfig } from "../model/cells";
+import { AppConfig, UserConfig } from "../config/config-schema";
+import { LayoutType } from "@/components/editor/renderers/types";
+import { CellId } from "../cells/ids";
+import { CellConfig } from "../cells/types";
import { RequestId } from "./DeferredRequestRegistry";
// Ideally this would be generated from server.py, but for now we just
diff --git a/frontend/src/core/saving/useAutoSave.ts b/frontend/src/core/saving/useAutoSave.ts
index 101cce1e21..cddd992794 100644
--- a/frontend/src/core/saving/useAutoSave.ts
+++ b/frontend/src/core/saving/useAutoSave.ts
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { useEffect, useRef } from "react";
import { ConnectionStatus, WebSocketState } from "../websocket/types";
-import { UserConfig } from "../config/config";
-import { CellConfig } from "../model/cells";
+import { UserConfig } from "../config/config-schema";
+import { CellConfig } from "../cells/types";
export function useAutoSave(opts: {
codes: string[];
diff --git a/frontend/src/core/state/config.ts b/frontend/src/core/state/config.ts
deleted file mode 100644
index 931caf47dc..0000000000
--- a/frontend/src/core/state/config.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2023 Marimo. All rights reserved. */
-import { atom, useAtom } from "jotai";
-import {
- AppConfig,
- UserConfig,
- parseAppConfig,
- parseUserConfig,
-} from "../config/config";
-import { store } from "./jotai";
-
-/**
- * Atom for storing the user config.
- */
-export const userConfigAtom = atom<UserConfig>(parseUserConfig());
-
-/**
- * Returns the user config.
- */
-export function useUserConfig() {
- return useAtom(userConfigAtom);
-}
-
-export function getUserConfig() {
- return store.get(userConfigAtom);
-}
-
-/**
- * Atom for storing the app config.
- */
-const appConfigAtom = atom<AppConfig>(parseAppConfig());
-
-/**
- * Returns the app config.
- */
-export function useAppConfig() {
- return useAtom(appConfigAtom);
-}
-
-export function getAppConfig() {
- return store.get(appConfigAtom);
-}
diff --git a/frontend/src/core/static/__tests__/download-html.test.ts b/frontend/src/core/static/__tests__/download-html.test.ts
index 8959f5b2cb..79bbec56c7 100644
--- a/frontend/src/core/static/__tests__/download-html.test.ts
+++ b/frontend/src/core/static/__tests__/download-html.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { describe, expect, it } from "vitest";
import { constructHTML } from "../download-html";
-import { CellId } from "@/core/model/ids";
-import { createCell, createCellRuntimeState } from "@/core/model/cells";
+import { CellId } from "@/core/cells/ids";
+import { createCell, createCellRuntimeState } from "@/core/cells/types";
import { JSDOM } from "jsdom";
// @ts-expect-error - no types
import prettier from "prettier";
diff --git a/frontend/src/core/static/download-html.ts b/frontend/src/core/static/download-html.ts
index cbca8d843f..1c7b8dc987 100644
--- a/frontend/src/core/static/download-html.ts
+++ b/frontend/src/core/static/download-html.ts
@@ -1,5 +1,5 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { NotebookState, getNotebook } from "../state/cells";
+import { NotebookState, getNotebook } from "../cells/cells";
import { getMarimoVersion } from "../dom/version";
// For Testing:
diff --git a/frontend/src/core/static/static-state.ts b/frontend/src/core/static/static-state.ts
index 33e3ee5fd6..5174d0f006 100644
--- a/frontend/src/core/static/static-state.ts
+++ b/frontend/src/core/static/static-state.ts
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { invariant } from "@/utils/invariant";
-import { NotebookState } from "../state/cells";
+import { NotebookState } from "../cells/cells";
export interface StaticNotebookState
extends Pick<NotebookState, "cellIds" | "cellData" | "cellRuntime"> {
diff --git a/frontend/src/core/variables/__tests__/state.test.ts b/frontend/src/core/variables/__tests__/state.test.ts
index 80eb98d437..1c77db9a9c 100644
--- a/frontend/src/core/variables/__tests__/state.test.ts
+++ b/frontend/src/core/variables/__tests__/state.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { beforeEach, describe, expect, it } from "vitest";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
import { exportedForTesting } from "../state";
import { VariableName, Variables } from "../types";
diff --git a/frontend/src/core/variables/types.ts b/frontend/src/core/variables/types.ts
index 8d8dcc70d9..7e2f177091 100644
--- a/frontend/src/core/variables/types.ts
+++ b/frontend/src/core/variables/types.ts
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
-import { CellId } from "../model/ids";
-import { TypedString } from "../model/typed";
+import { CellId } from "../cells/ids";
+import { TypedString } from "../../utils/typed";
export type VariableName = TypedString<"VariableName">;
diff --git a/frontend/src/core/websocket/useMarimoWebSocket.tsx b/frontend/src/core/websocket/useMarimoWebSocket.tsx
index 1617b43e60..bac298180a 100644
--- a/frontend/src/core/websocket/useMarimoWebSocket.tsx
+++ b/frontend/src/core/websocket/useMarimoWebSocket.tsx
@@ -1,22 +1,22 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { WebSocketClosedReason, WebSocketState } from "./types";
import { useAtom, useSetAtom } from "jotai";
-import { connectionAtom } from "../state/connection";
+import { connectionAtom } from "../network/connection";
import { useWebSocket } from "@/core/websocket/useWebSocket";
import { logNever } from "@/utils/assertNever";
-import { useCellActions } from "@/core/state/cells";
+import { useCellActions } from "@/core/cells/cells";
import { RuntimeState } from "@/core/RuntimeState";
import { AUTOCOMPLETER } from "@/core/codemirror/completion/Autocompleter";
import { UI_ELEMENT_REGISTRY } from "@/core/dom/uiregistry";
import { OperationMessage } from "@/core/kernel/messages";
import { saveCellConfig, sendInstantiate } from "../network/requests";
-import { CellId } from "../model/ids";
-import { CellConfig, CellData } from "../model/cells";
-import { createCell } from "../model/cells";
+import { CellId } from "../cells/ids";
+import { CellConfig, CellData } from "../cells/types";
+import { createCell } from "../cells/types";
import { useErrorBoundary } from "react-error-boundary";
import { Logger } from "@/utils/Logger";
-import { layoutDataAtom, layoutViewAtom } from "../state/layout";
-import { deserializeLayout } from "@/editor/renderers/plugins";
+import { layoutDataAtom, layoutViewAtom } from "../layout/layout";
+import { deserializeLayout } from "@/components/editor/renderers/plugins";
import { useVariablesActions } from "../variables/state";
import { toast } from "@/components/ui/use-toast";
import { renderHTML } from "@/plugins/core/RenderHTML";
diff --git a/frontend/src/hooks/useHotkey.ts b/frontend/src/hooks/useHotkey.ts
index 949a011c13..ec9c2f493c 100644
--- a/frontend/src/hooks/useHotkey.ts
+++ b/frontend/src/hooks/useHotkey.ts
@@ -1,10 +1,10 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { useEffect } from "react";
-import { parseShortcut } from "../core/shortcuts/shortcuts";
+import { parseShortcut } from "../core/hotkeys/shortcuts";
import { useEventListener } from "./useEventListener";
import { useEvent } from "./useEvent";
-import { useSetRegisteredAction } from "../core/state/actions";
+import { useSetRegisteredAction } from "../core/hotkeys/actions";
import { HOTKEYS, HotkeyAction } from "@/core/hotkeys/hotkeys";
/**
diff --git a/frontend/src/index.ts b/frontend/src/index.ts
deleted file mode 100644
index 558f34a8dc..0000000000
--- a/frontend/src/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Copyright 2023 Marimo. All rights reserved. */
-export { MarimoApp } from "./MarimoApp";
-// Theme exports
-export { ThemeProvider } from "./theme/ThemeProvider";
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx
index 1d109be20c..0935744492 100644
--- a/frontend/src/main.tsx
+++ b/frontend/src/main.tsx
@@ -3,8 +3,8 @@ import React from "react";
import ReactDOM from "react-dom/client";
import { worker } from "./mocks/browser";
import { ThemeProvider } from "./theme/ThemeProvider";
-import { ErrorBoundary } from "./editor/boundary/ErrorBoundary";
-import { MarimoApp } from "./MarimoApp";
+import { ErrorBoundary } from "./components/editor/boundary/ErrorBoundary";
+import { MarimoApp } from "./core/MarimoApp";
import { Logger } from "./utils/Logger";
import { reportVitals } from "./utils/vitals";
import { Provider } from "jotai";
diff --git a/frontend/src/plugins/core/BadPlugin.tsx b/frontend/src/plugins/core/BadPlugin.tsx
index 08119f5621..596f4403d3 100644
--- a/frontend/src/plugins/core/BadPlugin.tsx
+++ b/frontend/src/plugins/core/BadPlugin.tsx
@@ -8,8 +8,8 @@ import {
AccordionTrigger,
AccordionContent,
} from "@radix-ui/react-accordion";
-import { JsonOutput } from "@/editor/output/JsonOutput";
-import { EmotionCacheProvider } from "@/editor/output/EmotionCacheProvider";
+import { JsonOutput } from "@/components/editor/output/JsonOutput";
+import { EmotionCacheProvider } from "@/components/editor/output/EmotionCacheProvider";
interface Props {
error: ZodError | Error;
diff --git a/frontend/src/plugins/impl/ButtonPlugin.tsx b/frontend/src/plugins/impl/ButtonPlugin.tsx
index 486e51317a..baba8ca2df 100644
--- a/frontend/src/plugins/impl/ButtonPlugin.tsx
+++ b/frontend/src/plugins/impl/ButtonPlugin.tsx
@@ -5,7 +5,7 @@ import { IPlugin, IPluginProps } from "../types";
import { Button } from "../../components/ui/button";
import { renderHTML } from "../core/RenderHTML";
import { Intent, zodIntent } from "./common/intent";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Data {
label: string;
diff --git a/frontend/src/plugins/impl/DatePickerPlugin.tsx b/frontend/src/plugins/impl/DatePickerPlugin.tsx
index 6431dcc0e5..5631bd8f93 100644
--- a/frontend/src/plugins/impl/DatePickerPlugin.tsx
+++ b/frontend/src/plugins/impl/DatePickerPlugin.tsx
@@ -5,7 +5,7 @@ import { z } from "zod";
import { IPlugin, IPluginProps, Setter } from "../types";
import { Input } from "../../components/ui/input";
import { Labeled } from "./common/labeled";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
type T = string;
diff --git a/frontend/src/plugins/impl/DropdownPlugin.tsx b/frontend/src/plugins/impl/DropdownPlugin.tsx
index a14a41bdf7..5b4aca456b 100644
--- a/frontend/src/plugins/impl/DropdownPlugin.tsx
+++ b/frontend/src/plugins/impl/DropdownPlugin.tsx
@@ -5,7 +5,7 @@ import { z } from "zod";
import { IPlugin, IPluginProps } from "../types";
import { NativeSelect } from "../../components/ui/native-select";
import { Labeled } from "./common/labeled";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Data {
label: string | null;
diff --git a/frontend/src/plugins/impl/FileUploadPlugin.tsx b/frontend/src/plugins/impl/FileUploadPlugin.tsx
index 317153adb6..64befb6f12 100644
--- a/frontend/src/plugins/impl/FileUploadPlugin.tsx
+++ b/frontend/src/plugins/impl/FileUploadPlugin.tsx
@@ -3,7 +3,7 @@ import { z } from "zod";
import { useDropzone } from "react-dropzone";
import { Upload } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { IPlugin, IPluginProps, Setter } from "../types";
import { filesToBase64 } from "../../utils/fileToBase64";
import { buttonVariants } from "../../components/ui/button";
diff --git a/frontend/src/plugins/impl/FormPlugin.tsx b/frontend/src/plugins/impl/FormPlugin.tsx
index 92e9b6c65e..2d38d17c6c 100644
--- a/frontend/src/plugins/impl/FormPlugin.tsx
+++ b/frontend/src/plugins/impl/FormPlugin.tsx
@@ -10,7 +10,7 @@ import {
import { IPlugin, IPluginProps, Setter } from "../types";
import { Button } from "../../components/ui/button";
import { UI_ELEMENT_REGISTRY } from "@/core/dom/uiregistry";
-import { cn } from "../../lib/utils";
+import { cn } from "../../utils/cn";
import { renderHTML } from "../core/RenderHTML";
type T = unknown;
diff --git a/frontend/src/plugins/impl/MultiselectPlugin.tsx b/frontend/src/plugins/impl/MultiselectPlugin.tsx
index 6e72e7fbc0..7511d2d100 100644
--- a/frontend/src/plugins/impl/MultiselectPlugin.tsx
+++ b/frontend/src/plugins/impl/MultiselectPlugin.tsx
@@ -5,7 +5,7 @@ import { z } from "zod";
import { IPlugin, IPluginProps, Setter } from "../types";
import { Combobox, ComboboxItem } from "../../components/ui/combobox";
import { Labeled } from "./common/labeled";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Data {
label: string | null;
diff --git a/frontend/src/plugins/impl/NumberPlugin.tsx b/frontend/src/plugins/impl/NumberPlugin.tsx
index 19f1951cfd..5061c728e1 100644
--- a/frontend/src/plugins/impl/NumberPlugin.tsx
+++ b/frontend/src/plugins/impl/NumberPlugin.tsx
@@ -6,7 +6,7 @@ import { IPlugin, IPluginProps, Setter } from "../types";
import { Input } from "../../components/ui/input";
import { Labeled } from "./common/labeled";
import { useDebounceControlledState } from "@/hooks/useDebounce";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
type T = number;
diff --git a/frontend/src/plugins/impl/RefreshPlugin.tsx b/frontend/src/plugins/impl/RefreshPlugin.tsx
index 53eefa6bc3..8f448a268d 100644
--- a/frontend/src/plugins/impl/RefreshPlugin.tsx
+++ b/frontend/src/plugins/impl/RefreshPlugin.tsx
@@ -8,7 +8,7 @@ import timestring from "timestring";
import { NativeSelect } from "@/components/ui/native-select";
import { Button } from "@/components/ui/button";
import { useEvent } from "../../hooks/useEvent";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import { Labeled } from "./common/labeled";
type Value = string | number | undefined;
diff --git a/frontend/src/plugins/impl/TextAreaPlugin.tsx b/frontend/src/plugins/impl/TextAreaPlugin.tsx
index 790ecc8648..2c1355cc80 100644
--- a/frontend/src/plugins/impl/TextAreaPlugin.tsx
+++ b/frontend/src/plugins/impl/TextAreaPlugin.tsx
@@ -4,7 +4,7 @@ import { IPlugin, IPluginProps, Setter } from "../types";
import { Textarea } from "../../components/ui/textarea";
import { Labeled } from "./common/labeled";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
type T = string;
diff --git a/frontend/src/plugins/impl/TextInputPlugin.tsx b/frontend/src/plugins/impl/TextInputPlugin.tsx
index 1e80b4cc35..bb1773db2d 100644
--- a/frontend/src/plugins/impl/TextInputPlugin.tsx
+++ b/frontend/src/plugins/impl/TextInputPlugin.tsx
@@ -3,7 +3,7 @@ import { z } from "zod";
import { IPlugin, IPluginProps, Setter } from "../types";
import { Input } from "../../components/ui/input";
-import { cn } from "../../lib/utils";
+import { cn } from "../../utils/cn";
import { AtSignIcon, GlobeIcon, LockIcon } from "lucide-react";
import { useState } from "react";
import { Labeled } from "./common/labeled";
diff --git a/frontend/src/plugins/impl/common/labeled.tsx b/frontend/src/plugins/impl/common/labeled.tsx
index 5f05771372..1ce42e24b7 100644
--- a/frontend/src/plugins/impl/common/labeled.tsx
+++ b/frontend/src/plugins/impl/common/labeled.tsx
@@ -2,7 +2,7 @@
import { Label } from "@/components/ui/label";
import { renderHTML } from "@/plugins/core/RenderHTML";
import React, { PropsWithChildren } from "react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Props {
label: string | null | undefined;
diff --git a/frontend/src/plugins/impl/data-frames/forms/form.tsx b/frontend/src/plugins/impl/data-frames/forms/form.tsx
index a79558931e..b02b45cf10 100644
--- a/frontend/src/plugins/impl/data-frames/forms/form.tsx
+++ b/frontend/src/plugins/impl/data-frames/forms/form.tsx
@@ -28,7 +28,7 @@ import { Button } from "../../../../components/ui/button";
import { getDefaults, getUnionLiteral } from "./form-utils";
import { PlusIcon, Trash2Icon } from "lucide-react";
import { FieldOptions } from "@/plugins/impl/data-frames/forms/options";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
import React, { useContext, useEffect } from "react";
import {
ColumnFetchValuesContext,
diff --git a/frontend/src/plugins/impl/data-frames/panel.tsx b/frontend/src/plugins/impl/data-frames/panel.tsx
index aef0bc45aa..5918b1c8d0 100644
--- a/frontend/src/plugins/impl/data-frames/panel.tsx
+++ b/frontend/src/plugins/impl/data-frames/panel.tsx
@@ -33,7 +33,7 @@ import {
PlusIcon,
Trash2Icon,
} from "lucide-react";
-import { cn } from "../../../lib/utils";
+import { cn } from "../../../utils/cn";
import {
ColumnFetchValuesContext,
ColumnInfoContext,
diff --git a/frontend/src/plugins/layout/CalloutPlugin.tsx b/frontend/src/plugins/layout/CalloutPlugin.tsx
index 50eba4271e..a53aaabfe0 100644
--- a/frontend/src/plugins/layout/CalloutPlugin.tsx
+++ b/frontend/src/plugins/layout/CalloutPlugin.tsx
@@ -2,7 +2,7 @@
import { z } from "zod";
import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
-import { CalloutOutput } from "../../editor/output/CalloutOutput";
+import { CalloutOutput } from "../../components/editor/output/CalloutOutput";
import { Intent, zodIntent } from "../impl/common/intent";
interface Data {
diff --git a/frontend/src/plugins/layout/DownloadPlugin.tsx b/frontend/src/plugins/layout/DownloadPlugin.tsx
index bb39ea5511..abcbc61d72 100644
--- a/frontend/src/plugins/layout/DownloadPlugin.tsx
+++ b/frontend/src/plugins/layout/DownloadPlugin.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
import { DownloadIcon } from "lucide-react";
import { buttonVariants } from "@/components/ui/button";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Data {
/**
diff --git a/frontend/src/plugins/layout/JsonOutputPlugin.tsx b/frontend/src/plugins/layout/JsonOutputPlugin.tsx
index ede1fda739..a0de2dd076 100644
--- a/frontend/src/plugins/layout/JsonOutputPlugin.tsx
+++ b/frontend/src/plugins/layout/JsonOutputPlugin.tsx
@@ -1,9 +1,9 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { z } from "zod";
-import { JsonOutput } from "../../editor/output/JsonOutput";
+import { JsonOutput } from "../../components/editor/output/JsonOutput";
import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
-import { EmotionCacheProvider } from "../../editor/output/EmotionCacheProvider";
+import { EmotionCacheProvider } from "../../components/editor/output/EmotionCacheProvider";
interface Data {
name?: string | null;
diff --git a/frontend/src/plugins/layout/StatPlugin.tsx b/frontend/src/plugins/layout/StatPlugin.tsx
index 519361d100..db16f2cccd 100644
--- a/frontend/src/plugins/layout/StatPlugin.tsx
+++ b/frontend/src/plugins/layout/StatPlugin.tsx
@@ -3,7 +3,7 @@
import { z } from "zod";
import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
import { TriangleIcon } from "lucide-react";
-import { cn } from "@/lib/utils";
+import { cn } from "@/utils/cn";
interface Data {
value: string;
diff --git a/frontend/src/stories/app-chrome.stories.tsx b/frontend/src/stories/app-chrome.stories.tsx
index 2b1fae02c3..2b5e61518d 100644
--- a/frontend/src/stories/app-chrome.stories.tsx
+++ b/frontend/src/stories/app-chrome.stories.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { TooltipProvider } from "@/components/ui/tooltip";
-import { AppChrome } from "@/editor/chrome/wrapper/app-chrome";
+import { AppChrome } from "@/components/editor/chrome/wrapper/app-chrome";
import type { Meta, StoryObj } from "@storybook/react";
const meta: Meta<typeof AppChrome> = {
diff --git a/frontend/src/stories/callout.stories.mdx b/frontend/src/stories/callout.stories.mdx
index 1da36efe19..ef4d1c1f7a 100644
--- a/frontend/src/stories/callout.stories.mdx
+++ b/frontend/src/stories/callout.stories.mdx
@@ -1,6 +1,6 @@
import { Meta, Story } from "@storybook/addon-docs";
-import { CalloutOutput } from "@/editor/output/CalloutOutput";
+import { CalloutOutput } from "@/components/editor/output/CalloutOutput";
import { Mail, Loader2 } from "lucide-react";
<Meta title="CalloutOutput" component={CalloutOutput} />
diff --git a/frontend/src/stories/cell-status.stories.tsx b/frontend/src/stories/cell-status.stories.tsx
index b10613f2e1..4ce954373f 100644
--- a/frontend/src/stories/cell-status.stories.tsx
+++ b/frontend/src/stories/cell-status.stories.tsx
@@ -3,7 +3,7 @@ import type { Meta, StoryFn } from "@storybook/react";
import {
CellStatusComponent,
CellStatusComponentProps,
-} from "@/editor/cell/CellStatus";
+} from "@/components/editor/cell/CellStatus";
import { TooltipProvider } from "@/components/ui/tooltip";
const meta: Meta<typeof CellStatusComponent> = {
diff --git a/frontend/src/stories/cell.stories.tsx b/frontend/src/stories/cell.stories.tsx
index 343f2bf692..a49afebb71 100644
--- a/frontend/src/stories/cell.stories.tsx
+++ b/frontend/src/stories/cell.stories.tsx
@@ -1,8 +1,8 @@
/* Copyright 2023 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
-import { Cell, CellProps } from "../editor/Cell";
+import { Cell, CellProps } from "../components/editor/Cell";
import { TooltipProvider } from "../components/ui/tooltip";
-import { CellId } from "../core/model/ids";
+import { CellId } from "../core/cells/ids";
const meta: Meta<typeof Cell> = {
title: "Cell",
diff --git a/frontend/src/stories/editor-inputs.stories.tsx b/frontend/src/stories/editor-inputs.stories.tsx
index 2a1ec65480..1a8ff29827 100644
--- a/frontend/src/stories/editor-inputs.stories.tsx
+++ b/frontend/src/stories/editor-inputs.stories.tsx
@@ -1,6 +1,6 @@
/* Copyright 2023 Marimo. All rights reserved. */
import { StoryFn, Meta } from "@storybook/react";
-import { Button, Input } from "../editor/inputs/Inputs";
+import { Button, Input } from "../components/editor/inputs/Inputs";
import { PlayIcon } from "lucide-react";
export default {
diff --git a/frontend/src/stories/variables.stories.tsx b/frontend/src/stories/variables.stories.tsx
index becac7bc1e..ee97380709 100644
--- a/frontend/src/stories/variables.stories.tsx
+++ b/frontend/src/stories/variables.stories.tsx
@@ -1,7 +1,7 @@
/* Copyright 2023 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
import { VariableTable } from "@/components/variables/variables-table";
-import { CellId } from "@/core/model/ids";
+import { CellId } from "@/core/cells/ids";
const meta: Meta<typeof VariableTable> = {
title: "VariableTable",
diff --git a/frontend/src/theme/useTheme.ts b/frontend/src/theme/useTheme.ts
index 7634adb549..bee8f344b3 100644
--- a/frontend/src/theme/useTheme.ts
+++ b/frontend/src/theme/useTheme.ts
@@ -2,7 +2,7 @@
import { store } from "@/core/state/jotai";
import { useAtomValue } from "jotai";
import { useEffect, useState } from "react";
-import { userConfigAtom } from "@/core/state/config";
+import { userConfigAtom } from "@/core/config/config";
export type Theme = "light" | "dark";
diff --git a/frontend/src/lib/utils.ts b/frontend/src/utils/cn.ts
similarity index 100%
rename from frontend/src/lib/utils.ts
rename to frontend/src/utils/cn.ts
diff --git a/frontend/src/core/model/typed.ts b/frontend/src/utils/typed.ts
similarity index 100%
rename from frontend/src/core/model/typed.ts
rename to frontend/src/utils/typed.ts
diff --git a/frontend/vite.lib.config.ts b/frontend/vite.lib.config.ts
deleted file mode 100644
index b63ed465a7..0000000000
--- a/frontend/vite.lib.config.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { defineConfig } from "vite";
-import { resolve } from "path";
-import react from "@vitejs/plugin-react-swc";
-import tsconfigPaths from "vite-tsconfig-paths";
-
-// https://vitejs.dev/config/
-/**
- * Vite config for building the Marimo library.
- */
-export default defineConfig({
- build: {
- lib: {
- // Could also be a dictionary or array of multiple entry points
- entry: resolve(__dirname, "src/index.ts"),
- formats: ["cjs"],
- fileName: "marimo",
- },
- outDir: "lib",
- rollupOptions: {
- // Externalize deps that shouldn't be bundled into the library.
- external: ["react", "react-dom"],
- },
- },
- plugins: [react(), tsconfigPaths()],
-});