litestar-vite 0.1.1__py3-none-any.whl → 0.15.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. litestar_vite/__init__.py +54 -4
  2. litestar_vite/__metadata__.py +12 -7
  3. litestar_vite/_codegen/__init__.py +26 -0
  4. litestar_vite/_codegen/inertia.py +407 -0
  5. litestar_vite/_codegen/openapi.py +233 -0
  6. litestar_vite/_codegen/routes.py +653 -0
  7. litestar_vite/_codegen/ts.py +235 -0
  8. litestar_vite/_handler/__init__.py +8 -0
  9. litestar_vite/_handler/app.py +524 -0
  10. litestar_vite/_handler/routing.py +130 -0
  11. litestar_vite/cli.py +1147 -10
  12. litestar_vite/codegen.py +39 -0
  13. litestar_vite/commands.py +79 -0
  14. litestar_vite/config.py +1594 -70
  15. litestar_vite/deploy.py +355 -0
  16. litestar_vite/doctor.py +1179 -0
  17. litestar_vite/exceptions.py +78 -0
  18. litestar_vite/executor.py +316 -0
  19. litestar_vite/handler.py +9 -0
  20. litestar_vite/html_transform.py +426 -0
  21. litestar_vite/inertia/__init__.py +53 -0
  22. litestar_vite/inertia/_utils.py +114 -0
  23. litestar_vite/inertia/exception_handler.py +172 -0
  24. litestar_vite/inertia/helpers.py +1043 -0
  25. litestar_vite/inertia/middleware.py +54 -0
  26. litestar_vite/inertia/plugin.py +133 -0
  27. litestar_vite/inertia/request.py +286 -0
  28. litestar_vite/inertia/response.py +706 -0
  29. litestar_vite/inertia/types.py +316 -0
  30. litestar_vite/loader.py +462 -121
  31. litestar_vite/plugin.py +2160 -21
  32. litestar_vite/py.typed +0 -0
  33. litestar_vite/scaffolding/__init__.py +20 -0
  34. litestar_vite/scaffolding/generator.py +270 -0
  35. litestar_vite/scaffolding/templates.py +437 -0
  36. litestar_vite/templates/__init__.py +0 -0
  37. litestar_vite/templates/addons/tailwindcss/tailwind.css.j2 +1 -0
  38. litestar_vite/templates/angular/index.html.j2 +12 -0
  39. litestar_vite/templates/angular/openapi-ts.config.ts.j2 +18 -0
  40. litestar_vite/templates/angular/package.json.j2 +35 -0
  41. litestar_vite/templates/angular/src/app/app.component.css.j2 +3 -0
  42. litestar_vite/templates/angular/src/app/app.component.html.j2 +1 -0
  43. litestar_vite/templates/angular/src/app/app.component.ts.j2 +9 -0
  44. litestar_vite/templates/angular/src/app/app.config.ts.j2 +5 -0
  45. litestar_vite/templates/angular/src/main.ts.j2 +9 -0
  46. litestar_vite/templates/angular/src/styles.css.j2 +9 -0
  47. litestar_vite/templates/angular/tsconfig.app.json.j2 +34 -0
  48. litestar_vite/templates/angular/tsconfig.json.j2 +20 -0
  49. litestar_vite/templates/angular/vite.config.ts.j2 +21 -0
  50. litestar_vite/templates/angular-cli/.postcssrc.json.j2 +5 -0
  51. litestar_vite/templates/angular-cli/angular.json.j2 +36 -0
  52. litestar_vite/templates/angular-cli/openapi-ts.config.ts.j2 +18 -0
  53. litestar_vite/templates/angular-cli/package.json.j2 +27 -0
  54. litestar_vite/templates/angular-cli/proxy.conf.json.j2 +18 -0
  55. litestar_vite/templates/angular-cli/src/app/app.component.css.j2 +3 -0
  56. litestar_vite/templates/angular-cli/src/app/app.component.html.j2 +1 -0
  57. litestar_vite/templates/angular-cli/src/app/app.component.ts.j2 +9 -0
  58. litestar_vite/templates/angular-cli/src/app/app.config.ts.j2 +5 -0
  59. litestar_vite/templates/angular-cli/src/index.html.j2 +13 -0
  60. litestar_vite/templates/angular-cli/src/main.ts.j2 +6 -0
  61. litestar_vite/templates/angular-cli/src/styles.css.j2 +10 -0
  62. litestar_vite/templates/angular-cli/tailwind.config.js.j2 +4 -0
  63. litestar_vite/templates/angular-cli/tsconfig.app.json.j2 +16 -0
  64. litestar_vite/templates/angular-cli/tsconfig.json.j2 +26 -0
  65. litestar_vite/templates/angular-cli/tsconfig.spec.json.j2 +9 -0
  66. litestar_vite/templates/astro/astro.config.mjs.j2 +28 -0
  67. litestar_vite/templates/astro/openapi-ts.config.ts.j2 +15 -0
  68. litestar_vite/templates/astro/src/layouts/Layout.astro.j2 +63 -0
  69. litestar_vite/templates/astro/src/pages/index.astro.j2 +36 -0
  70. litestar_vite/templates/astro/src/styles/global.css.j2 +1 -0
  71. litestar_vite/templates/base/.gitignore.j2 +42 -0
  72. litestar_vite/templates/base/openapi-ts.config.ts.j2 +15 -0
  73. litestar_vite/templates/base/package.json.j2 +38 -0
  74. litestar_vite/templates/base/resources/vite-env.d.ts.j2 +1 -0
  75. litestar_vite/templates/base/tsconfig.json.j2 +37 -0
  76. litestar_vite/templates/htmx/src/main.js.j2 +8 -0
  77. litestar_vite/templates/htmx/templates/base.html.j2.j2 +56 -0
  78. litestar_vite/templates/htmx/templates/index.html.j2.j2 +13 -0
  79. litestar_vite/templates/htmx/vite.config.ts.j2 +40 -0
  80. litestar_vite/templates/nuxt/app.vue.j2 +29 -0
  81. litestar_vite/templates/nuxt/composables/useApi.ts.j2 +33 -0
  82. litestar_vite/templates/nuxt/nuxt.config.ts.j2 +31 -0
  83. litestar_vite/templates/nuxt/openapi-ts.config.ts.j2 +15 -0
  84. litestar_vite/templates/nuxt/pages/index.vue.j2 +54 -0
  85. litestar_vite/templates/react/index.html.j2 +13 -0
  86. litestar_vite/templates/react/src/App.css.j2 +56 -0
  87. litestar_vite/templates/react/src/App.tsx.j2 +19 -0
  88. litestar_vite/templates/react/src/main.tsx.j2 +10 -0
  89. litestar_vite/templates/react/vite.config.ts.j2 +39 -0
  90. litestar_vite/templates/react-inertia/index.html.j2 +14 -0
  91. litestar_vite/templates/react-inertia/package.json.j2 +46 -0
  92. litestar_vite/templates/react-inertia/resources/App.css.j2 +68 -0
  93. litestar_vite/templates/react-inertia/resources/main.tsx.j2 +17 -0
  94. litestar_vite/templates/react-inertia/resources/pages/Home.tsx.j2 +18 -0
  95. litestar_vite/templates/react-inertia/resources/ssr.tsx.j2 +19 -0
  96. litestar_vite/templates/react-inertia/vite.config.ts.j2 +59 -0
  97. litestar_vite/templates/react-router/index.html.j2 +12 -0
  98. litestar_vite/templates/react-router/src/App.css.j2 +17 -0
  99. litestar_vite/templates/react-router/src/App.tsx.j2 +7 -0
  100. litestar_vite/templates/react-router/src/main.tsx.j2 +10 -0
  101. litestar_vite/templates/react-router/vite.config.ts.j2 +39 -0
  102. litestar_vite/templates/react-tanstack/index.html.j2 +12 -0
  103. litestar_vite/templates/react-tanstack/openapi-ts.config.ts.j2 +18 -0
  104. litestar_vite/templates/react-tanstack/src/App.css.j2 +17 -0
  105. litestar_vite/templates/react-tanstack/src/main.tsx.j2 +21 -0
  106. litestar_vite/templates/react-tanstack/src/routeTree.gen.ts.j2 +7 -0
  107. litestar_vite/templates/react-tanstack/src/routes/__root.tsx.j2 +9 -0
  108. litestar_vite/templates/react-tanstack/src/routes/books.tsx.j2 +9 -0
  109. litestar_vite/templates/react-tanstack/src/routes/index.tsx.j2 +9 -0
  110. litestar_vite/templates/react-tanstack/vite.config.ts.j2 +39 -0
  111. litestar_vite/templates/svelte/index.html.j2 +13 -0
  112. litestar_vite/templates/svelte/src/App.svelte.j2 +30 -0
  113. litestar_vite/templates/svelte/src/app.css.j2 +45 -0
  114. litestar_vite/templates/svelte/src/main.ts.j2 +8 -0
  115. litestar_vite/templates/svelte/src/vite-env.d.ts.j2 +2 -0
  116. litestar_vite/templates/svelte/svelte.config.js.j2 +5 -0
  117. litestar_vite/templates/svelte/vite.config.ts.j2 +39 -0
  118. litestar_vite/templates/svelte-inertia/index.html.j2 +14 -0
  119. litestar_vite/templates/svelte-inertia/resources/app.css.j2 +21 -0
  120. litestar_vite/templates/svelte-inertia/resources/main.ts.j2 +11 -0
  121. litestar_vite/templates/svelte-inertia/resources/pages/Home.svelte.j2 +43 -0
  122. litestar_vite/templates/svelte-inertia/resources/vite-env.d.ts.j2 +2 -0
  123. litestar_vite/templates/svelte-inertia/svelte.config.js.j2 +5 -0
  124. litestar_vite/templates/svelte-inertia/vite.config.ts.j2 +37 -0
  125. litestar_vite/templates/sveltekit/openapi-ts.config.ts.j2 +15 -0
  126. litestar_vite/templates/sveltekit/src/app.css.j2 +40 -0
  127. litestar_vite/templates/sveltekit/src/app.html.j2 +12 -0
  128. litestar_vite/templates/sveltekit/src/hooks.server.ts.j2 +55 -0
  129. litestar_vite/templates/sveltekit/src/routes/+layout.svelte.j2 +12 -0
  130. litestar_vite/templates/sveltekit/src/routes/+page.svelte.j2 +34 -0
  131. litestar_vite/templates/sveltekit/svelte.config.js.j2 +12 -0
  132. litestar_vite/templates/sveltekit/tsconfig.json.j2 +14 -0
  133. litestar_vite/templates/sveltekit/vite.config.ts.j2 +31 -0
  134. litestar_vite/templates/vue/env.d.ts.j2 +7 -0
  135. litestar_vite/templates/vue/index.html.j2 +13 -0
  136. litestar_vite/templates/vue/src/App.vue.j2 +28 -0
  137. litestar_vite/templates/vue/src/main.ts.j2 +5 -0
  138. litestar_vite/templates/vue/src/style.css.j2 +45 -0
  139. litestar_vite/templates/vue/vite.config.ts.j2 +39 -0
  140. litestar_vite/templates/vue-inertia/env.d.ts.j2 +7 -0
  141. litestar_vite/templates/vue-inertia/index.html.j2 +14 -0
  142. litestar_vite/templates/vue-inertia/package.json.j2 +49 -0
  143. litestar_vite/templates/vue-inertia/resources/main.ts.j2 +18 -0
  144. litestar_vite/templates/vue-inertia/resources/pages/Home.vue.j2 +22 -0
  145. litestar_vite/templates/vue-inertia/resources/ssr.ts.j2 +21 -0
  146. litestar_vite/templates/vue-inertia/resources/style.css.j2 +21 -0
  147. litestar_vite/templates/vue-inertia/vite.config.ts.j2 +59 -0
  148. litestar_vite-0.15.0rc2.dist-info/METADATA +230 -0
  149. litestar_vite-0.15.0rc2.dist-info/RECORD +151 -0
  150. {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0rc2.dist-info}/WHEEL +1 -1
  151. litestar_vite/template_engine.py +0 -103
  152. litestar_vite-0.1.1.dist-info/METADATA +0 -68
  153. litestar_vite-0.1.1.dist-info/RECORD +0 -11
  154. {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0rc2.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,31 @@
1
+ {% if use_tailwind %}
2
+ import tailwindcss from "@tailwindcss/vite";
3
+ {% endif %}
4
+
5
+ // Litestar manages the dev server port via VITE_PORT and runtime config.
6
+ // The Nuxt module reads the port automatically - no hardcoding needed.
7
+ // LITESTAR_PORT is the backend API server port (default {{ litestar_port }}).
8
+ const LITESTAR_PORT = process.env.LITESTAR_PORT ?? "{{ litestar_port }}";
9
+
10
+ export default defineNuxtConfig({
11
+ compatibilityDate: "2024-11-01",
12
+ devtools: { enabled: true },
13
+ modules: ["litestar-vite-plugin/nuxt"],
14
+ {% if use_tailwind %}
15
+ css: ["~/assets/css/tailwind.css"],
16
+ vite: {
17
+ plugins: [tailwindcss()],
18
+ },
19
+ {% endif %}
20
+ litestar: {
21
+ // API proxy points to the Litestar backend (apiPrefix defaults to "/api")
22
+ apiProxy: `http://127.0.0.1:${LITESTAR_PORT}`,
23
+ {% if enable_types %}
24
+ // Type generation config (defaults are "types/api", "openapi.json", "routes.json")
25
+ types: {
26
+ enabled: true,
27
+ output: "types/api",
28
+ },
29
+ {% endif %}
30
+ },
31
+ });
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from "@hey-api/openapi-ts";
2
+
3
+ export default defineConfig({
4
+ input: "./generated/openapi.json",
5
+ output: "./generated/api",
6
+ plugins: [
7
+ "@hey-api/typescript",
8
+ "@hey-api/schemas",
9
+ "@hey-api/sdk",
10
+ "@hey-api/client-nuxt",
11
+ {%- if generate_zod %}
12
+ "zod",
13
+ {%- endif %}
14
+ ],
15
+ });
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ const count = ref(0);
3
+
4
+ function increment() {
5
+ count.value += 1;
6
+ }
7
+ </script>
8
+
9
+ <template>
10
+ <div class="app">
11
+ <h1>{{ "{{ project_name }}" }}</h1>
12
+ <p>Nuxt 3 + Litestar</p>
13
+ <div class="card">
14
+ <button @click="increment">
15
+ count is {{ "{{ count }}" }}
16
+ </button>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <style scoped>
22
+ .app {
23
+ max-width: 1280px;
24
+ margin: 0 auto;
25
+ padding: 2rem;
26
+ text-align: center;
27
+ }
28
+
29
+ .card {
30
+ padding: 2em;
31
+ }
32
+
33
+ button {
34
+ border-radius: 8px;
35
+ border: 1px solid transparent;
36
+ padding: 0.6em 1.2em;
37
+ font-size: 1em;
38
+ font-weight: 500;
39
+ font-family: inherit;
40
+ background-color: #1a1a1a;
41
+ cursor: pointer;
42
+ transition: border-color 0.25s;
43
+ }
44
+
45
+ button:hover {
46
+ border-color: #00dc82;
47
+ }
48
+
49
+ @media (prefers-color-scheme: light) {
50
+ button {
51
+ background-color: #f9f9f9;
52
+ }
53
+ }
54
+ </style>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>{{ project_name }}</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/{{ resource_dir }}/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,56 @@
1
+ :root {
2
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+
6
+ color-scheme: light dark;
7
+ color: rgba(255, 255, 255, 0.87);
8
+ background-color: #242424;
9
+
10
+ font-synthesis: none;
11
+ text-rendering: optimizeLegibility;
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ }
15
+
16
+ .app {
17
+ max-width: 1280px;
18
+ margin: 0 auto;
19
+ padding: 2rem;
20
+ text-align: center;
21
+ }
22
+
23
+ .card {
24
+ padding: 2em;
25
+ }
26
+
27
+ button {
28
+ border-radius: 8px;
29
+ border: 1px solid transparent;
30
+ padding: 0.6em 1.2em;
31
+ font-size: 1em;
32
+ font-weight: 500;
33
+ font-family: inherit;
34
+ background-color: #1a1a1a;
35
+ cursor: pointer;
36
+ transition: border-color 0.25s;
37
+ }
38
+
39
+ button:hover {
40
+ border-color: #646cff;
41
+ }
42
+
43
+ button:focus,
44
+ button:focus-visible {
45
+ outline: 4px auto -webkit-focus-ring-color;
46
+ }
47
+
48
+ @media (prefers-color-scheme: light) {
49
+ :root {
50
+ color: #213547;
51
+ background-color: #ffffff;
52
+ }
53
+ button {
54
+ background-color: #f9f9f9;
55
+ }
56
+ }
@@ -0,0 +1,19 @@
1
+ import { useState } from "react";
2
+
3
+ function App() {
4
+ const [count, setCount] = useState(0);
5
+
6
+ return (
7
+ <div className="app">
8
+ <h1>{{ project_name }}</h1>
9
+ <p>React + Litestar + Vite</p>
10
+ <div className="card">
11
+ <button onClick={() => setCount((count) => count + 1)}>
12
+ count is {count}
13
+ </button>
14
+ </div>
15
+ </div>
16
+ );
17
+ }
18
+
19
+ export default App;
@@ -0,0 +1,10 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App";
4
+ import "./App.css";
5
+
6
+ createRoot(document.getElementById("root")!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>
10
+ );
@@ -0,0 +1,39 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import litestar from "litestar-vite-plugin";
4
+ {% if use_tailwind %}
5
+ import tailwindcss from "@tailwindcss/vite";
6
+ {% endif %}
7
+
8
+ export default defineConfig({
9
+ server: {
10
+ host: "0.0.0.0",
11
+ port: Number(process.env.VITE_PORT || "{{ vite_port }}"),
12
+ cors: true,
13
+ hmr: {
14
+ host: "localhost",
15
+ },
16
+ },
17
+ plugins: [
18
+ {% if use_tailwind %}
19
+ tailwindcss(),
20
+ {% endif %}
21
+ react(),
22
+ litestar({
23
+ input: ["{{ resource_dir }}/main.tsx"],
24
+ {% if enable_types %}
25
+ types: {
26
+ enabled: true,
27
+ output: "{{ resource_dir }}/generated/types",
28
+ generateZod: true,
29
+ generateSdk: true,
30
+ },
31
+ {% endif %}
32
+ }),
33
+ ],
34
+ resolve: {
35
+ alias: {
36
+ "@": "/{{ resource_dir }}",
37
+ },
38
+ },
39
+ });
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/static/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title inertia>{{ project_name }}</title>
8
+ {{ "{{ vite_hmr() }}" }}
9
+ {{ "{{ vite('{{ resource_dir }}/main.tsx') }}" }}
10
+ </head>
11
+ <body>
12
+ <div id="app" data-page='{{ "{{ inertia | safe }}" }}'></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "{{ project_name }}",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ {% if enable_ssr %}
8
+ "build": "vite build{% if use_typescript %} && tsc -b --noEmit{% endif %} && vite build --ssr {{ resource_dir }}/ssr.tsx",
9
+ {% else %}
10
+ "build": "vite build{% if use_typescript %} && tsc -b --noEmit{% endif %}",
11
+ {% endif %}
12
+ "preview": "vite preview",
13
+ {% if enable_ssr %}
14
+ "serve": "NODE_ENV=production node {{ resource_dir }}/bootstrap/ssr/ssr.js",
15
+ {% else %}
16
+ "serve": "vite preview",
17
+ {% endif %}
18
+ "watch": "npm run serve"{% if generate_client %},
19
+ "generate-types": "openapi-ts"{% endif %}
20
+ },
21
+ "dependencies": {
22
+ {%- for dep in dependencies %}
23
+ "{{ dep }}": "latest"{% if not loop.last or generate_zod or generate_client %},{% endif %}
24
+ {%- endfor %}
25
+ {%- if generate_client %}
26
+ "axios": "^1.13.2"{% if generate_zod %},{% endif %}
27
+ {%- endif %}
28
+ {%- if generate_zod %}
29
+ "zod": "^4.1.13"
30
+ {%- endif %}
31
+ },
32
+ "devDependencies": {
33
+ {%- for dep in dev_dependencies %}
34
+ "{{ dep }}": "latest",
35
+ {%- endfor %}
36
+ {%- if use_tailwind %}
37
+ "@tailwindcss/vite": "^4.1.17",
38
+ "tailwindcss": "^4.1.17",
39
+ {%- endif %}
40
+ {%- if generate_client %}
41
+ "@hey-api/openapi-ts": "^0.88.0",
42
+ {%- endif %}
43
+ "litestar-vite-plugin": "latest",
44
+ "vite": "^7.2.6"
45
+ }
46
+ }
@@ -0,0 +1,68 @@
1
+ :root {
2
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+
6
+ color-scheme: light dark;
7
+ color: rgba(255, 255, 255, 0.87);
8
+ background-color: #242424;
9
+
10
+ font-synthesis: none;
11
+ text-rendering: optimizeLegibility;
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ }
15
+
16
+ .app {
17
+ max-width: 1280px;
18
+ margin: 0 auto;
19
+ padding: 2rem;
20
+ text-align: center;
21
+ }
22
+
23
+ .message {
24
+ color: #646cff;
25
+ font-weight: 500;
26
+ }
27
+
28
+ .back-link {
29
+ color: #646cff;
30
+ text-decoration: none;
31
+ }
32
+
33
+ .back-link:hover {
34
+ text-decoration: underline;
35
+ }
36
+
37
+ .user-list {
38
+ list-style: none;
39
+ padding: 0;
40
+ margin-top: 2rem;
41
+ }
42
+
43
+ .user-item {
44
+ padding: 1rem;
45
+ margin: 0.5rem 0;
46
+ background: #1a1a1a;
47
+ border-radius: 8px;
48
+ display: flex;
49
+ justify-content: space-between;
50
+ }
51
+
52
+ .user-item strong {
53
+ color: #fff;
54
+ }
55
+
56
+ .user-item span {
57
+ color: #888;
58
+ }
59
+
60
+ @media (prefers-color-scheme: light) {
61
+ :root {
62
+ color: #213547;
63
+ background-color: #ffffff;
64
+ }
65
+ .user-item {
66
+ background-color: #f9f9f9;
67
+ }
68
+ }
@@ -0,0 +1,17 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { createInertiaApp } from "@inertiajs/react";
4
+ import { resolvePageComponent } from "litestar-vite-plugin/inertia-helpers";
5
+ import "./App.css";
6
+
7
+ createInertiaApp({
8
+ resolve: (name) =>
9
+ resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob("./pages/**/*.tsx")),
10
+ setup({ el, App, props }) {
11
+ createRoot(el).render(
12
+ <StrictMode>
13
+ <App {...props} />
14
+ </StrictMode>
15
+ );
16
+ },
17
+ });
@@ -0,0 +1,18 @@
1
+ import { Head } from "@inertiajs/react";
2
+
3
+ interface Props {
4
+ message?: string;
5
+ }
6
+
7
+ export default function Home({ message }: Props) {
8
+ return (
9
+ <>
10
+ <Head title="Home" />
11
+ <div className="app">
12
+ <h1>{{ project_name }}</h1>
13
+ <p>React + Inertia.js + Litestar</p>
14
+ {message && <p className="message">{message}</p>}
15
+ </div>
16
+ </>
17
+ );
18
+ }
@@ -0,0 +1,19 @@
1
+ import createServer from "@inertiajs/react/server";
2
+ import { createInertiaApp } from "@inertiajs/react";
3
+ import { renderToString } from "react-dom/server";
4
+
5
+ import { resolvePageComponent } from "litestar-vite-plugin/inertia-helpers";
6
+
7
+ createServer(
8
+ async (page) => {
9
+ const inertia = await createInertiaApp({
10
+ page,
11
+ render: renderToString,
12
+ resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob("./pages/**/*.tsx")),
13
+ setup: ({ App, props }) => <App {...props} />,
14
+ });
15
+
16
+ return inertia;
17
+ },
18
+ Number.parseInt(process.env.INERTIA_SSR_PORT || "13714"),
19
+ );
@@ -0,0 +1,59 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import litestar from "litestar-vite-plugin";
4
+ {% if use_tailwind %}
5
+ import tailwindcss from "@tailwindcss/vite";
6
+ {% endif %}
7
+
8
+ {% if enable_ssr %}
9
+ export default defineConfig(({ ssrBuild }) => ({
10
+ {% else %}
11
+ export default defineConfig({
12
+ {% endif %}
13
+ server: {
14
+ host: "0.0.0.0",
15
+ port: Number(process.env.VITE_PORT || "{{ vite_port }}"),
16
+ cors: true,
17
+ hmr: {
18
+ host: "localhost",
19
+ },
20
+ },
21
+ plugins: [
22
+ {% if use_tailwind %}
23
+ tailwindcss(),
24
+ {% endif %}
25
+ react(),
26
+ litestar({
27
+ input: ["{{ resource_dir }}/main.tsx"],
28
+ {% if enable_ssr %}
29
+ ssr: "{{ resource_dir }}/ssr.tsx",
30
+ {% endif %}
31
+ {% if enable_types %}
32
+ types: {
33
+ enabled: true,
34
+ output: "{{ resource_dir }}/generated/api",
35
+ },
36
+ {% endif %}
37
+ }),
38
+ ],
39
+ {% if enable_ssr %}
40
+ build: {
41
+ rollupOptions: {
42
+ output: ssrBuild
43
+ ? {
44
+ entryFileNames: "ssr.js",
45
+ }
46
+ : undefined,
47
+ },
48
+ },
49
+ {% endif %}
50
+ resolve: {
51
+ alias: {
52
+ "@": "/{{ resource_dir }}",
53
+ },
54
+ },
55
+ {% if enable_ssr %}
56
+ }));
57
+ {% else %}
58
+ });
59
+ {% endif %}
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{ project_name }}</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/{{ resource_dir }}/main.tsx"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,17 @@
1
+ :root {
2
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+ font-synthesis: none;
6
+ text-rendering: optimizeLegibility;
7
+ -webkit-font-smoothing: antialiased;
8
+ -moz-osx-font-smoothing: grayscale;
9
+ }
10
+
11
+ * {
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ body {
16
+ margin: 0;
17
+ }
@@ -0,0 +1,7 @@
1
+ import { BrowserRouter } from "react-router-dom";
2
+
3
+ function App() {
4
+ return <BrowserRouter />;
5
+ }
6
+
7
+ export default App;
@@ -0,0 +1,10 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App";
4
+ import "./App.css";
5
+
6
+ createRoot(document.getElementById("app")!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>
10
+ );
@@ -0,0 +1,39 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import litestar from "litestar-vite-plugin";
4
+ {% if use_tailwind %}
5
+ import tailwindcss from "@tailwindcss/vite";
6
+ {% endif %}
7
+
8
+ export default defineConfig({
9
+ server: {
10
+ host: "0.0.0.0",
11
+ port: Number(process.env.VITE_PORT || "{{ vite_port }}"),
12
+ cors: true,
13
+ hmr: {
14
+ host: "localhost",
15
+ },
16
+ },
17
+ plugins: [
18
+ {% if use_tailwind %}
19
+ tailwindcss(),
20
+ {% endif %}
21
+ react(),
22
+ litestar({
23
+ input: ["{{ resource_dir }}/main.tsx"],
24
+ {% if enable_types %}
25
+ types: {
26
+ enabled: true,
27
+ output: "{{ resource_dir }}/generated/types",
28
+ generateZod: true,
29
+ generateSdk: true,
30
+ },
31
+ {% endif %}
32
+ }),
33
+ ],
34
+ resolve: {
35
+ alias: {
36
+ "@": "/{{ resource_dir }}",
37
+ },
38
+ },
39
+ });
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{ project_name }}</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/{{ resource_dir }}/main.tsx"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from "@hey-api/openapi-ts";
2
+
3
+ export default defineConfig({
4
+ client: "@hey-api/client-fetch",
5
+ input: "./{{ resource_dir }}/generated/openapi.json",
6
+ output: {
7
+ path: "./{{ resource_dir }}/generated/api",
8
+ format: "prettier",
9
+ },
10
+ plugins: [
11
+ "@hey-api/schemas",
12
+ "@hey-api/sdk",
13
+ {
14
+ name: "@hey-api/typescript",
15
+ enums: "javascript",
16
+ },
17
+ ],
18
+ });
@@ -0,0 +1,17 @@
1
+ :root {
2
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+ font-synthesis: none;
6
+ text-rendering: optimizeLegibility;
7
+ -webkit-font-smoothing: antialiased;
8
+ -moz-osx-font-smoothing: grayscale;
9
+ }
10
+
11
+ * {
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ body {
16
+ margin: 0;
17
+ }
@@ -0,0 +1,21 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { RouterProvider, createRouter } from "@tanstack/react-router";
4
+ import { routeTree } from "./routeTree.gen";
5
+ import "./App.css";
6
+
7
+ // Create a new router instance
8
+ const router = createRouter({ routeTree });
9
+
10
+ // Register the router instance for type safety
11
+ declare module "@tanstack/react-router" {
12
+ interface Register {
13
+ router: typeof router;
14
+ }
15
+ }
16
+
17
+ createRoot(document.getElementById("app")!).render(
18
+ <StrictMode>
19
+ <RouterProvider router={router} />
20
+ </StrictMode>
21
+ );
@@ -0,0 +1,7 @@
1
+ // This file is auto-generated by TanStack Router plugin
2
+ // Run `npm run dev` to regenerate this file
3
+
4
+ import { createRootRoute, createRoute } from "@tanstack/react-router";
5
+
6
+ // Placeholder route tree - will be regenerated by @tanstack/router-plugin
7
+ export const routeTree = createRootRoute();
@@ -0,0 +1,9 @@
1
+ import { createRootRoute, Outlet } from "@tanstack/react-router";
2
+
3
+ export const Route = createRootRoute({
4
+ component: () => (
5
+ <main>
6
+ <Outlet />
7
+ </main>
8
+ ),
9
+ });