Project Structure
High-level layout of store-cay-starter:
.├── db/ # Drizzle schema + D1 migrations├── scripts/ # seed-admin · seed-products├── store.config.ts # Committed project defaults (URL, brand, features)├── wrangler.jsonc # Worker + D1 DB + R2 STORAGE bindings├── migrations/ # Applied via wrangler d1 migrations└── src/ ├── admin/ # Admin SPA (Ant Design) ├── lib/ │ ├── config/ # Public config + server secret readers │ ├── sdk.ts # Storefront mock SDK (products / cart) │ ├── stores/cart.ts # Nanostores cart │ ├── store-settings.ts │ └── media.ts # R2 URL / streaming ├── modules/ # cart · checkout · products · layout ├── pages/ │ ├── *.astro # Storefront pages │ ├── api/ # REST (products · orders · upload · …) │ └── media/ # Public image routes └── middleware.ts # Admin / API session authConfiguration layers
Section titled “Configuration layers”| Layer | Where | What belongs there |
|---|---|---|
| Project defaults | store.config.ts |
Site URL, default region, brand defaults, CDN base, feature flags |
| Live shop settings | D1 via Admin → Settings | Store profile, announcements, shipping, discount codes |
| Secrets / bindings | .env + Wrangler secrets + wrangler.jsonc |
Session keys, Stripe/PayPal/Resend, D1/R2 |
Do not commit .env or production secrets.