Warning: currently the project is compatible with Node.js up to v22.
It breaks under the latest Node.js v23.
This issue will be fixed.
For the time being, I recommend that you use Node.js v22.11 with npm 10.9.
If you're searching for a way to take the small web applications Claude generates with its Artifacts feature, and run them outside of its website, you've come to the right place.
This project provides a standalone environment that mimics the Artifacts runtime, enabling you to run, test, and further develop the code generated by Claude independently from its website.
If you've created a web application or component using Claude's Artifacts feature and want to:
you'll be disappointed to find out that, if you download the artifact code via the download button, you'll only receive a single file containing the main logic of the app, not the full project with all necessary files to run it on your computer.
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 Artifact running as easily and as soon as possible.
This scaffold/boilerplate provides the fastest and easiest way to get your artifact up and running on your machine. It includes all the necessary dependencies and configurations to seamlessly transition your Claude-generated artifact into a fully functional web application in no time.
This project is meant only 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.
Why? Well, because those types of simple static content are easily viewable by other means.
For example, to view Mermaid diagrams, you can use an online viewer/editor, like mermaidflow.app, from which you can also export the diagram to SVG or PNG.
These are the libraries and frameworks this project provides, identical to those available on Claude's Artifacts environment:
Note that the actual versions of the packages currently in use in the Artifacts environment may differ from the ones installed by this project.
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:
Clone the repository:
git clone https://github.com/claudio-silva/claude-artifact-runner.git
cd claude-artifact-runner
Install dependencies:
npm install
Start the development server:
npm run dev
Open your browser and visit http://localhost:5173
to see the default app running.
src/
: Contains the source code for the application
App.tsx
: Main application componentartifact-component.tsx
: Place to paste the component generated by Claudecomponents/
: Reusable UI componentslib/
: Utility functions and helperspublic/
: Static assetsindex.html
: Entry HTML filevite.config.ts
: Vite configurationtsconfig.json
: TypeScript configurationtailwind.config.js
: Tailwind CSS configurationpackage.json
: all the required packages are registered here.src/artifact-component.tsx
, completely replacing the file contents.npm run dev
running, the page should refresh automatically to display the new component.src/index.css
to add additional CSS rules.public
folder.tailwind.config.js
to customize the Tailwind CSS theme.App.tsx
to change the overall layout or add new features.src/components/
directory.
Note: Shadcn UI components installed via
npx
are automatically placed insrc/components
. 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 folder from src/components
.
Use npm remove
to uninstall them.
To create a production build, run:
npm run build
This will generate optimized files in the dist/
directory, ready for deployment.
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 use the serve
package:
Install serve
globally:
npm install -g serve
Navigate to your project directory and run:
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:
dist
folder to your web server's public HTML directory (often called public_html
, www
, or htdocs
).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 build
before 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-pages
package:
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-pages
branch.
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 dist
This command will prompt you to create a new project if one doesn't exist, and then deploy your dist
folder to Cloudflare Pages.
Configure your project (optional):
If you need more control over your deployment, you can create a wrangler.toml
file in your project root:
name = "my-react-app"
compatibility_date = "2024-07-16" # Replace with the current date
[site]
bucket = "./dist"
Note: The account_id
and workers_dev
fields 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.
If you encounter any issues, try the following:
node_modules
folder and run npm install
again.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.
I found Claude-React-Jumpstart when looking for a way to run Artifacts outside of claude.ai.
However, it did not fully meet my needs, so I decided to make my own project, as I wanted something that:
npm install
, and