# Files and code

Source: https://modulify.ai/docs/editor/files-and-code

Browse the files of your site, read, copy or download them on Pro, and export the code as a zip.

Every Modulify site is a real codebase, and the File Explorer tab lets you browse it on every plan and read it on Pro. It is a reader, not a code editor: files open read only, and changes go through chat.

## Open the File Explorer

The tab lives behind **More** in the tab strip. Click **More**, then **File Explorer**. It has two sub-tabs, **Files** and **Settings**.

## Browse the tree

The tree sits on the left under a **Files** heading. Click a folder to open it and a file to open it in a tab. In a project with 400 or more files every folder starts closed, so the tree opens quickly; a smaller project opens with every folder open. Files and folders your site's `.gitignore` leaves out are dimmed, and hovering one reads `This file is ignored by .gitignore` or `This folder is ignored by .gitignore`.

Three buttons sit at the top of the tree: **Collapse all**, **Expand all** and **Search**. **Search** opens a filter box under the heading, placeholded `Filter files`, which narrows the tree as you type, including files inside closed folders. Cmd or Ctrl with Shift and F swaps the tree for a **Search** panel, placeholded `Search files...`, where you type at least 2 characters to match file names and paths, with results capped at 100. A search with no hits reads `No matches` with `Try a different word or file name.` The cross at the top of the panel closes it and brings the tree back.

When the filter matches nothing the tree reads `No matches` with `Clear the filter to see all files.`, and on a site with no files yet it reads `No files` with `Files appear here once the site generates.`

Cmd or Ctrl with B hides and shows the tree. When the panel is too narrow to hold the tree beside the file, it collapses into a **Files** button that opens it as a drawer.

If your code cannot be reached, the tree never pretends the site is empty. It reads `Could not load files` with `Your site code is unreachable right now.` and a **Try again** button, which puts the tree back into its loading state and asks again. The search panel shows the same message. It does not mean your files are gone, and nothing is saved over them while the code is unreachable.

## Work with open files

Open files stack as tabs across the top. Right click a tab for **Close**, **Close others**, **Close to the left**, **Close to the right** and **Close all**. Options that have nothing to act on are greyed out. Your open tabs and the file in front are remembered for the next time you open the site. Clicking a file chip in chat opens that file here too, with the folders above it opened.

With no file open the panel reads `No file open` and `Choose a file from the tree.` If the file you had open has since gone, it reads `The file may have been deleted.` A file that cannot be opened reads `Could not load file` with `This file could not be read now.`, and a file that is no longer in the saved code reads `No saved file` with `This file is missing from saved code.`, each with its own **Try again**. When the whole tree could not be loaded, an open file reads `Could not load file` with `Your site code is unreachable right now.`

