### Install and run with pnpm Source: https://github.com/hiobuy/starter/blob/main/README.md Installs dependencies and starts the development server using pnpm. ```bash pnpm install pnpm dev ``` -------------------------------- ### Install and run with npm Source: https://github.com/hiobuy/starter/blob/main/README.md Installs dependencies and starts the development server using npm. ```bash npm install npm run dev ``` -------------------------------- ### Copy environment file Source: https://github.com/hiobuy/starter/blob/main/README.md Copies the example environment file to create a local environment file. ```bash cp .env.example .env.local ``` -------------------------------- ### Example proxy request body Source: https://github.com/hiobuy/starter/blob/main/README.md Example request body for the proxy route, specifying channel, keyword, and pagination. ```json { "channel": "1688", "keyword": "phone case", "page": 1, "page_size": 20 } ``` -------------------------------- ### Clone the starter repository Source: https://github.com/hiobuy/starter/blob/main/README.md Clones the starter repository and changes into the project directory. ```bash git clone https://github.com/hiobuy/starter.git cd starter ``` -------------------------------- ### Deploy with pnpm preview and pnpm deploy Source: https://github.com/hiobuy/starter/blob/main/README.md Commands for local preview and production deployment of the Next.js starter on Cloudflare Workers. `pnpm preview` uses `.env.local` for local testing, while `pnpm deploy` temporarily moves `.env.local` aside so API keys are not baked into the Worker bundle. ```bash pnpm preview # OpenNext build + local Workers runtime (uses .env.local) pnpm deploy # production deploy (does NOT bake .env.local) ``` -------------------------------- ### Project structure Source: https://github.com/hiobuy/starter/blob/main/README.md Directory tree of the starter project structure. ```text src/ ├── app/ │ ├── page.tsx │ ├── search/ │ │ └── page.tsx │ ├── product/ │ │ └── [channel]/[id]/ │ └── api/ │ └── products/ │ ├── search/ │ ├── search-by-image/ │ ├── parse/ │ └── detail/ │ ├── components/ │ └── lib/ └── hiobuy.ts ``` -------------------------------- ### Open the app in the browser Source: https://github.com/hiobuy/starter/blob/main/README.md URL to open in the browser to view the running application. ```text http://localhost:3000 ``` -------------------------------- ### Set HIOBuy API key Source: https://github.com/hiobuy/starter/blob/main/README.md Sets the HIOBuy API key in the environment file. ```env HIOBUY_API_KEY=your_api_key_here ``` -------------------------------- ### Set default language Source: https://github.com/hiobuy/starter/blob/main/README.md Optional environment variable to set the default language. ```env HIOBUY_DEFAULT_LANGUAGE=en ``` -------------------------------- ### Request flow diagram Source: https://github.com/hiobuy/starter/blob/main/README.md Diagram showing the request flow from the browser through the Next.js route handler to the HIOBuy API. ```text Browser │ ▼ Next.js Route Handler (/api/products/*) │ │ Authorization: Bearer ▼ HIOBuy Product API ``` -------------------------------- ### Set Cloudflare secrets with wrangler secret put Source: https://github.com/hiobuy/starter/blob/main/README.md Sets required runtime secrets on Cloudflare Workers. `HIOBUY_API_KEY` is required; `HIOBUY_DEFAULT_LANGUAGE` is optional. Do not put secrets in `wrangler.jsonc`, Git, or any `NEXT_PUBLIC_*` variable. ```bash wrangler secret put HIOBUY_API_KEY # optional: wrangler secret put HIOBUY_DEFAULT_LANGUAGE ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.