šŸ“„ expo/router/reference/src-directory

File: src-directory.md | Updated: 11/15/2025

Source: https://docs.expo.dev/router/reference/src-directory

Hide navigation

Search

Ctrl K

Home Guides EAS Reference Learn

Archive Expo Snack Discord and Forums Newsletter

Top-level src directory

Edit page

Copy page

Learn how to use a top-level src directory in your Expo Router project.

Edit page

Copy page


As your project grows, it can be helpful to move all the directories containing application code into a single src directory. Expo Router supports this out of the box.

src

 app

  _layout.tsx

  index.tsx

 components

  button.tsx

package.json

Simply move your app directory to src/app and restart the development server.

Terminal

-Ā npx expo start

# Or export for production

-Ā npx expo export

Notes:

  • The config files (app.config.ts, app.json, package.json, metro.config.js, tsconfig.json) should remain in the root directory.
  • The src/app directory takes higher precedence than the root app directory. Only the src/app directory will be used if you have both.
  • The public directory should remain in the root directory.
  • Static rendering will automatically use the src/app directory if it exists.
  • You may consider updating any type aliases to point to the src directory instead of the root directory.

Custom directory


Changing the default root directory is highly discouraged. We will not accept bug reports regarding projects with custom root directories.

You can dangerously customize the root directory using the Expo Router Config Plugin. The following will change the root directory to src/routes, relative to the project root.

app.json

Copy

{ "plugins": [ [ "expo-router", { "root": "./src/routes" } ] ] }

This may lead to unexpected behavior. Many tools assume the root directory to be either app or src/app. Only tools in the exact version of Expo CLI will respect the config plugin.