Reimagining a Household Icon Since 1978
How do you modernize a brand found in millions of Indonesian kitchens without losing its heritage?
Garam Cap Kapal has been Indonesia's pioneer of iodized consumption salt since 1978. While the brand enjoyed decades of household trust and repeated Top Brand recognition, its digital presence needed to evolve beyond a static brochure into an interactive brand hub and direct-to-consumer / business-to-business commerce platform.
When I started working on the platform in April 2026, the goal was ambitious: build an ecosystem that serves four distinct audiences under one roof:
- Everyday Consumers & Home Cooks: discovering iodized salt products, exploring Kreasi Rasa recipes, participating in community forums, and earning loyalty points.
- Agents & UMKM Partners (
agen): registering business profiles with distributor codes and purchasing bulk inventory at specialized B2B agent pricing. - Job Seekers: browsing open positions and submitting applications directly through the career portal.
- Admins & Superadmins: managing products, verifying manual QRIS & Midtrans payments, moderating forums, and tracking loyalty redemptions.
Backend-for-Frontend (BFF) & Edge Security Architecture
Zero client-side tokens with Next.js Edge Proxy and Modular Laravel 13
Security and clean separation of concerns were foundational priorities from day one. Rather than storing JWT bearer tokens in localStorage where they are vulnerable to XSS, I engineered a Backend-for-Frontend (BFF) Proxy architecture:
- HttpOnly Session Cookies: Upon authentication (or Google OAuth callback), the Next.js server stores the JWT inside an encrypted
HttpOnlycookie (gck_token) alongside signed role metadata (gck_roles). - Edge RBAC Middleware (
src/proxy.ts): Every navigation request through/dashboardor/adminis intercepted at the Edge usingjoseto verify JWT signatures and enforce role-based access control (superadmin,admin,agen,user) before a page even renders. - Transparent API Proxy (
/api/proxy/[...path]): Client-side TanStack React Query hooks communicate exclusively with the internal Next.js proxy route, which attaches theAuthorization: Bearerheader server-side and forwards requests to the Laravel 13 backend.
On the backend, the API was architected using Domain-Driven Modular structure (app/Modules/{Auth,Product,Order,Payment,Reward,Promo,Forum,CMS,Career,Notification,Admin}), powered by Laravel Sanctum, Spatie Permission, Spatie Laravel Data DTOs, Meilisearch (via Laravel Scout) for instant catalog indexing, and Laravel Horizon for asynchronous queue processing.
Dual-Tier Commerce, Hybrid Payments & Loyalty Rewards
Tailoring the buying journey for both retail shoppers and wholesale agents
One of the most interesting engineering challenges was building the role-aware pricing and checkout engine:
- Dynamic Agent Pricing: When a verified Agent (
agen) logs in, the entire product catalog, shopping cart, and order calculation engine automatically switch from retail pricing (price) to wholesale distributor pricing (agent_price), complete with UMKM business profile and distributor code validation. - Hybrid Payment Flows: To accommodate all customer preferences, I integrated Midtrans Snap for instant automated payments alongside a Manual QRIS Payment Flow where buyers scan a dynamic QRIS code, upload their transfer receipt, and trigger an admin verification workflow with one-click payment status synchronization.
- Multi-Channel Marketplace Bridge: For customers who prefer shopping on their favorite marketplace, each product dynamically links to official Shopee, Tokopedia, Lazada, Blibli, and TikTok Shop storefronts.
- Loyalty & Point Redemption Engine: Customers earn points from purchases and events, which can be redeemed for role-specific rewards and promo vouchers—enforced by per-user redemption limits (
max_redeem) and tracked in an auditable point ledger.
Production DevOps & Automated CI/CD Pipeline
From local TypeScript code to a 150MB hardened production container
To ensure reliable deployments on the production VPS behind Nginx and Cloudflare Turnstile, I built a complete containerization and CI/CD pipeline:
- Multi-Stage Docker Build: Using Next.js
output: "standalone"onnode:20-alpine, the production image strips away development dependencies and runs under a non-rootnextjsuser at roughly 150MB. - Automated GitHub Actions Workflows:
ci.yml: Runs ESLint, TypeScript type-checking (tsc --noEmit), and production build verification on every pull request.security.yml: Executes weekly and per-push Trivy container vulnerability scans andpnpm auditdependency checks, uploading SARIF reports directly to the GitHub Security tab.deploy-staging.yml&deploy-production.yml: Builds multi-tag Docker images (sha-*,latest), pushes them to GitHub Container Registry (GHCR), and performs automated SSH rollouts with health-check verification and automatic rollback on failure.