The tree and open files follow your saved code. When a chat message, a preview sync or a restore saves new code, files it changed reload, files it removed close, and new files appear, for everyone with the editor open. On a site with [several chats](https://modulify.ai/docs/build/multiple-chats), a chat's changes reach the tree when they are merged into the site, and until then they show in that chat's **Changes** panel.

## Read a file

Code opens with line numbers, syntax highlighting, bracket matching and folding. It is read only, so to change something, describe the change in chat.

The toolbar above the file opens with the file's icon and name, so you can tell what you are reading without looking back at the tabs.

On the right sit **Reference** and a three dots menu holding **Copy**, which copies the whole file and flips to `Copied!`, and **Download**, which saves that single file. For an image other than an SVG the menu holds only **Download**.

Opening, copying and downloading files needs a Pro plan, the same as [exporting the whole site](https://modulify.ai/docs/editor/files-and-code#export-the-whole-site). On Free and Starter the tree, its search and your tabs work as usual, but a file you open, an image included, shows placeholder lines fading out under a **Pro** badge, `Files need Pro` and `Upgrade to Pro to view your files.` instead of its content. **Upgrade to Pro** there opens `Upgrade to view files`, where you can move to Pro. **Copy** and **Download** are disabled, with the tooltips `Copying code requires a Pro plan.` and `Downloading files requires a Pro plan.`, while **Reference** still works, so you can point chat at a file you cannot open. Chat follows the same rule below Pro: it explains the code and quotes the few lines a change needs, but does not paste whole files.

**Reference** drops a chip for the open file into the chat box, the same chip the `@` picker places, so you can write "tidy up [File #1]" without typing the path. It is greyed out once that file is already in your message, with the tooltip `This file is already referenced in your message.` [Attachments and context](https://modulify.ai/docs/build/attachments) covers what you can then do with the chip.

Images open as a preview rather than as text. An SVG gets a **Code** and **View** switch so you can flip between its markup and the rendered image.

## GitHub workflow files

Files in the `.github/workflows` folder, the workflows GitHub Actions runs, are never saved with your site's code. The Modulify app on GitHub is not allowed to write them, so every save leaves that folder out and saves every other file. That holds whether the code lives with Modulify or in [your own GitHub](https://modulify.ai/docs/editor/move-code-to-github).

The AI does not write workflow files. When you ask for one, for example to deploy to GitHub Pages, it tells you to add the file yourself on GitHub and can show you its content to copy. If a workflow file still ends up in your site, the save around it goes ahead and a **Workflow files not saved** notice reads `<file> was not saved, because GitHub workflow files can only be added on GitHub. Every other change was saved.`, or gives the number of files when there are several.

To run a workflow, move the code to your own GitHub and add the file there, on GitHub. Workflow files already in your repository stay as they are, because saves, publishes and restores never change or delete them. To publish your site from your own pipeline, call a [deploy hook](https://modulify.ai/docs/automations/deploy-hooks).

## Export the whole site

The **Settings** sub-tab has one section, **Export**, described as downloading your whole site as source code you can run anywhere. Moving the code into your own GitHub is a separate thing, on the project's Settings tab, covered in [Move your code to GitHub](https://modulify.ai/docs/editor/move-code-to-github).

**Export .zip** downloads the full source of your site. It requires a Pro plan. On Free and Starter the **Export code** row carries a **Pro** badge and the button is disabled, with the tooltip `Exporting your code requires a Pro plan.`

The file is named after your project slug, for example `my-site-code.zip`. Inside, the source sits in a single folder carrying that same slug, so unzipping it gives you one `my-site` directory holding the whole site.

> **Note**
>
> The export reflects the current preview of your site, which is the same source the editor shows. Publish state does not change what you get.

A finished download shows an `Exported` toast. If the download fails, an `Export failed` toast says why rather than handing you a partial archive. A site whose archive would pass 2 GB answers `Your site is too large to export as a single zip. Move its code to your GitHub, then clone it from there!`, or `Your site is too large to export as a single zip. Clone it from GitHub instead!` once its code already lives in [your GitHub](https://modulify.ai/docs/editor/move-code-to-github). A site with no code yet answers `There is no code to export for this site yet!`, and a temporary problem reading the source answers `Could not read your code from our file partner. Please try again in a moment!`, see [Partner outages](https://modulify.ai/docs/reference/partner-outages). An export never completes with files missing.

## From an AI client over MCP

`list_files` lists the source files and `write_file` replaces files directly in the running preview, both on every plan. `read_file` reads one file and needs a Pro plan, like opening it here: on Free and Starter it answers `Viewing the files of a site needs the Pro plan. Upgrade the workspace to Pro to read them!` When the source cannot be read from the file partner at that moment, `list_files` and `read_file` fail with `Could not read your code from our file partner. Please try again in a moment!`, or `read_file` with `Could not read that file from our file partner. Please try again in a moment!` when only that file could not be fetched, rather than answering with an empty list or an empty file.

`write_file` bypasses the AI entirely, so nothing about the change is explained or reviewed. It is saved to your site's code as soon as the preview confirms it, as a **Preview sync** entry in [Backups](https://modulify.ai/docs/editor/backups). While a chat is running it is saved when the chat ends instead. Take a backup first for anything substantial. It needs the preview to be running, replaces the whole file rather than patching it, and needs the `code:write` scope, which is unticked by default.

On a site with [several chats](https://modulify.ai/docs/build/multiple-chats) it works differently. The files are saved to the site's code straight away, with a **Preview sync** entry in [Backups](https://modulify.ai/docs/editor/backups), and the preview does not have to be running. Chats that are running merge their own changes with yours when their turns end. While another chat is merging, the call waits, and after 30 seconds it is refused with `Another chat is merging changes right now. Try again in a moment!` While the site finishes a restore or move, or its preview moves to a new [environment](https://modulify.ai/docs/editor/environment) or a bigger machine, it is refused with `Changes cannot be saved to this site while it finishes a restore or move. Try again in a moment!`

When you want a change described rather than dictated, `send_message` is the better tool, because the AI reads the surrounding code first.

See [MCP tools](https://modulify.ai/docs/mcp/tools#source-code).

## Next

- [Logs](https://modulify.ai/docs/editor/logs) shows what the code is doing when it runs.
- [Site chat](https://modulify.ai/docs/build/site-chat) is how you change any of these files.