Catalog
expo/expo-project-structure

expo

expo-project-structure

Folder structure for a new Expo app. Use when scaffolding or laying out a new Expo project with Expo Router, or deciding where a file should live in one. For new projects only — never restructure an existing app to match.

NewUpdated Nov 25, 2026

Expo Project Structure

A starting skeleton for a new Expo app — one with no committed folder structure yet.

Apply only to new projects. If the app already has a layout, follow its existing conventions and leave files where they are — a default to start from, never a standard to enforce or migrate toward. When unsure whether a project is new, ask before moving anything.

The whole layout, assembled from the rules below:

├── assets/
├── scripts/
├── src/
│   ├── app/                       # Expo Router routes ONLY — every file is a route
│   │   ├── api/                   #   server API routes, grouped here
│   │   │   ├── user+api.ts
│   │   │   └── settings+api.ts
│   │   ├── _layout.tsx
│   │   ├── _layout.web.tsx         #   platform-specific layout
│   │   ├── index.tsx
│   │   └── settings.tsx
│   ├── components/                 # reusable UI: button, card, table…
│   │   ├── table/                  #   complex component → folder + index.tsx
│   │   │   ├── cell.tsx
│   │   │   └── index.tsx
│   │   ├── bar-chart.tsx
│   │   ├── bar-chart.web.tsx        #   platform-specific variant
│   │   └── button.tsx
│   ├── screens/                    # screen bodies that route files render
│   │   ├── home/
│   │   │   ├── card.tsx            #   used only by Home — not shared
│   │   │   └── index.tsx           #   rendered by src/app/index.tsx
│   │   └── settings.tsx
│   ├── server/                     # server-only helpers used by app/api
│   │   ├── auth.ts
│   │   └── db.ts
│   ├── utils/                      # standalone helpers + colocated tests
│   │   ├── format-date.ts
│   │   └── format-date.test.ts
│   ├── hooks/                      # reusable hooks: use-theme.ts…
│   ├── constants.ts
│   └── theme.ts
├── app.json
├── eas.json
└── package.json

src/ and src/app

