diff --git a/frameworks/solid/add-ons/start/assets/public/tanstack-circle-logo.png b/frameworks/solid/add-ons/start/assets/public/tanstack-circle-logo.png new file mode 100644 index 00000000..9db3e67b Binary files /dev/null and b/frameworks/solid/add-ons/start/assets/public/tanstack-circle-logo.png differ diff --git a/frameworks/solid/add-ons/start/assets/public/tanstack-word-logo-white.svg b/frameworks/solid/add-ons/start/assets/public/tanstack-word-logo-white.svg new file mode 100644 index 00000000..b6ec5086 --- /dev/null +++ b/frameworks/solid/add-ons/start/assets/public/tanstack-word-logo-white.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frameworks/solid/add-ons/start/assets/src/routes/index.tsx.ejs b/frameworks/solid/add-ons/start/assets/src/routes/index.tsx.ejs new file mode 100644 index 00000000..af90dea4 --- /dev/null +++ b/frameworks/solid/add-ons/start/assets/src/routes/index.tsx.ejs @@ -0,0 +1,154 @@ +import { createFileRoute } from "@tanstack/solid-router"; +<% if (!tailwind) { %> +import logo from "../logo.svg"; +import "../App.css"; +<% } else { %> +import { + Zap, + Server, + Route as RouteIcon, + Shield, + Waves, + Sparkles, +} from "lucide-solid"; +<% } %> + +export const Route = createFileRoute("/")({ + component: App, +}); + +function App() { + <% if (tailwind) { %> + const features = [ + { + icon: , + title: "Powerful Server Functions", + description: + "Write server-side code that seamlessly integrates with your client components. Type-safe, secure, and simple.", + }, + { + icon: , + title: "Flexible Server Side Rendering", + description: + "Full-document SSR, streaming, and progressive enhancement out of the box. Control exactly what renders where.", + }, + { + icon: , + title: "API Routes", + description: + "Build type-safe API endpoints alongside your application. No separate backend needed.", + }, + { + icon: , + title: "Strongly Typed Everything", + description: + "End-to-end type safety from server to client. Catch errors before they reach production.", + }, + { + icon: , + title: "Full Streaming Support", + description: + "Stream data from server to client progressively. Perfect for AI applications and real-time updates.", + }, + { + icon: , + title: "Next Generation Ready", + description: + "Built from the ground up for modern web applications. Deploy anywhere JavaScript runs.", + }, + ]; + + return ( +
+
+
+
+
+ TanStack Logo +

+ TANSTACK{" "} + + START + +

+
+

+ The framework for next generation AI applications +

+

+ Full-stack framework powered by TanStack Router for React and Solid. + Build modern applications with server functions, streaming, and type + safety. +

+
+ + Documentation + +

+ Begin your TanStack Start journey by editing{" "} + + /src/routes/index.tsx + +

+
+
+
+ +
+
+ {features.map((feature, index) => ( +
+
{feature.icon}
+

+ {feature.title} +

+

+ {feature.description} +

+
+ ))} +
+
+
+ ); +<% } else { %> + return ( +
+
+ +

+ Edit src/routes/index.tsx and save to reload. +

+ + Learn Solid + + + Learn TanStack + +
+
+ ); +<% } %> +} diff --git a/frameworks/solid/add-ons/start/package.json b/frameworks/solid/add-ons/start/package.json index 1c184b6f..42bdff4e 100644 --- a/frameworks/solid/add-ons/start/package.json +++ b/frameworks/solid/add-ons/start/package.json @@ -7,6 +7,7 @@ "dependencies": { "@tanstack/solid-start": "^1.132.25", "vite": "^7.1.7", - "vite-tsconfig-paths": "^5.1.4" + "vite-tsconfig-paths": "^5.1.4", + "lucide-solid": "^0.544.0" } -} +} \ No newline at end of file diff --git a/frameworks/solid/project/base/src/components/Header.tsx.ejs b/frameworks/solid/project/base/src/components/Header.tsx.ejs index 1fbe677a..9e3e3b24 100644 --- a/frameworks/solid/project/base/src/components/Header.tsx.ejs +++ b/frameworks/solid/project/base/src/components/Header.tsx.ejs @@ -1,26 +1,175 @@ <% if (addOns.length === 0 && integrations.length === 0 && routes.length === 0) { ignoreFile() } %>import { Link } from '@tanstack/solid-router' <% for(const integration of integrations.filter(i => i.type === 'header-user')) { %> - import <%= integration.jsName %> from "<%= relativePath(integration.path) %>"; - <% } %> - +import <%= integration.jsName %> from "<%= relativePath(integration.path) %>"; +<% } %><% if (tailwind) { +const icons = new Set([ + "Menu", + "X", + "Home", + "Globe", + "ChevronDown", + "ChevronRight", + "Layers", +]) + +for(const addOn of addOns) { + for(const route of (addOn?.routes||[])?.filter(r => r.url && r.name)) { + icons.add( route.icon || "Globe"); + } +} +%> +import { createSignal } from 'solid-js'; +import { + <%= Array.from(icons).sort().join(", ") %> +} from "lucide-solid"; +<% } %> + export default function Header() { +<% if (tailwind) { +const menusWithChildren = addOns.filter(a => a.routes?.some(r => r.children)); +const userHeaders = integrations.filter(i => i.type === 'header-user'); +%> + const [isOpen, setIsOpen] = createSignal(false); + const [groupedExpanded, setGroupedExpanded] = createSignal>({}); + + return ( + <> +
+ +

+ + TanStack Logo + +

+
+ + + + ); +<% } else { %> return (
- +<% if (integrations.filter(i => i.type === 'header-user').length > 0) { %>
- <% for(const integration of integrations.filter(i => i.type === 'header-user')) { %> - <<%= integration.jsName %> /> - <% } %> +<% for(const integration of integrations.filter(i => i.type === 'header-user')) { %> + <<%= integration.jsName %> /> +<% } %>
+<% } %>
) +<% } %> } diff --git a/frameworks/solid/tests/snapshots/solid/solid-cr-ts-start-npm.json b/frameworks/solid/tests/snapshots/solid/solid-cr-ts-start-npm.json index 09bf8899..83985fda 100644 --- a/frameworks/solid/tests/snapshots/solid/solid-cr-ts-start-npm.json +++ b/frameworks/solid/tests/snapshots/solid/solid-cr-ts-start-npm.json @@ -6,14 +6,14 @@ "/.vscode/settings.json": "{\n \"files.watcherExclude\": {\n \"**/routeTree.gen.ts\": true\n },\n \"search.exclude\": {\n \"**/routeTree.gen.ts\": true\n },\n \"files.readonlyInclude\": {\n \"**/routeTree.gen.ts\": true\n }\n}\n", "/public/manifest.json": "{\n \"short_name\": \"TanStack App\",\n \"name\": \"Create TanStack App Sample\",\n \"icons\": [\n {\n \"src\": \"favicon.ico\",\n \"sizes\": \"64x64 32x32 24x24 16x16\",\n \"type\": \"image/x-icon\"\n },\n {\n \"src\": \"logo192.png\",\n \"type\": \"image/png\",\n \"sizes\": \"192x192\"\n },\n {\n \"src\": \"logo512.png\",\n \"type\": \"image/png\",\n \"sizes\": \"512x512\"\n }\n ],\n \"start_url\": \".\",\n \"display\": \"standalone\",\n \"theme_color\": \"#000000\",\n \"background_color\": \"#ffffff\"\n}\n", "/public/robots.txt": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n", - "/src/components/Header.tsx": "import { Link } from '@tanstack/solid-router'\n\nexport default function Header() {\n return (\n
\n \n\n
\n
\n )\n}\n", + "/src/components/Header.tsx": "import { Link } from '@tanstack/solid-router'\n\nimport { createSignal } from 'solid-js'\nimport {\n ChevronDown,\n ChevronRight,\n Globe,\n Home,\n Layers,\n Menu,\n X,\n} from 'lucide-solid'\n\nexport default function Header() {\n const [isOpen, setIsOpen] = createSignal(false)\n const [groupedExpanded, setGroupedExpanded] = createSignal<\n Record\n >({})\n\n return (\n <>\n
\n setIsOpen(true)}\n class=\"p-2 hover:bg-gray-700 rounded-lg transition-colors\"\n aria-label=\"Open menu\"\n >\n \n \n

\n \n \n \n

\n
\n\n \n
\n

Navigation

\n setIsOpen(false)}\n class=\"p-2 hover:bg-gray-800 rounded-lg transition-colors\"\n aria-label=\"Close menu\"\n >\n \n \n
\n\n \n \n \n )\n}\n", "/src/router.tsx": "import { createRouter } from '@tanstack/solid-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\nimport './styles.css'\n\n// Create a new router instance\nexport const getRouter = () => {\n const router = createRouter({\n routeTree,\n scrollRestoration: true,\n })\n return router\n}\n", "/src/routes/__root.tsx": "import {\n HeadContent,\n Outlet,\n Scripts,\n createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nimport Header from '../components/Header'\n\nexport const Route = createRootRouteWithContext()({\n shellComponent: RootComponent,\n})\n\nfunction RootComponent() {\n return (\n <>\n \n\n
\n\n \n \n\n \n \n )\n}\n", "/src/routes/demo.start.server-funcs.tsx": "import * as fs from 'fs'\nimport { createFileRoute, useRouter } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst filePath = 'count.txt'\n\nasync function readCount() {\n return parseInt(\n await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'),\n )\n}\n\nconst getCount = createServerFn({\n method: 'GET',\n}).handler(() => {\n return readCount()\n})\n\nconst updateCount = createServerFn({ method: 'POST' })\n .inputValidator((d: number) => d)\n .handler(async ({ data }) => {\n const count = await readCount()\n await fs.promises.writeFile(filePath, `${count + data}`)\n })\n\nexport const Route = createFileRoute('/demo/start/server-funcs')({\n component: Home,\n loader: async () => await getCount(),\n})\n\nfunction Home() {\n const router = useRouter()\n const state = Route.useLoaderData()\n\n return (\n
\n {\n updateCount({ data: 1 }).then(() => {\n router.invalidate()\n })\n }}\n class=\"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded\"\n >\n Add 1 to {state}?\n \n
\n )\n}\n", - "/src/routes/index.tsx": "import * as Solid from 'solid-js'\nimport { createFileRoute } from '@tanstack/solid-router'\n\nimport logo from '../logo.svg'\n\nexport const Route = createFileRoute('/')({\n component: IndexComponent,\n})\n\nfunction IndexComponent() {\n return (\n
\n
\n \n

\n Edit src/routes/index.tsx and save to reload.\n

\n \n Learn Solid\n \n \n Learn TanStack\n \n
\n
\n )\n}\n", + "/src/routes/index.tsx": "import { createFileRoute } from '@tanstack/solid-router'\n\nimport {\n Zap,\n Server,\n Route as RouteIcon,\n Shield,\n Waves,\n Sparkles,\n} from 'lucide-solid'\n\nexport const Route = createFileRoute('/')({\n component: App,\n})\n\nfunction App() {\n const features = [\n {\n icon: ,\n title: 'Powerful Server Functions',\n description:\n 'Write server-side code that seamlessly integrates with your client components. Type-safe, secure, and simple.',\n },\n {\n icon: ,\n title: 'Flexible Server Side Rendering',\n description:\n 'Full-document SSR, streaming, and progressive enhancement out of the box. Control exactly what renders where.',\n },\n {\n icon: ,\n title: 'API Routes',\n description:\n 'Build type-safe API endpoints alongside your application. No separate backend needed.',\n },\n {\n icon: ,\n title: 'Strongly Typed Everything',\n description:\n 'End-to-end type safety from server to client. Catch errors before they reach production.',\n },\n {\n icon: ,\n title: 'Full Streaming Support',\n description:\n 'Stream data from server to client progressively. Perfect for AI applications and real-time updates.',\n },\n {\n icon: ,\n title: 'Next Generation Ready',\n description:\n 'Built from the ground up for modern web applications. Deploy anywhere JavaScript runs.',\n },\n ]\n\n return (\n
\n
\n
\n
\n
\n \n

\n TANSTACK{' '}\n \n START\n \n

\n
\n

\n The framework for next generation AI applications\n

\n

\n Full-stack framework powered by TanStack Router for React and Solid.\n Build modern applications with server functions, streaming, and type\n safety.\n

\n
\n \n Documentation\n \n

\n Begin your TanStack Start journey by editing{' '}\n \n /src/routes/index.tsx\n \n

\n
\n
\n
\n\n
\n
\n {features.map((feature, index) => (\n \n
{feature.icon}
\n

\n {feature.title}\n

\n

{feature.description}

\n
\n ))}\n
\n \n \n )\n}\n", "/src/styles.css": "@import \"tailwindcss\";\n\nbody {\n @apply m-0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\",\n \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\",\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n}\n", "README.md": "Welcome to your new TanStack app! \n\n# Getting Started\n\nTo run this application:\n\n```bash\nnpm install\nnpm run start\n```\n\n# Building For Production\n\nTo build this application for production:\n\n```bash\nnpm run build\n```\n\n## Styling\n\nThis project uses [Tailwind CSS](https://tailwindcss.com/) for styling.\n\n\n\n## Routing\nThis project uses [TanStack Router](https://tanstack.com/router). The initial setup is a file based router. Which means that the routes are managed as files in `src/routes`.\n\n### Adding A Route\n\nTo add a new route to your application just add another a new file in the `./src/routes` directory.\n\nTanStack will automatically generate the content of the route file for you.\n\nNow that you have two routes you can use a `Link` component to navigate between them.\n\n### Adding Links\n\nTo use SPA (Single Page Application) navigation you will need to import the `Link` component from `@tanstack/solid-router`.\n\n```tsx\nimport { Link } from \"@tanstack/solid-router\";\n```\n\nThen anywhere in your JSX you can use it like so:\n\n```tsx\nAbout\n```\n\nThis will create a link that will navigate to the `/about` route.\n\nMore information on the `Link` component can be found in the [Link documentation](https://tanstack.com/router/v1/docs/framework/solid/api/router/linkComponent).\n\n### Using A Layout\n\nIn the File Based Routing setup the layout is located in `src/routes/__root.tsx`. Anything you add to the root route will appear in all the routes. The route content will appear in the JSX where you use the `` component.\n\nHere is an example layout that includes a header:\n\n```tsx\nimport { Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nimport { Link } from \"@tanstack/solid-router\";\n\nexport const Route = createRootRoute({\n component: () => (\n <>\n
\n \n
\n \n \n \n ),\n})\n```\n\nThe `` component is not required so you can remove it if you don't want it in your layout.\n\nMore information on layouts can be found in the [Layouts documentation](https://tanstack.com/router/latest/docs/framework/solid/guide/routing-concepts#layouts).\n\n## Data Fetching\n\nThere are multiple ways to fetch data in your application. You can use TanStack Query to fetch data from a server. But you can also use the `loader` functionality built into TanStack Router to load the data for a route before it's rendered.\n\nFor example:\n\n```tsx\nconst peopleRoute = createRoute({\n getParentRoute: () => rootRoute,\n path: \"/people\",\n loader: async () => {\n const response = await fetch(\"https://swapi.dev/api/people\");\n return response.json() as Promise<{\n results: {\n name: string;\n }[];\n }>;\n },\n component: () => {\n const data = peopleRoute.useLoaderData();\n return (\n
    \n {data.results.map((person) => (\n
  • {person.name}
  • \n ))}\n
\n );\n },\n});\n```\n\nLoaders simplify your data fetching logic dramatically. Check out more information in the [Loader documentation](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#loader-parameters).\n\n# Demo files\n\nFiles prefixed with `demo` can be safely deleted. They are there to provide a starting point for you to play around with the features you've installed.\n\n\n\n# Learn More\n\nYou can learn more about all of the offerings from TanStack in the [TanStack documentation](https://tanstack.com).\n", - "package.json": "{\n \"name\": \"TEST\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite dev --port 3000\",\n \"build\": \"vite build\",\n \"serve\": \"vite preview\",\n \"test\": \"vitest run\",\n \"start\": \"node .output/server/index.mjs\"\n },\n \"dependencies\": {\n \"@tailwindcss/vite\": \"^4.0.6\",\n \"@tanstack/router-plugin\": \"^1.121.3\",\n \"@tanstack/solid-router\": \"^1.132.25\",\n \"@tanstack/solid-router-devtools\": \"^1.132.25\",\n \"@tanstack/solid-start\": \"^1.132.25\",\n \"solid-js\": \"^1.9.5\",\n \"tailwindcss\": \"^4.0.6\",\n \"vite\": \"^7.1.7\",\n \"vite-tsconfig-paths\": \"^5.1.4\"\n },\n \"devDependencies\": {\n \"typescript\": \"^5.7.2\",\n \"vite\": \"^7.1.7\",\n \"vite-plugin-solid\": \"^2.11.2\"\n }\n}", + "package.json": "{\n \"name\": \"TEST\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite dev --port 3000\",\n \"build\": \"vite build\",\n \"serve\": \"vite preview\",\n \"test\": \"vitest run\",\n \"start\": \"node .output/server/index.mjs\"\n },\n \"dependencies\": {\n \"@tailwindcss/vite\": \"^4.0.6\",\n \"@tanstack/router-plugin\": \"^1.121.3\",\n \"@tanstack/solid-router\": \"^1.132.25\",\n \"@tanstack/solid-router-devtools\": \"^1.132.25\",\n \"@tanstack/solid-start\": \"^1.132.25\",\n \"lucide-solid\": \"^0.544.0\",\n \"solid-js\": \"^1.9.5\",\n \"tailwindcss\": \"^4.0.6\",\n \"vite\": \"^7.1.7\",\n \"vite-tsconfig-paths\": \"^5.1.4\"\n },\n \"devDependencies\": {\n \"typescript\": \"^5.7.2\",\n \"vite\": \"^7.1.7\",\n \"vite-plugin-solid\": \"^2.11.2\"\n }\n}", "tsconfig.json": "{\n \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"jsx\": \"preserve\",\n \"jsxImportSource\": \"solid-js\",\n \"module\": \"ESNext\",\n \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n \"types\": [\"vite/client\"],\n\n /* Bundler mode */\n \"moduleResolution\": \"bundler\",\n \"allowImportingTsExtensions\": true,\n \"verbatimModuleSyntax\": true,\n \"noEmit\": true,\n\n /* Linting */\n \"skipLibCheck\": true,\n \"strict\": true,\n \"noUnusedLocals\": true,\n \"noUnusedParameters\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"noUncheckedSideEffectImports\": true\n }\n}\n", "vite.config.ts": "import { defineConfig } from 'vite'\nimport viteTsConfigPaths from 'vite-tsconfig-paths'\nimport tailwindcss from '@tailwindcss/vite'\n\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport solidPlugin from 'vite-plugin-solid'\n\nexport default defineConfig({\n plugins: [\n // this is the plugin that enables path aliases\n viteTsConfigPaths({\n projects: ['./tsconfig.json'],\n }),\n tailwindcss(),\n tanstackStart(),\n solidPlugin({ ssr: true }),\n ],\n})\n" },