Prerequisites
- A GitHub or GitLab account
- A Cloudflare account
- Your Simple Charts repository pushed to GitHub/GitLab
Cloudflare Pages Deployment
Connect to Cloudflare Pages
- Go to your Cloudflare Dashboard
- Navigate to Workers & Pages
- Click Create → Pages → Connect to Git
- Select your repository from the list
Configure Build Settings
Set the following build configuration:
| Setting | Value |
|---|---|
| Framework preset | Vite |
| Build command | npm run build |
| Build output directory | dist |
| Root directory | / (default) |
| Node version | 20+ (recommended) |
The build command runs
vite build which compiles your React application and outputs static files to the dist/ directory.Deploy
Click Save and Deploy. Cloudflare Pages will:
- Install dependencies with
npm install - Run the Vite build process
- Deploy the compiled static files from
dist/ - Provide you with a
*.pages.devURL
Build Process
Simple Charts uses Vite for building. The build process:Build Output
When you runnpm run build, Vite:
- Bundles all React components
- Optimizes assets (images, fonts, etc.)
- Generates service worker for PWA functionality
- Outputs everything to
dist/
The application is completely static with no server-side code required.
Environment Configuration
Simple Charts doesn’t require environment variables for basic deployment. All configuration is handled client-side:- Theme preferences: Stored in
localStorage - Chart data: Auto-saved to
localStoragewith keyteacher-chart-maker:v1 - PWA manifest: Configured in
vite.config.js
Automatic Deployments
Cloudflare Pages automatically deploys when you push to your repository:- Production: Deployments from your main/master branch
- Preview: Deployments from pull requests and other branches
Troubleshooting
Build Fails
If the build fails, check:- Node version: Ensure you’re using Node 20+
- Dependencies: Make sure
package.jsonincludes all required dependencies - Build logs: Review Cloudflare’s build logs for specific errors
PWA Not Working
If PWA features aren’t working:- Ensure you’re accessing the site via HTTPS (Cloudflare provides this automatically)
- Check that service worker is registered in browser DevTools
- Verify
manifest.jsonis accessible at/manifest.json