# MachineEEE Machinery Cloudflare Pages Deployment

## Recommended Host

Use Cloudflare Pages for the first production release.

## Local Readiness Check

- Static site directory: `imachinemall-independent-template`
- Production upload directory used by Wrangler: `xiaosi-pages-dist`
- Build step: none
- Global Wrangler CLI: not installed
- Cloudflare local auth: logged in through Wrangler OAuth on 2026-06-09
- GitHub CLI: not installed
- Git repository: local repo exists, but there are no commits and no remote yet

## Current Cloudflare Pages Deployment

- Cloudflare Pages project: `xiaosimachinery`
- Production URL: `https://xiaosimachinery.pages.dev/`
- Latest deployment preview: `https://b60773b5.xiaosimachinery.pages.dev/`
- Production branch: `main`
- Deployed files: `index.html`, `robots.txt`, `sitemap.xml`, `template.css`, `template.js`, `admin/index.html`, `admin/admin.css`, `admin/admin.js`
- Functions: `/api/session`, `/api/login`, `/api/logout`, `/api/products`
- KV namespace binding: `XIAOSI_CONTENT`
- KV namespace id: `bbc5be152a5042bba108b265a7b48790`

## Admin Backend

- Admin URL: `https://xiaosimachinery.pages.dev/admin/`
- Initial admin password: `BpUtFAOWYFJBMPGiG7TRWAoW`
- Content storage key: `products:v1`
- Product management supports adding up to 100 machines, on-shelf/off-shelf status, category, cover image, equipment gallery images, local image upload, structured parameter rows, and zh-CN/en/es/fr product copy.
- Case management supports region/port, deal title, machine model, case cover image, case gallery images, and case notes.
- Front page content management supports hero title/text/image, hero card, inventory section heading/text, brand heading, quality heading/text, cases heading, and quote heading/text.
- Frontend behavior: `template.js` loads `/api/products` first. If no managed products are available, it falls back to the built-in product list.

## Admin Update Flow

1. Open `https://xiaosimachinery.pages.dev/admin/`.
2. Log in with the admin password.
3. Edit products or upload a compressed image.
4. Click `保存到线上`.
5. Open `https://xiaosimachinery.pages.dev/` in a fresh tab and confirm the product grid.

## Cloudflare Pages Settings

- Project source: GitHub repository
- Production branch: `main`
- Build command: `exit 0`
- Build output directory: `imachinemall-independent-template`
- Custom domain: `machineeee.com`

## Fastest Manual Upload

Use this when Cloudflare or GitHub is not authenticated on this machine yet.

1. Open Cloudflare Dashboard -> Workers & Pages -> Create application -> Pages.
2. Choose Direct Upload.
3. Upload the prepared zip package or the `imachinemall-independent-template` folder.
4. After the first deployment succeeds, add the custom domain `machineeee.com`.

## Wrangler Upload After Login

Run these commands from the project root after Cloudflare login is available:

```bash
npx wrangler login
npx wrangler pages project create xiaosimachinery
npx wrangler pages deploy imachinemall-independent-template --project-name xiaosimachinery --branch main
```

Cloudflare serves the first production deployment at a `pages.dev` URL. Add `machineeee.com` after the deployment is verified.

## DNS

Move DNS to Cloudflare or add the custom domain through Cloudflare Pages.

Expected public URLs:

- `https://machineeee.com/?lang=zh-CN`
- `https://machineeee.com/?lang=en`
- `https://machineeee.com/?lang=es`
- `https://machineeee.com/?lang=fr`

## Launch Checklist

1. Confirm all images load.
2. Confirm the four language buttons update page text and URL.
3. Confirm `https://machineeee.com/sitemap.xml` is reachable.
4. Confirm `https://machineeee.com/robots.txt` is reachable.
5. Submit sitemap to Google Search Console and Bing Webmaster Tools.
6. Track WhatsApp clicks as the first conversion event.
7. Replace external product links with MachineEEE-owned product pages when those pages are created.

## Current Asset Note

The template still references real product and image assets from `zhongdingmachinery.com` as source material. For production ownership, copy approved images to the MachineEEE domain or Cloudflare R2 and update `template.js` plus `template.css`.
