# Rebuild a site as a theme

Source: https://developers.swell.is/storefronts/rebuild-a-site-as-a-theme

This guide rebuilds an existing website as a theme in code, from the source site to a storefront you can compare side by side. Its steps use a theme for [Wave](https://developers.swell.is/storefronts/wave-app), Swell's storefront app, whose page covers every file a theme holds.

> **Developers:** **Set up your coding agent.** Paste this prompt into Claude Code, Codex, Cursor or GitHub Copilot. It installs Swell's skills, connects your agent to your store through the Swell MCP server, and installs the Swell CLI.

```txt
Fetch and follow the instructions at
https://developers.swell.is/agent-setup/prompt.md to set me up for Swell.
I'm building Swell apps and themes, so include the Swell CLI.
```

## 1. Choose how close to go

- Recreate it closely: your own site, or a client's with their permission.
- Take its look and feel: its colors, type and layout ideas, with your own sections and copy.
- Start from a theme: one of Swell's free themes, such as Tide, with its design settings changed to match.

Rebuild only sites you own or have permission to copy. Then choose how to build it. A theme app in code can be reused, published in the Theme Store or handed to clients, and is what this guide covers. For one store without code, the editor can rebuild a website itself: see Redesigning a storefront and Importing a theme from another platform in the [Wave guide](https://developers.swell.is/app-guides/wave).

## 2. Capture the source pages

Save each kind of page from the source site at desktop and phone widths: home, a category, a product, search results, the cart and a content page. Note its colors, fonts, spacing, the header and footer and their menus, and the parts that are particular to the brand, such as a price box or deal tiles. These are what you compare against at the end.

## 3. Import the catalog

A theme shows store data, so the storefront needs the products, images and categories first. Create categories, then products, and put each product in its categories with `categories: [{parent_id}]` (see Create a product in the Backend API). Swell doesn't fetch images by URL: send each one inline with its product as `$base64`. For a Shopify store, Migrate from Shopify covers the public catalog and the Admin API.

## 4. Set up menus

Recreate the header and footer menus in the editor's menu panel, or by API with the storefront's menus config: see Setting up menus by API in [Wave](https://developers.swell.is/storefronts/wave-app). The theme's `theme/config/editor.json` sets how many levels and links each menu area takes, up to 3 levels.

## 5. Set the design

Put the source site's colors, fonts, corner radii and spacing in `theme/config/settings.json`, as values of the theme's design tokens. Each font needs its faces from Google Fonts' CSS2 stylesheet. See Design settings in [Wave](https://developers.swell.is/storefronts/wave-app).

## 6. Write the sections

Start with the header and footer groups, then the templates for each page type. Core sections change only through tokens and theme settings, so where the source site's layout differs, write a section of your own built from ui-kit pieces, such as a large price box on the product page built from `ProductForm` and `Price`. Section code doesn't run in the shopper's browser: interactive parts come from ui-kit or from an app's embed blocks.

Core sections and blocks, and ui-kit, in [Wave](https://developers.swell.is/storefronts/wave-app) cover the pieces to build from, such as menus up to 3 levels deep for a mega menu, a header that stays in view, and deal tiles.

## 7. Add features from apps

Features beyond display, such as quotes, store finders, rewards balances or live chat, come from apps. An app gives a theme data sources, form actions, embed blocks and pages of its own (see [Storefront extensions](https://developers.swell.is/storefronts/storefront-extensions)), and a theme that's built around one requires it (see [Required apps](https://developers.swell.is/storefronts/required-apps)).

## 8. Check, build, push and compare

```sh
swell theme check
swell theme build
cd app && swell app push
```

The first push creates a storefront for the theme and prints its preview link. Open it next to the source site at the same widths, page type by page type, and work through the differences: data first, then layout, then design.
