SamwoostoreE-Commerce Platform
- Period
- Sep 2025 - Dec 2025
- Project type
- Freelance Team Project
- Role
- Major Full-Stack Contributor (Multi-Author Team)
- Team
- Multi-author client team
A full-stack Next.js e-commerce platform for Samwoo with a role-based admin dashboard, Google Cloud Storage media, operational logging, and a containerized CI/CD path to a self-managed Nginx VPS.
- Including a performance-index pass
- 5Production migrationsIncluding a performance-index pass
- RBAC enforced in middleware
- 3 x 6Roles x segmentsRBAC enforced in middleware
- App, audit, performance, error
- 4Winston log streamsApp, audit, performance, error
- next/image + GCS, AVIF/WebP
- 1 yearImmutable image cachenext/image + GCS, AVIF/WebP
Overview
Samwoostore, also called Samwoohub, combines an industrial-supplies storefront with a role-based operations console. The team modeled six customer segments and non-piece units of sale, delivered media from Google Cloud Storage, recorded API activity through Winston, and encoded a GitHub Actions, GHCR, SSH, and health-check deployment path for a self-managed VPS.
Role & context
- Role
- Major Full-Stack Contributor
- Team
- Multi-author client team
- Type
- Freelance Team Project
- Period
- Sep 2025 - Dec 2025
A multi-author client project for Samwoo under the Darts-Ecommerce organization. I made the largest combined contribution visible across my author aliases and worked throughout the full-stack codebase. Exact ownership of individual product, schema, API, UI, infrastructure, and operational decisions is intentionally not overstated without a commit-level team review.
Problem
Samwoo needed a single owned storefront + ops console to replace ad-hoc order taking: a catalogue large enough to need search, filtering, pagination and stock states; multiple customer segments (end users, wholesalers, resellers, installers, project buyers, companies) that a generic Shopify-style template doesn't model; non-piece units of sale (pieces, meter, box, drum) for industrial SKUs; and a repeatable deploy story so the owner could push changes without manual SSH steps.
Approach & architecture
Storefront behind Nginx/TLS over a Zod-validated, RBAC-guarded Next.js API on Prisma/Postgres, with GCS media and Winston audit logs; every push builds a GHCR image and deploys to the VPS with a health poll + Slack notify.
Practices followed
Feature-modular architecture
src/features/<domain>/{api,components,hooks,services,validators,types} keeps domains self-contained
Role-based access control at the edge
middleware checks the NextAuth JWT role before the route renders, not after
Schema-validated boundaries
Zod on every API input and React Hook Form on every UI form, with shared type inference
Indexed for the queries actually used
a dedicated migration adds indexes on Product status/slug/category/subcategory to avoid sequential scans
Immutable, cacheable media
GCS objects served with Cache-Control max-age=31536000 and next/image AVIF/WebP across responsive widths
Deploy with verification, not hope
the deploy workflow polls /api/health 15x before reporting success and Slack-notifies on both paths
Reproducible, slim image
a multi-stage Dockerfile with Next.js output: "standalone"
Audited operations
every API request is logged through Winston, with response-time and audit sinks kept separate from the app and error logs
Challenges & resolutions
Modelling industrial SKUs that ship in non-piece units (meter, box, drum) without forking storefront templates that assume integer quantities.
FixAdded a ProductUnit enum (PIECES | METER | BOX | DRUM) via a dedicated migration and threaded it through product display, cart line items, and the jsPDF receipt — so the unit travels with the price instead of being inferred from the product name.
First-pass schema used string IDs, making joins, indexing and admin-side filtering slower than acceptable as the catalogue grew.
FixMigrated primary keys to Int, then added performance indexes on the catalogue's hot paths (status, slug, category, subcategory) and composite uniques (userId, productId) on Cart/Wishlist for idempotent add-to-cart.
Self-hosted VPS deploys intermittently failed because GHCR image pulls timed out before the container was healthy, with no visibility into which step failed.
FixHardened the deploy workflow with a 5x retry on docker compose pull, a 15-attempt x 5s health-poll against /api/health, and a Slack notification on both success and failure — so a bad deploy fails loudly instead of leaving stale containers running.
Outcomes
Delivered a team-built single-codebase storefront, administration surface, API, observability layer, and CI/CD pipeline
Image pipeline: next/image + GCS with 1-year immutable caching (max-age=31536000) and responsive widths up to 3840px, AVIF/WebP automatic
Deployment automation: push to main/develop -> image built/tagged (branch + SHA + latest) -> GHCR -> SSH-deployed to VPS -> health-verified (15x poll) -> Slack-notified, with zero manual SSH steps
Schema maturity: 5 production migrations including a performance-index pass and a hot-path ID type conversion; RBAC of 3 roles x 6 customer segments enforced in middleware
Hardened auth (bcrypt, 30-day JWT, single-use 32-byte 1-hour reset tokens) and 4 Winston log streams (app/audit/performance/error) with rotation
Tech stack
Concepts & skills14
- Next.js 15 App Router (Server/Client Component split)
- Standalone Next.js output for minimal Docker images
- Prisma schema design + performance-index migrations on PostgreSQL
- NextAuth.js JWT sessions with RBAC
- Redux Toolkit + RTK Query cache invalidation
- Zod schema validation at API boundaries
- Google Cloud Storage with long-lived CDN-style caching
- Multi-stage Docker builds for production Node images
- GitHub Actions CI/CD with GHCR
- SSH rollout with health-poll verification
- Nginx reverse proxy + Let's Encrypt TLS
- Structured logging & audit trails with Winston (rotation)
- bcrypt hashing + one-time cryptographic reset tokens
- Feature-modular frontend architecture (vertical slicing)
Links
Expertise demonstrated here
- Next.js engineeringNext.js engineering by Ifham Mohamed across App Router systems, React Server Components, authentication, PostgreSQL, performance, and deployment.
- E-commerce engineeringE-commerce development by Ifham Mohamed across catalogues, customer segments, order workflows, inventory, payments, media performance, admin tools, and deployment.