Keep app code under src/ to separate it from config files. Expo Router supports both app/ and src/app/ out of the box — to switch, move the folder and restart the bundler. The default template aliases @/* to ./src/* in tsconfig.json.

src/app is routes-only: every file there becomes a route, so nothing else belongs in it. Everything below lives in sibling folders.

components/ — reusable UI

Generic, reused UI (button, card, table) with one named export each. Name files in kebab-case (bar-chart.tsx), matching the default create-expo-app template. When a component grows, give it its own folder with the root in index.tsx and colocate its private sub-components beside it — the import path (@/components/table) stays unchanged.

screens/ — screen bodies

Because app/ files must be routes, complex screen UI that isn't reused has no home there. Once a screen grows big enough to need breaking out to separate components, put it in screens/ and let each route just render its screen:

import { Home } from "@/screens/home";

export default function HomeScreen() {
  // route-specific concerns only — e.g. read url params here
  return <Home />;
}

Colocate a screen's private components inside its folder (screens/home/components/). A bonus: the same screen can render under multiple routes.

server/ + app/api/ — separate server code

Appending +api to a file in app/ makes it a server API route. Server code is different from frontend code — it runs in a Node-like server environment (deployed with EAS Hosting or on third-party services) and can read secret env vars (process.env.X, not just EXPO_PUBLIC_*). Keep it apart:

  • Group all routes under app/api/ → /api/user, /api/settings. This colocates them and avoids collisions (e.g. a /user screen and a /user route).
  • Put shared server-only helpers in src/server/.
  • Consider ESLint rules that fence +api files and server/ off from frontend-only checks.

Platform-specific code

Small differences: use Platform.select / Platform.OS. For larger ones, split into platform files instead of inline if/else — bar-chart.tsx + bar-chart.web.tsx, imported extension-free (@/components/bar-chart); Metro picks the right file per target.

  • Props must be identical across variants.
  • A default file (no platform extension) is always required — make it a no-op if the component is single-platform.
  • Supported extensions: .ios, .android, .native, .web.

Colocate styles and tests

  • Styles: keep the StyleSheet.create({ ... }) object at the bottom of the component file rather than in a separate .styles file.
  • Tests: put format-date.test.ts next to format-date.ts (preferred over a separate __tests__/ folder) so tested files are obvious at a glance.

AI and config files

Agent instructions live at the repo root — AGENTS.md / CLAUDE.md, with project skills under .claude/. Other config and assets stay outside src/: app.json / app.config.ts, eas.json, package.json, assets/, and scripts/.


Based on Expo app folder structure best practices by Kadi Kraman. For src/ precedence and alias mechanics, see the Expo docs.

Submitting Feedback

If this skill has an error, or misleading or outdated information, tell the user and offer to report it to Expo. A report is optional, and the user decides. Do not send a report before the user agrees. The feedback command of the agent CLI sends a report. Its --help lists the categories (skills with the subject "expo-project-structure", agent-cli for a problem with the agent CLI, evals when an agent repeatedly fails at an Expo task) and the data that a report sends. Show the user the message, and tell the user that the report also carries project and environment details. If you cannot ask the user, put the command with your message in your final summary, so the user can send it. Do not include secrets or personal data.

Files2
2 files · 1.4 KB

Select a file to preview

Overall Score

88/100

Grade

A

Excellent

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

92

Quality

86

Clarity

89

Completeness

82

Summary

This skill provides a folder structure template for new Expo apps using Expo Router. It documents conventions for organizing routes, components, screens, server code, and platform-specific files, with explicit guidance that this structure applies only to new projects and should not enforce migrations in existing apps.

Static Analysis Findings

1 finding

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Credential Exposure
SEC-020Direct .env File Access

Direct .env file access

SKILL.md.env

Detected Capabilities

folder structure documentationcode organization guidanceplatform-specific file variant explanation

Trigger Keywords

Phrases that agents use to match this skill to user intent.

scaffold new expo appexpo folder layoutorganize expo projectexpo router setupexpo app structure

Risk Signals

INFO

.env file mentioned in context of API routes and environment variables

SKILL.md | Section: 'server/ + app/api/ — separate server code'

Referenced Domains

External domains referenced in skill content, detected by static analysis.

docs.expo.devexpo.dev

Use Cases

  • /scaffold a new Expo app with recommended folder layout
  • organize code in a fresh Expo Router project
  • place UI components, screens, and server routes correctly
  • implement platform-specific code variants (iOS/Android/web)
  • colocate styles and tests with source files in Expo projects

Quality Notes

  • Skill is well-scoped and explicitly constrains its applicability to new projects, with a clear warning against applying it to existing codebases
  • Clear visual hierarchy with the full folder tree diagram followed by detailed section-by-section explanations
  • Practical guidelines for colocating styles and tests with source files, reducing boilerplate folder structure
  • Platform-specific file variant handling is well-explained with naming conventions and fallback rules
  • Good separation of concerns documented (routes-only app/, server code separation, screen encapsulation)
  • Security note about environment variables is contextually appropriate — distinguishes EXPO_PUBLIC_* (browser-visible) from process.env.X (server-only), which is a best practice
  • References to external documentation (Expo docs, blog) are helpful but could be rendered as explicit links
  • Feedback submission section provides clear guidance on reporting errors, with mention of optional user consent
Model: claude-haiku-4-5-20251001Analyzed: Nov 25, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v2.6

    Content updated

    ✦ AIRewrites feedback submission instructions: shifts from executable bash command to agent guidance model emphasizing user consent and optional reporting.

    2026-11-25

    LATEST
  2. v2.5

    Content updated

    ✦ AIRewords feedback submission guidance to emphasize voluntary reporting and data privacy safeguards.

    2026-11-15

    View This Version
  3. v2.4

    Content updated

    ✦ AIFeedback command now uses --message flag instead of positional argument; adds message character-length requirement (40–5,000) and guidance for reporting agent-cli issues.

    2026-11-13

    View This Version
  4. v2.3

    Content updated

    ✦ AINo behavioral changes detected in this release.

    2026-10-29

    View This Version
  5. v2.2

    Content updated

    ✦ AIUpdates feedback submission command from submit-expo-feedback to @expo/agent-cli

    2026-10-23

    View This Version
  6. v2.1

    Content updated

    ✦ AIClarifies feedback submission: removes reference to separate skill, specifies report format and command-line flags.

    2026-10-22

    View This Version
  7. v2.0

    Contract changed: description

    ✦ AIRemoves "Framework (OSS)" label from skill activation criteria.

    triggering2026-10-03

    View This Version
  8. v1.1

    Content updated

    ✦ AIAdds feedback submission instructions for Expo skill issues.

    2026-09-09

    View This Version
  9. v1.0

    2026-07-15

    View This VersionInitial version

Use expo/expo-project-structure in your dev environment

Command Palette

Search for a command to run...