Full-stack e-commerce for an argan oil cooperative in Morocco - Astro 4 SSR, SQLite, WhatsApp COD checkout, complete admin back-office
# Argane Cooperative Store
**Full-stack e-commerce for an argan oil cooperative in Aït Baha, Morocco.**
WhatsApp checkout · SQLite back-office · Astro 4 SSR · No framework bloat
---
## About
This is the production storefront for the **Argane Women's Cooperative** — a real argan oil producer cooperative in Aït Baha, in the Souss-Massa region of Morocco. It's built for the Moroccan market, where WhatsApp cash-on-delivery is the dominant checkout model, not a workaround. There's no payment processor, no SaaS dependency, no monthly bill beyond the VPS — just a Node server, a SQLite file, and a WhatsApp number.
---
## What makes it interesting
- **Hybrid Astro SSR** — brand/content pages (`/story`, `/faq`, `/recipes`, …) are prerendered to static HTML at build time; commerce pages (product detail, cart, admin) are server-rendered on demand. No blanket SSR tax.
- **WhatsApp as a first-class checkout** — not a fallback. The order is written to the DB, the confirmation page renders, and *then* a pre-filled WhatsApp message opens to the cooperative's number. The buyer gets an order number; the operator gets a WhatsApp ping. This is how most Moroccan e-commerce actually works.
- **SQLite auto-seeds on first run** — `src/lib/db.js` creates the schema and seeds the product catalog the first time the server starts. Zero setup, no migrations to run.
- **Complete back-office, zero external services** — orders, customers, product CRUD with image upload, producer payouts, and settings all live in one local SQLite file. No Stripe dashboard, no Firebase, no third-party admin panel.
- **Producer payout calculation baked in** — the admin computes the cooperative members' 65% share of sales per product, per period. That's a domain requirement, not an afterthought.
- **No JS framework** — the cart is ~150 lines of vanilla JS. It uses `localStorage` for persistence, a tiny pub/sub to keep the nav badge in sync, and a single `fetch` to post the order. No React, no build step …