Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/expo/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expo",
"version": "1.5.0",
"version": "1.6.0",
"description": "Official Expo skills for building, deploying, upgrading, and debugging Expo apps",
"author": {
"name": "Expo Team",
Expand Down
2 changes: 1 addition & 1 deletion plugins/expo/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expo",
"version": "1.5.0",
"version": "1.6.0",
"description": "Official Expo skills for building, deploying, upgrading, and debugging Expo and React Native apps.",
"author": {
"name": "Expo Team",
Expand Down
2 changes: 1 addition & 1 deletion plugins/expo/.cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "expo",
"displayName": "Expo",
"version": "1.5.0",
"version": "1.6.0",
"description": "Official Expo skills for building, deploying, upgrading, and debugging Expo and React Native apps.",
"author": {
"name": "Expo Team",
Expand Down
2 changes: 2 additions & 0 deletions plugins/expo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Official AI agent skills from the Expo team for building, deploying, upgrading,

### App Design

- Recommends a starting folder structure for new projects
- Provides UI guidelines following Apple Human Interface Guidelines
- Covers Expo Router navigation patterns (stacks, tabs, modals, sheets)
- Explains native iOS controls, SF Symbols, animations, and visual effects
Expand Down Expand Up @@ -69,6 +70,7 @@ Official AI agent skills from the Expo team for building, deploying, upgrading,
- **expo-api-routes** β€” Create API routes in Expo Router with EAS Hosting
- **expo-brownfield** β€” Integrate Expo and React Native into existing native iOS or Android apps
- **expo-dev-client** β€” Build and distribute Expo development clients locally or via TestFlight
- **expo-project-structure** β€” Recommended folder structure for new Expo projects
- **expo-tailwind-setup** β€” Set up Tailwind CSS v4 in Expo with NativeWind v5
- **expo-ui** β€” Native UI with @expo/ui: universal cross-platform components first, with SwiftUI and Jetpack Compose for platform-specific needs
- **native-data-fetching** β€” Network requests, API calls, caching, and offline support
Expand Down
106 changes: 106 additions & 0 deletions plugins/expo/skills/expo-project-structure/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
name: expo-project-structure
description: 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.
version: 1.0.0
license: MIT
---

# 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. Put it in `screens/` and let each route just render its screen:

```tsx
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 EAS Hosting environment 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](https://expo.dev/blog/expo-app-folder-structure-best-practices) by Kadi Kraman. For `src/` precedence and alias mechanics, see the [Expo docs](https://docs.expo.dev/router/reference/src-directory/).
Loading