Skip to main content
Glama

generate-project-files

Create starter files for new React Native Expo Router projects with navigation layouts, Zustand store, API client, NativeWind config, TypeScript setup, and sample screens.

Instructions

Generate starter files for a NEW React Native + Expo Router project. Produces actual file contents: navigation layouts, Zustand store, API client, NativeWind config, TypeScript config, and sample screens.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appNameYesApp name
featuresNoList of features (e.g. ["auth", "catalog", "cart"])
includeCINoInclude GitHub Actions CI/CD

Implementation Reference

  • The main handler function `generateProjectFiles` that orchestrates the creation of all required project files based on provided options.
    export function generateProjectFiles(options: ProjectFilesOptions): string {
      const {
        appName,
        features = [],
        includeCI = false,
        includeEnvSetup = true,
      } = options;
    
      const files: GeneratedFile[] = [];
    
      // Common files
      files.push(...getCommonFiles(appName));
    
      // tsconfig.json with path aliases
      files.push(getTsConfig());
    
      // Expo Router files
      files.push(...getExpoRouterFiles(appName, features));
    
      // Store files
      files.push(...getStoreFiles());
    
      // API files
      files.push(...getApiFiles());
    
      // Env setup
      if (includeEnvSetup) {
        files.push(...getEnvFiles(appName));
      }
    
      // CI/CD
      if (includeCI) {
        files.push(...getCIFiles());
      }
    
      // Format output
      const output = files
        .map((f) => `## ${f.path}\n\`\`\`${getExt(f.path)}\n${f.content}\n\`\`\``)
        .join("\n\n");
    
      const cleanupInstructions = `## Cleanup Template Files
    
    If your project was created from a template with example files, remove them:
    
    \`\`\`bash
    rm -f "app/(tabs)/two.tsx" app/modal.tsx app/+html.tsx
    rm -f components/EditScreenInfo.tsx components/StyledText.tsx components/Themed.tsx
    rm -f constants/Colors.ts
    \`\`\`
    
    Update \`app/+not-found.tsx\` — replace any \`@/components/Themed\` import with standard \`react-native\`:
    \`\`\`tsx
    import { Text, View } from 'react-native';
    \`\`\``;
    
      return `# Starter Files for ${appName} (Expo Router)
    
    Create the following files in your project:
    
    ${output}
    
    ${cleanupInstructions}
    
    ---
    
    After creating the files:
    \`\`\`bash
    npx expo install babel-plugin-module-resolver babel-plugin-react-compiler
    npm install
    npx expo prebuild --clean
    npx expo run:ios     # or npx expo run:android
    \`\`\`
    
    > **Note:** This project uses \`react-native-mmkv\` — a native module that does **not work in Expo Go**. You need \`expo prebuild\` to generate native projects (ios/android folders), then run via \`expo run:ios\` / \`expo run:android\`.
    `;
    }
  • src/index.ts:271-297 (registration)
    Registration of the `generate-project-files` tool in the MCP server, including input schema validation and handler invocation.
    server.tool(
      "generate-project-files",
      "Generate starter files for a NEW React Native + Expo Router project. Produces actual file contents: navigation layouts, Zustand store, API client, NativeWind config, TypeScript config, and sample screens.",
      {
        appName: z.string().describe("App name"),
        features: z
          .array(z.string())
          .optional()
          .describe('List of features (e.g. ["auth", "catalog", "cart"])'),
        includeCI: z
          .boolean()
          .default(false)
          .describe("Include GitHub Actions CI/CD"),
      },
      async ({ appName, features, includeCI }) => {
        const content = generateProjectFiles({
          appName,
          router: "expo-router",
          features,
          includeCI,
          includeEnvSetup: true,
        });
        return {
          content: [{ type: "text", text: content }],
        };
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ZaharGusyatin/react-native-expo-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server