Deepa Aunty's store for her products
  • Go 54.1%
  • CSS 23.6%
  • templ 22.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-27 11:10:56 +13:00
db product admin: create, view, edit, delete products with images 2026-10-15 19:50:06 +13:00
frontend stock: sold out and discontinued products, DeeKeeCrafts name 2026-10-27 10:35:56 +13:00
models stock: sold out and discontinued products, DeeKeeCrafts name 2026-10-27 10:35:56 +13:00
static colours: handloom stripes scheme 2026-10-27 10:42:36 +13:00
.gitignore security fixes: limits, rate limit, CSRF, headers, timeouts 2026-10-15 20:11:10 +13:00
backup.go behaviour fixes: thumbnails, ordering, errors, config, backups 2026-10-15 20:57:38 +13:00
go.mod behaviour fixes: thumbnails, ordering, errors, config, backups 2026-10-15 20:57:38 +13:00
go.sum behaviour fixes: thumbnails, ordering, errors, config, backups 2026-10-15 20:57:38 +13:00
handlers_admin.go stock: sold out and discontinued products, DeeKeeCrafts name 2026-10-27 10:35:56 +13:00
handlers_public.go stock: sold out and discontinued products, DeeKeeCrafts name 2026-10-27 10:35:56 +13:00
images.go styling: product cards, product page, photos-first edit page 2026-10-15 21:23:59 +13:00
LICENSE Initial commit 2026-10-07 11:11:07 +13:00
main.go finishing touches: phones, titles, caching, previews, self-hosting 2026-10-16 19:58:15 +13:00
README.md stock: sold out and discontinued products, DeeKeeCrafts name 2026-10-27 10:35:56 +13:00
security.go finishing touches: phones, titles, caching, previews, self-hosting 2026-10-16 19:58:15 +13:00
theme.go studio grey colours with a light/dark toggle 2026-10-16 19:05:10 +13:00

deepa-store

DeeKeeCrafts: Deepa Aunty's store for her products

Running

Set ADMIN_HASH to a bcrypt hash of the admin password (single-quote it, it contains $):

ADMIN_HASH='$2a$10$...' go run .

Settings, all environment variables:

Variable Default
ADMIN_HASH (required) bcrypt hash of the admin password
PORT 3000 port to listen on
DATA_DIR . holds store.db and uploads/
STATIC_DIR static the CSS, htmx, font and other static files
SITE_URL unset the site's public address, like https://example.com; needed for the link previews shown when someone shares a page
INSECURE_COOKIES unset 1 lets login and the light/dark choice work over plain HTTP, for testing from another device on the LAN only

The server is meant to sit behind a reverse proxy (Caddy, nginx) that handles HTTPS. The port must only be reachable through that proxy: the login rate limit trusts the last X-Forwarded-For entry, which a client talking to the port directly could fake. The session cookie is Secure, so logging in only works over HTTPS (or on localhost) unless INSECURE_COOKIES=1.

Everything the pages load is served by the site itself: htmx 2.0.11 is static/htmx.min.js and the Playfair Display font (SIL Open Font License) is in static/fonts/. Nothing is fetched from other sites.

Pages follow the visitor's light or dark device setting until they use the toggle in the header, which saves their choice in a theme cookie.

Ctrl+C or SIGTERM lets requests in progress (such as uploads) finish for up to 30 seconds before exiting.

Images

Each upload is saved in DATA_DIR/uploads/ along with a smaller copy (at most 800 px, named .thumb800.jpg) that the pages show; clicking a photo opens the full-size original. At startup the server makes any missing thumbnails, deletes thumbnails of an older size, and moves other files no product refers to into DATA_DIR/orphaned-uploads/. Check that folder now and then and delete what isn't needed.

Backups

Logged in as admin, Download backup gives a zip of the database and every image. To restore, stop the server and unzip it into DATA_DIR.