One Codebase, Many Countries: Building a Multi-Market React Native App
· Đorđije Lazarević · 3 min read
An app that launches in Denmark and later in Sweden, Norway and Finland is a common brief for Nordic companies. The tempting shortcut is to copy the app per country. Within a year you have four codebases that drift apart. The alternative is one codebase where the market is configuration.
First decision: one listing or one per market
| Approach | Good for | Cost |
|---|---|---|
| One app, market chosen at sign-in | Same brand everywhere, users who move between countries | Every market ships in every release |
| One app per market, built from one codebase | Different brand names, store listings or legal entities per country | More builds and store listings to manage |
Both work from a single codebase. The difference is only where the market comes from: the user's profile at runtime, or the build.
The market as a typed config
export type MarketCode = 'dk' | 'se' | 'no' | 'fi';
export interface MarketConfig {
code: MarketCode;
defaultLanguage: 'da' | 'sv' | 'nb' | 'fi';
languages: string[];
currency: 'DKK' | 'SEK' | 'NOK' | 'EUR';
supportPhone: string;
features: { digitalSignature: boolean; installmentPayments: boolean };
}
export const MARKETS: Record<MarketCode, MarketConfig> = {
dk: { code: 'dk', defaultLanguage: 'da', languages: ['da', 'en'], currency: 'DKK',
supportPhone: '+45 00 00 00 00', features: { digitalSignature: true, installmentPayments: false } },
fi: { code: 'fi', defaultLanguage: 'fi', languages: ['fi', 'sv', 'en'], currency: 'EUR',
supportPhone: '+358 00 000 0000', features: { digitalSignature: true, installmentPayments: true } },
// se, no ...
};
Components never check if (market === 'fi'). They read a capability from the config. When a fifth market arrives, it is a new entry in this object, not a search through the codebase.
Language is not the market
Finland has two official languages, and many users in every market prefer English. Keep language and market as two separate settings: the market decides currency, rules and features; the language decides the text. The market only provides the default language and the allowed list.
Formatting with Intl
Hermes supports the Intl APIs, so there is no need for a formatting library per country:
export function formatMoney(amount: number, market: MarketConfig, language: string) {
return new Intl.NumberFormat(`${language}-${market.code.toUpperCase()}`, {
style: 'currency',
currency: market.currency,
}).format(amount);
}
formatMoney(1250, MARKETS.dk, 'da'); // "1.250,00 kr."
Dates, phone numbers and addresses follow the same rule: format from the market and language, never by string concatenation.
Building one app per market with Expo
If each market needs its own store listing, the app config can read the market from an environment variable at build time:
// app.config.ts
import type { ConfigContext, ExpoConfig } from 'expo/config';
const market = process.env.APP_MARKET ?? 'dk';
export default ({ config }: ConfigContext): ExpoConfig => ({
...config,
name: market === 'dk' ? 'Example' : `Example ${market.toUpperCase()}`,
slug: 'example-app',
ios: { ...config.ios, bundleIdentifier: `com.example.app.${market}` },
android: { ...config.android, package: `com.example.app.${market}` },
extra: { ...config.extra, market },
});
Each EAS build profile sets APP_MARKET in its env, and the app reads the value with Constants.expoConfig.extra.market.
Server-driven where it changes often
Legal texts, product terms and which features are switched on change more often than app releases. I keep the defaults in the app and let the backend override them per market, so a legal change in one country does not wait for store review.
Testing every market
- Unit tests for formatters and rules run once per market in a loop over
MARKETS. - End-to-end tests for the critical flows (sign-in, the main purchase or claim flow) run at least for the market with the most rules.
- A debug menu in internal builds lets testers switch market and language without reinstalling.
Releases
With one codebase, a fix reaches every market at once. Over-the-air updates can still be rolled out per market through separate update channels, which is useful when one country has a deadline the others do not.
I currently lead development of a multi-country React Native app for the Nordic market built on these principles: one codebase, the market as data, and no country-specific forks.