# 010122 Multi Currency Architecture

> Multi-currency architecture — price-per-currency with FK chain to countries and taxes, geo detection via edge headers, admin CRUD.

- Skill: `natuleadan/010122-multi-currency-architecture` (Agent Skill, multi-file: 8 files)
- Install (CLI): `npx skillmds@latest add natuleadan/010122-multi-currency-architecture`
- Raw SKILL.md: https://api.skillmd.com/api/skills/natuleadan/010122-multi-currency-architecture/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: natuleadan (https://skillmd.com/u/natuleadan)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/natuleadan/010122-multi-currency-architecture

---


# Multi-Currency Architecture

## When to use

When building e-commerce or subscription systems that need to display and charge in multiple currencies based on the user's geographic location.

## References

| Topic | File |
|---|---|
| Currency + country + tax FK chain | `references/fk-chain.md` |
| Price table design per currency | `references/price-table.md` |
| Geo-based detection pipeline | `references/geo-detection.md` |
| CurrencyProvider and admin CRUD | `references/currency-provider.md` |

## Quick checklist

- [ ] `sys_currencies`: code, name, symbol, countryId FK, isDefault, isActive
- [ ] `sys_taxes`: countryId FK, currencyId FK, name, rate, isActive
- [ ] `prd_prices`: productId, variantId, currencyId FK, price, compareAtPrice, cost, isActive, validFrom, validUntil
- [ ] Unique constraint: `(productId, variantId, currencyId)` with `NULLS NOT DISTINCT`
- [ ] Geo detection: edge header (`cf-ipcountry`) → sys_countries → sys_currencies
- [ ] Fallback chain: user preference cookie → geo detection → default currency (USD)
- [ ] CurrencyProvider context: read-only (immutable without user preference)
- [ ] Admin CRUD: generic factory with FK protection on DELETE

