Skip to content

Commit 746af5b

Browse files
committed
docs: update migration guide for kebab-case convention and services layer integration
1 parent f4dee2f commit 746af5b

1 file changed

Lines changed: 49 additions & 23 deletions

File tree

documentation/blog/2026-02-26-React-Native-Boilerplate-5.0.0.md

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ This version includes several breaking changes that require manual migration:
3333
All component files now use kebab-case instead of PascalCase:
3434

3535
**Before:**
36+
3637
```
3738
src/components/
3839
atoms/
@@ -45,6 +46,7 @@ src/components/
4546
```
4647

4748
**After:**
49+
4850
```
4951
src/components/
5052
atoms/
@@ -57,6 +59,7 @@ src/components/
5759
```
5860

5961
**Migration steps:**
62+
6063
- Rename all component folders to kebab-case
6164
- Rename all component files to kebab-case
6265
- Update all import statements accordingly
@@ -75,6 +78,7 @@ export { default as Skeleton } from './skeleton/skeleton';
7578
The main App file has been renamed to lowercase:
7679

7780
**Before:**
81+
7882
```tsx
7983
// src/App.tsx
8084
import ApplicationNavigator from '@/navigation/Application';
@@ -93,6 +97,7 @@ function App() {
9397
```
9498

9599
**After:**
100+
96101
```tsx
97102
// src/app.tsx
98103
import '@/services/i18n/instance';
@@ -114,6 +119,7 @@ function App() {
114119
```
115120

116121
**Migration steps:**
122+
117123
- Rename `src/App.tsx` to `src/app.tsx`
118124
- Update imports to use new services structure
119125
- Update navigator import
@@ -125,6 +131,7 @@ A new services layer has been introduced to centralize business logic, API calls
125131
##### HTTP Client
126132

127133
**Before:**
134+
128135
```tsx
129136
// src/App.tsx
130137
export const queryClient = new QueryClient({
@@ -136,6 +143,7 @@ export const queryClient = new QueryClient({
136143
```
137144

