From Claude Artifact to deployable React app — in seconds!
Zero‑config npx tool and template to run, build, or create full projects from Claude AI Artifacts.
- Run an Artifact in seconds, without having to create a project first and build it
- Build single‑file or multi‑file outputs ready to deploy anywhere
- Create a full React + TypeScript + Vite + Tailwind + Shadcn UI project
- Includes additional libraries when needed: Recharts, Lucide React, and more
- Combine multiple Artifacts into a multi‑page app (file‑based routing)
- Run locally or deploy to any web hosting service
Quick start:
# Run an Artifact
npx run-claude-artifact my-app.tsx
# Build for deployment (single-file by default)
npx run-claude-artifact build my-app.tsx
# Create a full editable project
npx run-claude-artifact create my-app.tsx- Claude Artifact Runner
- Table of Contents
- What are Artifacts and why this project?
- Use Cases
- Quick Start
- Limitations
- What's included?
- Prerequisites
- Installation
- Alternative Methods of Installation
- After installation
- Installing a single Artifact
- Creating a multi-page application
- Developing a more complex application
- Project structure
- Building for production
- Deploying your application
- Available npm Scripts
- Troubleshooting
- Contributing
- License
- Acknowledgements
Artifacts are interactive web applications created by Claude AI, and they are a great way to get started with web development.
They are typically created in a web browser at Claude's website, and then saved as a single file containing the main logic of the app.
Claude already provides both Copy and Download buttons for you to get the Artifact code, but it does not provide either:
- the final files that are needed to run the Artifact independently,
- or the full project needed to develop it further.
Note that the code loaded by your web browser to run the Artifact is not the same as the code you copy or download from the web interface; the former is a transpiled, minimized and bundled version that includes all the necessary libraries (e.g., React) required to run it (i.e. the files that result from a build process); the latter is the raw code that you can copy and paste into your own project.
If you're unfamiliar with the technologies used on the project, you'll have a hard time assembling and configuring all the required libraries and tooling required to make a running standalone app.
Even if you're an experienced developer, you may just want to save time and effort and get the Artifacts running as easily and as soon as possible.
This template project, and the accompanying npx command, provide the fastest and easiest way to get your Artifacts up and running on your machine.
It includes all the necessary dependencies and configurations to seamlessly transition your Claude-generated Artifacts into a fully functional web application in no time.
- Run Artifacts on your local machine, on a web server or on a cloud service.
- Use Artifacts as a starting point for a new project and then extend it with custom code.
- Create a new web application and add some Artifacts to it.
- Develop an Artifact Creator web application and use the
npxcommand to dynamically run or download them. - Use the
npxcommand as part of a CI/CD build pipeline. - Or don't use Artifacts at all and just use the project as a starting point for your custom coded web application.
- Download the Artifact to your local machine, as a
.tsxor.jsxfile. - Run it: On the terminal, run
npx run-claude-artifact <path-to-file> - Wait a few seconds. A browser window or tab will open and you'll see your Artifact running. When finished, press
Ctrl+Con the terminal to stop the preview server.
If you don't have an Artifact to run yet, and just want to try out the project, run npx run-claude-artifact with no arguments to see a demo.
- Download the Artifact to your local machine, as a
.tsxor.jsxfile. - Build it: On the terminal, run
npx run-claude-artifact build <path-to-file>
The tool outputs an HTML file in your current directory, which contains all the code for running the application (HTML, CSS, JavaScript and a favicon).
This file can be deployed to any static web hosting service or cloud platform.
There are two build types, with different preview methods:
-
Single-file builds (e.g.,
npx run-claude-artifact build <file>, as explained above):- Can be opened directly from the filesystem (double-click the HTML file or open the URL
file://path/to/file.html). - Multiple pages are supported via HashRouter, so navigation works under
file://.
- Can be opened directly from the filesystem (double-click the HTML file or open the URL
-
Multi-file builds (e.g.,
npx run-claude-artifact build <file> -e):- Require a local web server to view them because additional files (like CSS and JavaScript files) cannot be loaded from the filesystem directly (
file://URLs) because of browser security restrictions. - Use the
viewsubcommand to preview locally:npx run-claude-artifact view artifact-directory-name(serve the directory)- The tool launches a temporary web server and opens your browser. Press
Ctrl+Cto stop.
- Require a local web server to view them because additional files (like CSS and JavaScript files) cannot be loaded from the filesystem directly (
Instead of just viewing or building an Artifact, you may create a full project for further development, and optionally push it to your own Git repository.
Built with modern web development essentials including TypeScript, Tailwind CSS, Shadcn UI, and file-based routing, this pre-configured setup lets you focus on development rather than configuration. As a standard React application, you have the freedom to extend it with any features you need, from backend services like Supabase to web frameworks such as Express, Fastify or Hono.
You can blend AI-generated Artifacts with your own custom code, incorporate code generated by other AI tools, such as v0.dev, or even build applications without any Artifacts at all and just start with a base project template to power your custom development.
You'll be able to deploy your app anywhere, whether locally for your own use, in a company intranet or in a public-facing production environment, at the webhosting or cloud provider of your choice.
See the Installation section below for detailed installation instructions and advanced options.
This project is meant for running Artifacts that are interactive web apps, usually made in React, and for which Claude writes Javascript or Typescript code.
Mermaid diagrams, SVGs, and other document-type Artifacts are out of the project’s scope.
Also, Claude's Artifacts run client-side only (i.e. in the browser). As such, they are limited in their capabilities.
If you need a full-stack application (with database, APIs, etc.), I'll be honest, this is not the best project for that, as it does not provide a backend.
Nevertheless, it does provide a good starting point. You can still add a server-side framework to create a full-stack application, or use a cloud Backend service like Supabase or Firebase.
These are the libraries and frameworks this project provides, identical* to those available on Claude's Artifacts environment:
- React 18 for building user interfaces.
- TypeScript to support Artifacts written in type-safe Javascript.
- Vite for fast development and building.
- Shadcn UI for pre-built, customizable components.
- Tailwind CSS for compact and expressive embedded styling.
- Recharts for creating dynamic, customizable charts and data visualizations.
- Lucide React for a comprehensive library of open-source icons designed for React applications.
* Note that the actual versions of the packages currently in use in the Artifacts environment may differ from the ones installed by this project, as Anthropic may update them from time to time.
If a component generated by Claude fails to run properly because of an outdated package, please let me know.
Before you begin, ensure you have the following installed:
- Node.js minimum supported version is 20 (lts/iron), tested up to version 23.2, version 22.11 is recommended
- npm (usually comes with Node.js)
- npx (comes with npm 5.2+ and higher)
- git (required for project creation and optional repository creation)
Start by downloading your Artifact to your local machine, as a .tsx or .jsx file.
npx run-claude-artifact [run|view|build|create] <src-file> [options]Arguments:
<src-file>: Path to a.tsx/.jsxfile (forrun/build/create) or.htmlfile/directory (forview)
Subcommands:
run(default): Run artifact in development serverview: Serve a built HTML file or directorybuild: Build and output filescreate: Create full editable project
| Subcommand | Description |
|---|---|
run (default) |
Run artifact in development server |
view |
Serve a built HTML file or directory |
build |
Build and output files |
create |
Create full editable project |
npx run-claude-artifact my-app.tsx # Run dev server (default)
npx run-claude-artifact run my-app.tsx # Same as above
npx run-claude-artifact run my-app.tsx --build # Build single-file and run preview
npx run-claude-artifact run my-app.tsx --build --expanded # Build multi-file and run preview
npx run-claude-artifact run my-app.tsx --build --strict # Build with strict checkingnpx run-claude-artifact build my-app.tsx # Single HTML file (no strict checking)
npx run-claude-artifact build my-app.tsx --strict # Single HTML file (with strict checking)
npx run-claude-artifact build my-app.tsx --expanded # Multi-file deployment
npx run-claude-artifact build my-app.tsx --deploy-dir /var/www # Custom output locationnpx run-claude-artifact view my-app.html # Serve single-file application
npx run-claude-artifact view my-app # Serve directory with multi-file applicationnpx run-claude-artifact create my-app.tsx # Create editable project
npx run-claude-artifact create my-app.tsx --remote <url> --push # Create + git + push--build: Build project and run preview server instead of dev server--strict: Enable strict TypeScript checking during build (requires --build)-e, --expanded: Create multi-file build instead of single-file (requires --build)
-e, --expanded: Create multi-file deployment instead of single HTML--deploy-dir <path>: Output directory for built files--strict: Enable strict TypeScript checking during build
--project-dir <path>: Target directory for the project--remote <url>: Git remote repository URL--push: Push to remote repository after creation
-h, --help: Show this help message
| Option | Applicable To | Description |
|---|---|---|
--build |
run |
Build project and run preview server instead of dev server |
--strict |
run, build |
Enable strict TypeScript checking during build |
--expanded, -e |
run, build |
Create multi-file build instead of single-file |
--deploy-dir <path> |
build |
Output directory for built files |
--project-dir <path> |
create |
Target directory for the project |
--remote <url> |
create |
Git remote repository URL |
--push |
create |
Push to remote repository after creation |
--help, -h |
All | Show help message |
The script follows different sequences based on the subcommand:
- Clone & Setup → Clone template, remove .git/npx, copy your artifact
- Run/Preview → Start dev server (or build + preview if
--buildused), open in browser, block until Ctrl+C - Cleanup → Remove temporary directory
- Clone & Setup → Clone template, remove .git/npx, copy your artifact
- Build → Build project (with
--expandedaffecting build type) - abort on failure - Deploy → Copy built files to output directory
- Cleanup → Remove temporary directory
- Start Server → Launch web server to serve the specified HTML file
- Block → Run until Ctrl+C
- Clone & Setup → Clone template, remove .git/npx, copy your artifact
- Create Project → Move full project to target directory
- Git Setup → Initialize repository, add remote, commit, push if requested
- Cleanup → Remove temporary directory
| Subcommand | Input | Output | Server | Blocks? | Purpose |
|---|---|---|---|---|---|
run (default) |
.tsx/.jsx |
❌ | ✅ Dev/Preview | ✅ | Interactive testing |
build |
.tsx/.jsx |
✅ Files | ❌ | ❌ | Generate deployment files |
view |
.html |
❌ | ✅ Static | ✅ | Serve built files |
create |
.tsx/.jsx |
✅ Project | ❌ | ❌ | Development workspace |
| Build Type | --deploy-dir | Default Path | Output |
|---|---|---|---|
| Single file | ❌ | Current Working Directory | CWD/my-app.html |
| Single file | ✅ | /path/to/deploy |
/path/to/deploy/my-app.html |
| Multi-file | ❌ | CWD + filename | CWD/my-app/index.html + CWD/my-app/assets/ |
| Multi-file | ✅ | /path/to/deploy |
/path/to/deploy/index.html + /path/to/deploy/assets/ |
- Git is always required (for initially cloning the template)
- Single-file builds embed the favicon as a data URL; multi-file builds keep
public/favicon.icoin the output and reference it normally
gh repo create my-project-name --template claudio-silva/claude-artifact-runner --private --clone
cd my-project-name
# Replace the demo artifact with your own
cp path/to/your-artifact.tsx src/artifacts/index.tsx
npm run devBest for: Creating a GitHub repository for your project without using the npx command.
- Go to github.com/claudio-silva/claude-artifact-runner
- Click the green "Use this template" button
- Choose "Create a new repository"
- Name your repository and choose visibility settings
- Clone your new repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name npm install npm run dev
Note: Forking is generally not recommended unless you plan to contribute back to the original project, as it maintains a connection to the upstream repository.
If you do fork:
- Fork the repository on GitHub
- Clone your fork
- Consider unlinking from upstream if you don't plan to contribute back:
git remote remove upstream # Remove connection to original repo
The default app is composed of two demo components: a login form and a signup form. You can navigate between them by clicking on the link at the bottom of the form.
These demo pages/components are just for demonstration purposes and can be easily replaced with your own components, either generated by Claude or created by yourself.
This will NOT be the UI of your application.
If you have created a project and you want to install or update an Artifact on it, you can follow these simple steps:
- Make sure the development server is running. If not, start it by running
npm run dev. - Leave the browser open at the initial page and leave the development server running.
- Delete the files in the
src/artifacts/directory. - Download your Artifact from Claude.ai
- Move the file to the
src/artifacts/directory and rename it toindex.tsx. - You'll immediately see your Artifact running on the open browser tab.
You'll be viewing the app in development mode. To generate the final app, ready for production, you'll need to build it first:
- Use
npm run buildto generate the release files. - Or use
npm run build:singleto generate a single file containing the entire application. - You'll find the built files in the
dist/directory.
If you want to create a multi-page application, you can follow these steps:
- Follow the previous section's steps.
- Generate more Artifacts using Claude and download them to the
src/artifacts/directory. - Give each file it a unique name, such as
your-component.tsx. Each component you add will be a new page accessible athttp://localhost:5173/your-component-name(without the.tsxextension). - If you have
npm run devrunning in the background, the new pages will be ready to display immediately. If a page is already open when being updated, it will refresh automatically. - You can link Artifacts to each other to build a multi-page application.
It's easy: on each Artifact page, just add links that navigate to the other Artifacts, by specifying their names without the
.tsxextension.
E.g.<a href="my-component">Go to My Component</a> - You can also use the
useNavigatehook to navigate to a specific page. - Finally, to create a release build and publish your finished application, follow the instructions further below.
If you intend to create a more advanced application, you'll probably want to customize its visual appearance by changing styles, adding images and new components, creating a base layout with a top header and a sidebar with the main navigation menu, etc.
This section is intended for advanced users only, and is not required for simple applications.
- For styling:
- Prefer using Tailwind classes directly in components.
- Use
src/index.cssonly for Tailwind configuration and critical global styles. - For component-specific styles, use CSS Modules (*.module.css).
- For complex styling needs (such as dynamic styles), consider styled-components or other CSS-in-JS solutions.
- Modify
tailwind.config.mjsto customize the Tailwind CSS theme.
- Place static assets (such as images) in the
publicfolder. - Update
main.tsxto change the overall layout of the app (e.g. adding a navigation bar). - Add or modify components in the
src/components/directory.Note: Shadcn UI components installed via
npxare automatically placed insrc/components/ui. All components come pre-installed by default, but if you remove some and later want to reinstall any, you may simply runnpx shadcn-ui@latest add <your-component>.
The Recharts library and ALL Shadcn UI components come pre-installed, so that all code that Claude may generate will run out-of-the-box.
If you just want to run the Artifact locally, you may leave things as they are, but if you want to deploy the application or use it as a base for a larger project, you may want to optimize the application's bundle size.
To do that, you may remove the pre-installed components or libraries that are not required by your application.
Just delete the component's files from src/components/ui.
Use npm remove to uninstall them.
| Directory/File | Description |
|---|---|
dist/ |
Compiled output |
public/ |
Standalone static assets |
src/ |
Contains the source code for the application |
src/artifacts/ |
The Artifacts generated by Claude should be placed here |
src/assets/ |
Static assets for the build system |
src/components/ |
Bundled Shadcn UI components |
src/lib/utils.ts |
Utility functions and helpers |
src/index.css |
Tailwind styles |
src/main.tsx |
Entry point of the application |
src/vite-env.d.ts |
Type definitions for Vite |
.eslintrc.cjs |
ESLint configuration |
components.json |
Shadcn UI components configuration |
index.html |
Entry HTML file |
jsconfig.json |
JSON configuration |
postcss.config.js |
PostCSS configuration |
tailwind.config.mjs |
Tailwind CSS configuration |
tsconfig.app.json, tsconfig.json, tsconfig.node.json |
TypeScript configuration |
package.json |
All the required packages are registered here |
vite.config.ts |
Vite configuration |
For smaller applications with one page, or just a few pages, you may build the application as a single file. Run:
npm run build:single
This will generate a single file in the dist/ directory, ready for deployment.
If you want to build a single file with rigorous code validation, run:
npm run build:single:strict
This will catch more errors and warnings during the build process, but sometimes, it may also flag valid code as errors if code is not written in a specific way.
Disabled by default, since many AI-generated artifacts fail strict checks, despite working fine in normal mode.
You can also catch more potential errors if you run a linter before building. Run:
npm run lint
To create a production build as a set of separate files for each asset and each page, run:
npm run build
This will generate optimized files in the dist/ directory, ready for deployment.
Remember that you cannot run a multi-file application by opening the
dist/index.htmlfile directly from the filesystem to view it, as the browser will block it due to security restrictions. You need to use a local web server (e.g. runnpx serve dist).
Because a multi-file build offers several advantages for larger applications:
- Faster initial load times - Only the required files for the current page are loaded
- Better caching - Shared resources (like common libraries) are cached separately
- Progressive loading - Users can interact with parts of the app while other resources load
- Smaller updates - When making changes, only modified files need to be redeployed
- Better error isolation - Issues in one page won't block the entire application
If you want to build a multi-file application with rigorous code validation, run:
npm run build:strict
You can even catch more potential errors if you run a linter before building. Run:
npm run lint
After running npm run build, you'll have a dist folder containing the built files (typically an HTML file, a JavaScript file, and a CSS file).
Here are several ways to deploy these files:
For local testing of the production build, you can also use the serve npx package:
-
Navigate to your project directory and run:
npx serve -s dist -
Open a browser and go to
http://localhost:3000(or the URL provided in the terminal).
If you want to deploy to a shared or dedicated web server:
- Upload the contents of the
distfolder to your web server's public HTML directory (often calledpublic_html,www, orhtdocs).
Remember to update any necessary configuration files (like vite.config.ts) before building your app if it is not being served from the root of your domain.
For example, for vite.config.ts, you may configure it like this:
export default {
base: '/subdirectory/', // Set this to the path your app is served from
// other configurations
};Here are some popular free cloud hosting platforms and how to deploy your app to them:
Remember to run
npm run buildbefore deploying to ensure you're uploading the latest version of your app.
-
Install the Netlify CLI:
npm install -g netlify-cli -
Run the following command in your project directory:
netlify deploy -
Follow the prompts. When asked for the publish directory, enter
dist. -
For production deployment, use:
netlify deploy --prod
-
Install the Vercel CLI:
npm install -g vercel -
Run the following command in your project directory:
vercel -
Follow the prompts. Vercel will automatically detect that it's a Vite project and use the correct settings.
-
If you haven't already, create a GitHub repository for your project.
-
Install the
gh-pagespackage:npm install gh-pages --save-dev -
Add these scripts to your
package.json:"scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d dist" }
-
Run:
npm run deploy -
Set up GitHub Pages in your repository settings to use the
gh-pagesbranch.
You can deploy to Cloudflare Pages either through the Cloudflare dashboard or using the wrangler CLI tool. Here's how to do it using wrangler, which is often the most straightforward method:
-
Install Wrangler:
npm install -g wrangler -
Login to Cloudflare:
wrangler login -
Deploy your project:
wrangler pages deploy distThis command will prompt you to create a new project if one doesn't exist, and then deploy your
distfolder to Cloudflare Pages. -
Configure your project (optional): If you need more control over your deployment, you can create a
wrangler.tomlfile in your project root:name = "my-react-app" compatibility_date = "2024-07-16" # Replace with the current date [site] bucket = "./dist"
Note: The
account_idandworkers_devfields are typically not needed for Cloudflare Pages deployments. -
Custom domain and production settings: To use a custom domain or configure production settings, you can use the Cloudflare Pages dashboard. There, you can set up your domain, configure environment variables, and manage other deployment settings.
When working with the project directly (not using the npx command), you can use these npm scripts:
| Script | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build multi-file artifact (separate JS/CSS files) |
npm run build:single |
Build single-file artifact (inlined assets) |
npm run build:strict |
Build multi-file with TypeScript strict checking |
npm run build:single:strict |
Build single-file with TypeScript strict checking |
npm run preview |
Preview built artifacts locally |
npm run lint |
Run ESLint |
- Multi-file builds (
build,build:strict): Create separate HTML, JS, and CSS files in thedist/directory - Single-file builds (
build:single,build:single:strict): Create a single self-contained HTML file with all assets inlined - Strict builds (
build:strict,build:single:strict): Include TypeScript type checking before building - Regular builds (
build,build:single): Skip TypeScript checking for faster builds
If you encounter any issues, try the following:
- Clear your browser cache and restart the development server.
- Delete the
node_modulesfolder and runnpm installagain. - Make sure your Node.js version is compatible with the project requirements.
- Check for any error messages in the console and search for solutions online.
If problems persist, please open an issue on this project's GitHub repository.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Thanks to IntranetFactory for contributing the routing solution for handling multiple Artifacts.