786d78676f35c7444fdc7ebc2550fcbb005e4531
PrestaProxy
Go reverse proxy in front of PrestaShop 1.7.3 with:
Echoas the HTTP server- native Go PrestaShop cookie decode/encode
templfor HTML rendering- Bun for JS and Tailwind builds
GORMwith SQLite for app-local state
Current scope
- Go owns
GET /product/:slug - all other routes proxy to the upstream PrestaShop instance
- product data, customer data, and cart summary are read from the PrestaShop database
- session state is derived from the live PrestaShop cookie
Requirements
- Go
- Bun
templ- access to the PrestaShop database
- PrestaShop cookie key, or access to the PrestaShop install root
Configuration
The service now loads .env automatically from the project root at startup.
Important variables:
PRESTASHOP_PROXY_TARGET: upstream PrestaShop origin, requiredPRESTASHOP_COOKIE_NAME: optional explicit cookie-name override. If omitted, the app derives the standardPrestaShop-...name from PrestaShop version and normalized host, and still falls back to prefix matching on reads.PRESTASHOP_COOKIE_KEY: Defuse/PrestaShop cookie key, required unless bootstrap from install root is usedDB_USER,DB_PASS,DB_NAME,DB_HOST,DB_PORT: preferred split MariaDB settingsDB_PREFIX: PrestaShop table prefixPRESTASHOP_DB_DSN: optional full DSN overridePRESTASHOP_PROJECT_ROOT: optional path to an existing PrestaShop install for bootstrapROUTE_OWNERSHIP_CONFIG: route prefix currently handled by Go
Example MariaDB setup:
PRESTASHOP_PROXY_TARGET=http://localhost
PRESTASHOP_COOKIE_KEY=def00000...
PRESTASHOP_DB_DIALECT=mariadb
DB_USER=presta
DB_PASS=presta
DB_NAME=presta
DB_PREFIX=ps_
DB_HOST=mariadb
DB_PORT=3306
If PRESTASHOP_DB_DSN is set, it takes precedence over the split DB settings.
Install
bun install
templ generate
go mod tidy
Build assets
bun run build
Available Bun scripts:
bun run build:jsbun run build:cssbun run build:manifestbun run buildbun run dev
Run
go run ./cmd/proxy
Default listen address is :8080.
Health endpoints
GET /healthzGET /readyz
Cookie support
Native cookie logic lives in internal/prestashop/cookie/codec.go.
What it does now:
- decrypts live PrestaShop cookies in Go
- parses plaintext key/value fields
- re-encodes cookies in Go using the same key format
Current limitation:
- it can round-trip and re-encode cookie content, but it does not yet recompute higher-level PrestaShop semantic fields like
checksumfor arbitrary mutations
Tests
go test ./...
Description
Languages
Go
72.8%
templ
15.5%
JavaScript
9.2%
CSS
2.5%