---
id: "lib-2026-11-12-handing-a-pii-heavy-e-commerce-rebuild-to-claude"
type: "library"
title: "Handing a PII-heavy e-commerce rebuild to Claude: what we set up first (個人情報だらけのECサイトの新規開発をClaudeに任せるためにやったこと)"
lang: "JA"
org: "every"
source_type: "Practitioner post"
date: "2026-11-12"
week: "2026-W46"
url: "https://nosov.ai/library/lib-2026-11-12-handing-a-pii-heavy-e-commerce-rebuild-to-claude/"
original_url: "https://tech.every.tv/entry/2026/11/12/214002"
tier: "B"
tier_name: "Useful, limited"
tier_reason: "every's engineering blog gives a concrete, code-level account of how a team chose its stack and built type and permission checks so an agent-written e-commerce rebuild could handle personal and billing data; specific and reusable, but no defect or incident figures."
summary_basis: "full-text"
original_minutes: "10"
tags: ["ai technology", "e commerce", "personal data", "coding agents"]
---

# Handing a PII-heavy e-commerce rebuild to Claude: what we set up first (個人情報だらけのECサイトの新規開発をClaudeに任せるためにやったこと)

Tier B (Useful, limited): every's engineering blog gives a concrete, code-level account of how a team chose its stack and built type and permission checks so an agent-written e-commerce rebuild could handle personal and billing data; specific and reusable, but no defect or incident figures.

Summary based on the full text.

## In short

A post on every's tech blog (12 November 2026) by an engineer on the company's e-commerce team, who joined as a new graduate six months earlier. The team replaced a SaaS shopping cart with an in-house build in under three months, about 610,000 lines and 7,500 commits, developed mostly by Claude Code working semi-autonomously. Because the system holds member personal data and subscription billing, the stack was chosen so that agent mistakes are caught by machines before code runs. The post shows how types, tests and database permissions enforce privacy rules, with prose rules for the agent and human review covering the rest.

## Key numbers

- about 610,000 lines: code in the in-house cart that replaced a SaaS cart, built in under three months, mostly by Claude Code
- about 7,500: commits during the rebuild
- about 50: row-locking reads in the repository layer, a reason for choosing Drizzle over Prisma
- 7 tests, 3 columns: breakages caught by type checks after merging main: unvalidated email strings in tests, and new columns missing an analytics-exposure class
- 30.63 million: people affected by personal-data leaks disclosed by listed Japanese companies and subsidiaries in 2025 (Tokyo Shoko Research)

## What it reports

- Stack: TypeScript across front and back end, Hono (RPC type inference to the client), PostgreSQL with Drizzle, Next.js and Vite with Tailwind. Reason: agents often change an API and forget the screen; one language with linked types makes that a compile error.
- Tailwind's bracket syntax makes off-token styles searchable (`-[#`), so departures from the design tokens can be listed by machine.
- Domain values such as subscription cycle days and branded email types are defined once and used by repository, API contracts and screens. Changing the email type surfaced 7 failing tests across three packages after merging main.
- Drizzle chosen in part for typed row locks and savepoints; Prisma needs raw SQL for row locks (an open request since 2021). About 50 locking reads exist in the repositories.
- Privacy by type: every column of every table is classed as exposed to the Databricks analytics platform or restricted; a missing class fails the type check. Column grants are rebuilt from the classes on each deploy. A free-text support column was wrongly classed as exposed and caught in review, so free text is now always restricted.
- Audit log columns are classed similarly; card last four digits and expiry are stored as `{"unrecorded": true}`; the app's database user can only append to the audit log.
- Sentry data collection is disabled before sending; a log that included the first 500 characters of a warehouse API response (which could hold addresses) was found by a Claude-assisted review and reduced to status, type and length.
- IDs are UUIDv7, not sequential; other members' data returns 404, not 403. Card data goes straight to Stripe; passwords to Cognito.
- AGENTS.md holds the privacy rules and a list of approved external recipients; changes touching authentication, authorisation or payments always get human review.

## How they got it

First-hand engineering write-up with code excerpts from the production repository and examples of checks that fired during development.

## Limits

- No figures on defects, security findings, test coverage or how much code was reviewed by people.
- Written soon after launch; operating experience is not yet reported.
- The share of work done by the agent is described as "mostly", without a measure.

## Why it matters for companies

Agent-written code at this volume cannot be reviewed line by line, so the controls have to be built into the stack. The transferable pattern: choose tools where an omission fails the build, classify every data column so that new fields cannot leak by default, rebuild database grants from that classification on every deploy, and keep humans on the authentication and payment boundary. The case where a support free-text field was misclassified shows the limit: types enforce that a decision is made, not that it is right.

## Key passages in translation

> Claude が書いたコードに読み違いや書き忘れがあっても、実行する前に機械で見つけられることを基準にしました。

Our criterion was that even if code Claude wrote contained a misreading or an omission, machines could find it before it ran.

> 個人情報も、「気を付ける」ではなく「書き忘れたら通らない」形に寄せました。

For personal data too, we moved from "be careful" to "it will not pass if you forget."

> 型とテストで確かめられるのは、形にできた決まりだけです。

Types and tests can only check rules that have been given a concrete form.

Original: https://tech.every.tv/entry/2026/11/12/214002
