Start interactive tutorial

← Back to Projects

Modular Architecture with React Native

Difficulty

  • intermediate

Average duration

1 hrs

Technologies

Difficulty

  • intermediate

Average duration

1 hrs

Technologies

📝 Instructions

Modular architecture is a way of organizing code that divides an application into independent modules or “features”, each with its own logic, screens, state, and components.

The goal of this project is for you to learn how to structure a React Native CLI app with TypeScript following this approach, making it more scalable, maintainable, and easier to understand.

🌱 How to Start This Project

Clone the movie catalog project you have already created. This project will serve as a starting point to practice modularization.

🖥️ Initial Steps

  • Once you have cloned your project, install the dependencies:
1cd react-native-movie-catalogue 2npm install
  • On iOS, install the pods:
1cd ios && pod install && cd ..
  • Run the base project to verify that everything works:
1npm run android 2npm run ios

💡 Important: Remember to save and upload your code to GitHub by creating a new repository, updating the remote (git remote set-url origin <your new url>), and pushing the code to your new repository using the add, commit, and push commands from the git terminal.

📝 Instructions

The goal is to modularize the movie catalog app, migrating the Movies and Categories sections.

  1. Create the features and shared structure:
    1src/ 2 features/ 3 movies/{screens,components,store} 4 categories/{screens,store} 5 shared/{ui,lib,types} 6 navigation/{StackNavigator.tsx, feature-registry.ts}
  2. Move the screens to their corresponding feature:
    • HomeScreenfeatures/movies/screens/MoviesListScreen.tsx
    • MovieDetailScreenfeatures/movies/screens/MovieDetailScreen.tsx
    • CategoriesScreenfeatures/categories/screens/CategoriesScreen.tsx
    • CategoryMoviesScreenfeatures/categories/screens/CategoryMoviesScreen.tsx
  3. Place generic data and UI in @shared:
    • shared/lib/movies.ts with an array movies and helper getMoviesByCategory.
    • shared/ui/Grid.tsx for spacing content.
    • shared/types/index.ts with the Movie type.
  4. Create a store per feature (Zustand):
    • features/movies/store/movies.store.ts with favorites, toggle, isFav.
    • features/categories/store/categories.store.ts with active, setActive.
  5. Create an index.ts file in each feature as an entry point (features/<x>/index.ts) and define routes: moviesRoutes and categoriesRoutes.

This file will act as the module's entry point, re-exporting screens, stores, or components that should be accessible from outside and grouping the feature's routes. Everything else inside the folder is considered internal to the module.

  1. Register the routes in navigation/feature-registry.ts and mount them in StackNavigator.tsx.
  2. Set up import aliases in tsconfig.json and babel.config.js for @/*, @features/*, @shared/*.
  3. Avoid cross-feature imports: you can only import from @shared/*.

Strategy

  1. Structure first, logic later: create features/ and shared/.
  2. Move screens and data to the correct place.
  3. Connect navigation from the feature routes.
  4. Add minimal stores per feature.
  5. Test the complete flow: list → detail, categories → filtered list.

Signup and get access to this project for free

We will use it to give you access to your account.
Already have an account? Login here.

By signing up, you agree to the Terms and conditions and Privacy policy.

Difficulty

  • intermediate

Average duration

1 hrs

Technologies

Difficulty

  • intermediate

Average duration

1 hrs

Technologies

Difficulty

  • intermediate

Average duration

1 hrs

Technologies

Difficulty

  • intermediate

Average duration

1 hrs

Technologies

Signup and get access to this project for free

We will use it to give you access to your account.
Already have an account? Login here.

By signing up, you agree to the Terms and conditions and Privacy policy.

Difficulty

  • intermediate

Average duration

1 hrs

Technologies

Difficulty

  • intermediate

Average duration

1 hrs

Technologies