Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

amadad/snacklab

Open more actions menu

Repository files navigation

Snack Lab

Diátaxis: how-to

Snack Lab is a small Next.js storefront deployed to Cloudflare Workers with OpenNext. It uses:

  • KV for products, orders, and item requests
  • R2 for uploaded product images
  • HTTP-only cookie auth for the admin area

Local development

Install dependencies:

npm clean-install

Create a local Cloudflare vars file for development:

cp .dev.vars.example .dev.vars

Then set your existing admin password in .dev.vars:

ADMIN_PASSWORD=your-existing-password

Start the app:

npm run dev

Cloudflare deployment

In the Cloudflare dashboard, use these commands:

  • Build command: npx opennextjs-cloudflare build
  • Deploy command: npx wrangler deploy
  • Non-production branch deploy command: npx wrangler versions upload

Before deploying, store the admin password as a Wrangler secret:

npx wrangler secret put ADMIN_PASSWORD

Use the same password value you already use if you are not rotating it yet.

Required Cloudflare bindings

wrangler.toml expects these bindings:

  • STORE_KV → KV namespace
  • STORE_R2 → R2 bucket
  • ADMIN_PASSWORD → Wrangler secret

Useful commands

npm run dev
npm run build
npm run preview
npm run deploy
npm run lint

What the app does

  • Public storefront with stock-aware cart limits
  • Cash-on-pickup checkout flow
  • Admin inventory management
  • Admin order management and reconciliation
  • Customer item request submission

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.