138145
**After:**
146+
139147
```ts
140148
// src/services/http-client.ts
141149
import { QueryClient } from '@tanstack/react-query';
@@ -157,13 +165,15 @@ export const queryClient = new QueryClient({
157165
##### Storage
158166

159167
**Before:**
168+
160169
```tsx
161170
// src/App.tsx
162171
import { createMMKV } from 'react-native-mmkv';
163172
export const storage = createMMKV();
164173
```
165174

166175
**After:**
176+
167177
```ts
168178
// src/services/storage.ts
169179
import { createMMKV } from 'react-native-mmkv';
@@ -229,6 +239,7 @@ export const fetchOneQueryOptions = (currentId: User['id']) =>
229239
```
230240

231241
**Migration steps:**
242+
232243
- Move existing API calls to `services/domains/{domain}/{domain}.api.ts`
233244
- Create schemas in `services/domains/{domain}/{domain}.schema.ts`
234245
- Create query options in `services/domains/{domain}/{domain}.query-options.ts`
@@ -239,6 +250,7 @@ export const fetchOneQueryOptions = (currentId: User['id']) =>
239250
Internationalization has been moved to the services layer:
240251

241252
**Before:**
253+
242254
```
243255
src/
244256
translations/
@@ -252,6 +264,7 @@ src/
252264
```
253265

254266
**After:**
267+
255268
```
256269
src/
257270
translations/
@@ -264,6 +277,7 @@ src/
264277
```
265278

266279
**Migration steps:**
280+
267281
- Rename translation files to lowercase (en-EN.json → en-en.json)
268282
- Move i18n configuration to `services/i18n/instance.ts`
269283
- Import i18n at the top of `app.tsx`: `import '@/services/i18n/instance';`
@@ -274,6 +288,7 @@ src/
274288
The navigator has been renamed and relocated:
275289

276290
**Before:**
291+
277292
```tsx
278293
// src/navigation/Application.tsx
279294
function ApplicationNavigator() {
@@ -293,6 +308,7 @@ function ApplicationNavigator() {
293308
```
294309

295310
**After:**
311+
296312
```tsx
297313
// src/navigators/root.tsx
298314
function RootNavigator() {
@@ -324,6 +340,7 @@ function RootNavigator() {
324340
```
325341

326342
**Migration steps:**
343+
327344
- Move `src/navigation/Application.tsx` to `src/navigators/root.tsx`
328345
- Rename `ApplicationNavigator` to `RootNavigator`
329346
- Move navigation types to `src/services/navigation/types.ts`
@@ -333,6 +350,7 @@ function RootNavigator() {
333350
#### 6. Hooks Reorganization
334351

335352
**Before:**
353+
336354
```
337355
src/
338356
theme/
@@ -350,6 +368,7 @@ src/
350368
```
351369

352370
**After:**
371+
353372
```
354373
src/
355374
hooks/
@@ -364,6 +383,7 @@ src/
364383
```
365384

366385
**Migration steps:**
386+
367387
- Move `useTheme` to `hooks/use-theme/use-theme.ts`
368388
- Move domain hooks to services layer
369389
- Update import paths: `import { useTheme } from '@/hooks';`
@@ -374,11 +394,13 @@ src/
374394
The ThemeProvider has been moved to components/providers:
375395

376396
**Before:**
397+
377398
```tsx
378399
import { ThemeProvider } from '@/theme';
379400
```
380401

381402
**After:**
403+
382404
```tsx
383405
import { ThemeProvider } from '@/components/providers';
384406
```
@@ -388,6 +410,7 @@ import { ThemeProvider } from '@/components/providers';
388410
Tests have been reorganized with a cleaner structure:
389411

390412
**Before:**
413+
391414
```
392415
src/
393416
__mocks__/
@@ -402,6 +425,7 @@ src/
402425
```
403426

404427
**After:**
428+
405429
```
406430
src/
407431
__tests__/
@@ -421,6 +445,7 @@ src/
421445
```
422446

423447
**Migration steps:**
448+
424449
- Move `tests/TestAppWrapper.tsx` to `__tests__/test-wrappers.tsx`
425450
- Create `__tests__/setup.ts` for test configuration
426451
- Organize mocks in `__tests__/mocks/`
@@ -449,6 +474,7 @@ import TestAppWrapper from '@/__tests__/test-wrappers';
449474
Screens follow the same kebab-case convention:
450475

451476
**Before:**
477+
452478
```
453479
src/screens/
454480
Example/
@@ -459,6 +485,7 @@ src/screens/
459485
```
460486

461487
**After:**
488+
462489
```
463490
src/screens/
464491
example/
@@ -473,11 +500,13 @@ src/screens/
473500
Asset helper functions have been renamed:
474501

475502
**Before:**
503+
476504
```tsx
477505
import getAssetsContext from '@/theme/assets/getAssetsContext';
478506
```
479507

480508
**After:**
509+
481510
```tsx
482511
import getAssetsContext from '@/theme/assets/get-assets-context';
483512
```
@@ -496,12 +525,14 @@ Version 5.0 introduces a powerful ESLint configuration that enforces project str
496525
#### Configuration Structure
497526

498527
**Before:**
528+
499529
```js
500530
// eslint.config.mjs
501531
export default tseslint.config(/*...*/);
502532
```
503533

504534
**After:**
535+
505536
```js
506537
// eslint.config.js
507538
import { fileCompositionConfig } from './eslint/file-composition/index.mjs';
@@ -515,7 +546,10 @@ export default defineConfig([
515546
rules: {
516547
'project-structure/file-composition': [ERROR, fileCompositionConfig],
517548
'project-structure/folder-structure': [ERROR, folderStructureConfig],
518-
'project-structure/independent-modules': [ERROR, independentModulesConfig],
549+
'project-structure/independent-modules': [
550+
ERROR,
551+
independentModulesConfig,
552+
],
519553
},
520554
},
521555
// ... other configs
@@ -540,11 +574,21 @@ export const folderStructureConfig = {
540574
{
541575
name: 'src',
542576
children: [
543-
{ name: 'components', children: [/* atoms, molecules, organisms, templates */] },
577+
{
578+
name: 'components',
579+
children: [
580+
/* atoms, molecules, organisms, templates */
581+
],
582+
},
544583
{ name: 'hooks' },
545584
{ name: 'navigators' },
546585
{ name: 'screens' },
547-
{ name: 'services', children: [/* domains, i18n, navigation, storage */] },
586+
{
587+
name: 'services',
588+
children: [
589+
/* domains, i18n, navigation, storage */
590+
],
591+
},
548592
{ name: 'theme' },
549593
{ name: 'translations' },
550594
],
@@ -605,25 +649,6 @@ const { isError, isSuccess } = useQuery({
605649

606650
This makes it easier to handle initialization logic and conditional rendering based on app state.
607651

608-
### Ky HTTP Client
609-
610-
The boilerplate now uses Ky as the HTTP client, providing a modern, lightweight alternative to axios:
611-
612-
```ts
613-
import ky from 'ky';
614-
615-
export const httpClient = ky.extend({
616-
headers: { Accept: 'application/json' },
617-
prefixUrl: `${process.env.API_URL ?? ''}/`,
618-
});
619-
```
620-
621-
Ky provides:
622-
- Better TypeScript support
623-
- Simpler API
624-
- Smaller bundle size
625-
- Native Fetch API under the hood
626-
627652
### Domain-Driven Architecture
628653

629654
The new services layer encourages domain-driven design:
@@ -637,6 +662,7 @@ services/
637662
```
638663

639664
Each domain contains:
665+
640666
- **schema**: Type definitions and validation
641667
- **api**: API calls
642668
- **query-options**: TanStack Query configuration
@@ -660,7 +686,7 @@ Use this checklist to ensure a complete migration:
660686
- [ ] Move navigation paths to services/navigation/paths.ts
661687
- [ ] Move useTheme to hooks/use-theme/use-theme.ts
662688
- [ ] Update ThemeProvider import
663-
- [ ] Reorganize tests to __tests__ structure
689+
- [ ] Reorganize tests to **tests** structure
664690
- [ ] Update jest.config.js setupFilesAfterEnv
665691
- [ ] Migrate domain hooks to services structure
666692
- [ ] Update all import paths throughout the codebase

0 commit comments

Comments
 (0)