{ "id": "b506c389fb7c42ac06dd41e5", "source": "solid:signals", "type": "github-document", "title": "file-routes", "content": "---\ntitle: FileRoutes\nuse_cases: \u003e-\n file-based routing, automatic route generation, spa routing, route\n configuration\ntags:\n - routing\n - files\n - routes\n - navigation\n - filesystem\n - spa\nversion: '1.0'\ndescription: \u003e-\n Automatically generate routes from file structure in SolidStart. Create route\n configurations from files in the /src/routes directory.\n---\n\n`FileRoutes` is a component that creates a [`Route`](/solid-router/reference/components/route) for each file in the `/src/routes` directory.\nThis creates a `route` export to define the route configuration for the router of your choice.\n\nFor example, using [`solid-router`](/solid-router) would look like the following:\n\n```tsx {7-9} title=\"app.tsx\"\nimport { Suspense } from \"solid-js\";\nimport { Router } from \"@solidjs/router\";\nimport { FileRoutes } from \"@solidjs/start/router\";\n\nexport default function App() {\n\treturn (\n\t\t\u003cRouter root={(props) =\u003e \u003cSuspense\u003e{props.children}\u003c/Suspense\u003e}\u003e\n\t\t\t\u003cFileRoutes /\u003e\n\t\t\u003c/Router\u003e\n\t);\n}\n```\n\nSee the [SolidStart routing guide](/solid-start/building-your-application/routing) for more details.\n\n:::caution\nIf removing the `FileRoutes` component from your `app.tsx` file, you will need to manually add all of your routes.\n\nWhile this is possible it does come with tradeoffs.\nFor example, optimizations such as preloaded script tags will no longer be available.\n\n:::", "url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/solid-start/reference/routing/file-routes.mdx", "metadata": { "path": "src/routes/solid-start/reference/routing/file-routes.mdx", "repo": "solidjs/solid-docs", "repo_url": "https://github.com/solidjs/solid-docs.git", "size": 1375, "source_type": "github" }, "hash": "f0044072c97097e9eb74eb4e292ae3afb082f4962acef5d34f8b58e195b3fc69", "timestamp": "2026-02-23T11:43:00.19502637+01:00" }