Revamp: security patch, Next.js 15 migration, and low-cost AWS deployment via Terraform#151
Open
thasup wants to merge 8 commits into
Open
Revamp: security patch, Next.js 15 migration, and low-cost AWS deployment via Terraform#151thasup wants to merge 8 commits into
thasup wants to merge 8 commits into
Conversation
- README now documents the Next.js 15 client, hardened services, local Docker Desktop workflow, seed script, and low-cost AWS/Terraform path - skaffold.yaml upgraded from v2alpha3 to v4beta11 schema, builds per-service dev.Dockerfile images with hot-reload sync, deploys k8s + k8s-local-db + k8s-dev manifests https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
…dened k8s manifests, seed script - infra/terraform: default-VPC + t4g.small EC2 + Elastic IP + SSM-only access, k3s with ingress-nginx (hostNetwork) and cert-manager bootstrapped via user_data; all app secrets created from Terraform variables; no EKS/NAT/ELB fees (~$15/mo total vs ~$30 on DigitalOcean) - infra/k8s: resource requests/limits, liveness/readiness probes, non-root securityContext on all services; nats-streaming 0.17.0 -> 0.25.6; mongo:7 - infra/k8s-local-db: MongoDB split out with 1Gi PVCs (local dev / optional in-cluster prod DBs); infra/k8s-aws: TLS ingress + Let's Encrypt issuers - removed DigitalOcean-specific k8s-prod/issuer manifests - scripts/seed.mjs: idempotent API-driven seeding (admin + demo users + 10 products through real endpoints so NATS events replicate data correctly) - skaffold.yaml: v4 schema, dev Dockerfiles, hot-reload sync - README: rewritten for the new local + AWS workflows https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
- jsonwebtoken 8 -> 9 (CVE-2022-23529/23539/23540), with npm overrides so the copy nested in @thasup-dev/common is patched too - express 4.17 -> 4.21, mongoose 6.2 -> 8.16, express-validator 6 -> 7, cookie-session 2.1, bull 4.16, stripe 8 -> 18, typescript 5.8 - test stack: jest 29, ts-jest 29, supertest 7, mongodb-memory-server 10 - npm audit: 0 vulnerabilities across all services - GET /healthz endpoint on every service (incl. a minimal HTTP server for the expiration worker) for Kubernetes liveness/readiness probes - production Dockerfiles: multi-stage node:22-alpine, compiled TypeScript (no ts-node/nodemon in prod), npm ci --omit=dev, non-root USER node - new dev.Dockerfile per service for skaffold hot-reload development - tsconfig: es2022 target, dist/ output, tests excluded from prod build https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
… audit - tests-*: actions v4, Node 22, npm ci (payment tests get STRIPE_KEY secret) - deploy-*: buildx multi-arch images (amd64+arm64 for the Graviton node), docker/build-push-action, optional SSM-based rollout to the AWS k3s node gated on AWS_REGION/AURAPAN_INSTANCE_ID repository variables - deploy-manifests: DigitalOcean doctl replaced with SSM apply - removed legacy initial-deploy workflows and trigger-*.txt files - docs/DEPLOYMENT.md: end-to-end local (Docker Desktop) + AWS guides - docs/SECURITY-AUDIT.md: full audit record and remaining risks - .env.example: documented all current variables https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
Layout, home, auth, cart, category pages and shared helpers converted; product detail, checkout flow, orders and dashboards still being migrated. https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
- all routes converted to app/ with server-side data fetching and auth guards (redirect()); legacy pages/ and getInitialProps removed — including the global _app fetch-everything-on-every-page performance bug - per-request server fetch helper forwards Host/Cookie to the ingress; currentUser deduped via React cache() - payments: react-stripe-checkout -> @stripe/react-stripe-js (CardElement token flow against the same /api/payments contract); react-paypal-button-v2 -> @paypal/react-paypal-js - react-rating-stars-component -> local StarRating component - swiper 8 -> 12 (prototype-pollution advisory GHSA-hmx5-qpq5-p643), axios 1.x, react-share 5, postcss override (GHSA-qx2v-qp2m-jg93) - npm audit: 0 vulnerabilities - production Dockerfile: node:22-alpine multi-stage, standalone output, non-root, NEXT_PUBLIC_* build args; dev.Dockerfile for skaffold - GA tracking via next/script + usePathname/useSearchParams https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
Mongoose <7 silently stripped the unknown 'id' path from the filter (strictQuery default), so the lookup accidentally matched by version alone. Mongoose 8 keeps the filter, so OrderUpdatedListener could never find the order. Query by _id as intended. https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Full revamp of the 3-years-unmaintained stack so Aurapan can run again — locally on Docker Desktop and on AWS at roughly half the old DigitalOcean cost — with a security audit, patched dependencies, and a one-command Terraform deployment.
💸 AWS deployment (new —
infra/terraform/)~$15/month (vs ~$30 on DO): one
t4g.smallGraviton EC2 running single-node k3s + Elastic IP + 20 GB encrypted gp3. No EKS control plane ($73/mo), no NAT gateway ($32/mo), no managed load balancer ($16/mo) — ingress-nginx binds 80/443 directly on the node.terraform applybootstraps k3s, ingress-nginx, cert-manager (Let's Encrypt TLS), all manifests and secrets; you only point your domain's A record at the output IP. No SSH port — access via SSM Session Manager; IMDSv2 required. MongoDB Atlas M0 (free) recommended for durable data, or in-cluster MongoDB at $0. Cost details ininfra/terraform/README.md.🔒 Security audit & dependency patch (
docs/SECURITY-AUDIT.md)npm audit: 0 vulnerabilities in all 5 services and the client. Highlights:@thasup-dev/commonUSER node, no dev toolchain/healthzendpoints, resource limits, non-root securityContext, pinned images (mongo:7,nats-streaming:0.25.6), MongoDB on PersistentVolumeClaims⚛️ Next.js 15 + React 19 App Router migration (full refactor)
pages/toapp/with server components and per-page data fetching — removes the legacy_app.getInitialPropsthat fetched all products, users and orders on every page viewredirect(); per-requestfetchhelper forwards Host/Cookie to the ingress withcache()-dedupedcurrentUserreact-stripe-checkout→ @stripe/react-stripe-js (same/api/paymentstoken contract),react-paypal-button-v2→ @paypal/react-paypal-js,react-rating-stars-component→ local componentnext build: ✅ 32 dynamic routes, standalone output,/api/healthzfor probes🧰 Local dev & seed
skaffold devon Docker Desktop k8s with per-servicedev.Dockerfilehot reload (guide:docs/DEPLOYMENT.md)scripts/seed.mjs: idempotent, seeds an admin + 2 demo customers + 10 realistic products through the real APIs, so product data replicates to the order/payment services via NATS events exactly like production traffic🤖 CI
tests-*: Node 22,npm ci, full suites on PR (payment needs theSTRIPE_KEYrepo secret)deploy-*: multi-arch (amd64+arm64 for Graviton) buildx pushes; optional zero-SSH rollout to the AWS node via SSM, enabled by settingAWS_REGION/AURAPAN_INSTANCE_IDrepo variablesinitial-deploy-*workflows removedtests-*workflows on this PR are the gate. Add theSTRIPE_KEYsecret for the payment suite.@thasup-dev/commonis still on its old pins (you own that package — republishing it with updated deps is the cleanest follow-up; the jwt CVE inside it is already neutralized via overrides)..gitignorepreviously ignoredinfra/— fixed, which is why the Terraform files show up at all.https://claude.ai/code/session_01WBtAYmdHyGPNvoPRXGY1xv
Generated by Claude Code