litestar-vite 0.1.1__py3-none-any.whl → 0.15.0__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 (169) hide show
  1. litestar_vite/__init__.py +54 -4
  2. litestar_vite/__metadata__.py +12 -7
  3. litestar_vite/cli.py +1048 -10
  4. litestar_vite/codegen/__init__.py +48 -0
  5. litestar_vite/codegen/_export.py +229 -0
  6. litestar_vite/codegen/_inertia.py +619 -0
  7. litestar_vite/codegen/_openapi.py +280 -0
  8. litestar_vite/codegen/_routes.py +720 -0
  9. litestar_vite/codegen/_ts.py +235 -0
  10. litestar_vite/codegen/_utils.py +141 -0
  11. litestar_vite/commands.py +73 -0
  12. litestar_vite/config/__init__.py +997 -0
  13. litestar_vite/config/_constants.py +97 -0
  14. litestar_vite/config/_deploy.py +70 -0
  15. litestar_vite/config/_inertia.py +241 -0
  16. litestar_vite/config/_paths.py +63 -0
  17. litestar_vite/config/_runtime.py +235 -0
  18. litestar_vite/config/_spa.py +93 -0
  19. litestar_vite/config/_types.py +94 -0
  20. litestar_vite/deploy.py +366 -0
  21. litestar_vite/doctor.py +1181 -0
  22. litestar_vite/exceptions.py +78 -0
  23. litestar_vite/executor.py +360 -0
  24. litestar_vite/handler/__init__.py +9 -0
  25. litestar_vite/handler/_app.py +612 -0
  26. litestar_vite/handler/_routing.py +130 -0
  27. litestar_vite/html_transform.py +569 -0
  28. litestar_vite/inertia/__init__.py +77 -0
  29. litestar_vite/inertia/_utils.py +119 -0
  30. litestar_vite/inertia/exception_handler.py +178 -0
  31. litestar_vite/inertia/helpers.py +1571 -0
  32. litestar_vite/inertia/middleware.py +54 -0
  33. litestar_vite/inertia/plugin.py +199 -0
  34. litestar_vite/inertia/precognition.py +274 -0
  35. litestar_vite/inertia/request.py +334 -0
  36. litestar_vite/inertia/response.py +802 -0
  37. litestar_vite/inertia/types.py +335 -0
  38. litestar_vite/loader.py +464 -123
  39. litestar_vite/plugin/__init__.py +687 -0
  40. litestar_vite/plugin/_process.py +185 -0
  41. litestar_vite/plugin/_proxy.py +689 -0
  42. litestar_vite/plugin/_proxy_headers.py +244 -0
  43. litestar_vite/plugin/_static.py +37 -0
  44. litestar_vite/plugin/_utils.py +489 -0
  45. litestar_vite/py.typed +0 -0
  46. litestar_vite/scaffolding/__init__.py +20 -0
  47. litestar_vite/scaffolding/generator.py +270 -0
  48. litestar_vite/scaffolding/templates.py +437 -0
  49. litestar_vite/templates/__init__.py +0 -0
  50. litestar_vite/templates/addons/tailwindcss/tailwind.css.j2 +1 -0
  51. litestar_vite/templates/angular/index.html.j2 +12 -0
  52. litestar_vite/templates/angular/openapi-ts.config.ts.j2 +18 -0
  53. litestar_vite/templates/angular/package.json.j2 +36 -0
  54. litestar_vite/templates/angular/src/app/app.component.css.j2 +3 -0
  55. litestar_vite/templates/angular/src/app/app.component.html.j2 +1 -0
  56. litestar_vite/templates/angular/src/app/app.component.ts.j2 +9 -0
  57. litestar_vite/templates/angular/src/app/app.config.ts.j2 +5 -0
  58. litestar_vite/templates/angular/src/main.ts.j2 +9 -0
  59. litestar_vite/templates/angular/src/styles.css.j2 +9 -0
  60. litestar_vite/templates/angular/tsconfig.app.json.j2 +34 -0
  61. litestar_vite/templates/angular/tsconfig.json.j2 +20 -0
  62. litestar_vite/templates/angular/vite.config.ts.j2 +21 -0
  63. litestar_vite/templates/angular-cli/.postcssrc.json.j2 +5 -0
  64. litestar_vite/templates/angular-cli/angular.json.j2 +36 -0
  65. litestar_vite/templates/angular-cli/openapi-ts.config.ts.j2 +18 -0
  66. litestar_vite/templates/angular-cli/package.json.j2 +28 -0
  67. litestar_vite/templates/angular-cli/proxy.conf.json.j2 +18 -0
  68. litestar_vite/templates/angular-cli/src/app/app.component.css.j2 +3 -0
  69. litestar_vite/templates/angular-cli/src/app/app.component.html.j2 +1 -0
  70. litestar_vite/templates/angular-cli/src/app/app.component.ts.j2 +9 -0
  71. litestar_vite/templates/angular-cli/src/app/app.config.ts.j2 +5 -0
  72. litestar_vite/templates/angular-cli/src/index.html.j2 +13 -0
  73. litestar_vite/templates/angular-cli/src/main.ts.j2 +6 -0
  74. litestar_vite/templates/angular-cli/src/styles.css.j2 +10 -0
  75. litestar_vite/templates/angular-cli/tailwind.config.js.j2 +4 -0
  76. litestar_vite/templates/angular-cli/tsconfig.app.json.j2 +16 -0
  77. litestar_vite/templates/angular-cli/tsconfig.json.j2 +26 -0
  78. litestar_vite/templates/angular-cli/tsconfig.spec.json.j2 +9 -0
  79. litestar_vite/templates/astro/astro.config.mjs.j2 +28 -0
  80. litestar_vite/templates/astro/openapi-ts.config.ts.j2 +15 -0
  81. litestar_vite/templates/astro/src/layouts/Layout.astro.j2 +63 -0
  82. litestar_vite/templates/astro/src/pages/index.astro.j2 +36 -0
  83. litestar_vite/templates/astro/src/styles/global.css.j2 +1 -0
  84. litestar_vite/templates/base/.gitignore.j2 +42 -0
  85. litestar_vite/templates/base/openapi-ts.config.ts.j2 +15 -0
  86. litestar_vite/templates/base/package.json.j2 +39 -0
  87. litestar_vite/templates/base/resources/vite-env.d.ts.j2 +1 -0
  88. litestar_vite/templates/base/tsconfig.json.j2 +37 -0
  89. litestar_vite/templates/htmx/src/main.js.j2 +8 -0
  90. litestar_vite/templates/htmx/templates/base.html.j2.j2 +56 -0
  91. litestar_vite/templates/htmx/templates/index.html.j2.j2 +13 -0
  92. litestar_vite/templates/htmx/vite.config.ts.j2 +40 -0
  93. litestar_vite/templates/nuxt/app.vue.j2 +29 -0
  94. litestar_vite/templates/nuxt/composables/useApi.ts.j2 +33 -0
  95. litestar_vite/templates/nuxt/nuxt.config.ts.j2 +31 -0
  96. litestar_vite/templates/nuxt/openapi-ts.config.ts.j2 +15 -0
  97. litestar_vite/templates/nuxt/pages/index.vue.j2 +54 -0
  98. litestar_vite/templates/react/index.html.j2 +13 -0
  99. litestar_vite/templates/react/src/App.css.j2 +56 -0
  100. litestar_vite/templates/react/src/App.tsx.j2 +19 -0
  101. litestar_vite/templates/react/src/main.tsx.j2 +10 -0
  102. litestar_vite/templates/react/vite.config.ts.j2 +39 -0
  103. litestar_vite/templates/react-inertia/index.html.j2 +14 -0
  104. litestar_vite/templates/react-inertia/package.json.j2 +47 -0
  105. litestar_vite/templates/react-inertia/resources/App.css.j2 +68 -0
  106. litestar_vite/templates/react-inertia/resources/main.tsx.j2 +17 -0
  107. litestar_vite/templates/react-inertia/resources/pages/Home.tsx.j2 +18 -0
  108. litestar_vite/templates/react-inertia/resources/ssr.tsx.j2 +19 -0
  109. litestar_vite/templates/react-inertia/vite.config.ts.j2 +59 -0
  110. litestar_vite/templates/react-router/index.html.j2 +12 -0
  111. litestar_vite/templates/react-router/src/App.css.j2 +17 -0
  112. litestar_vite/templates/react-router/src/App.tsx.j2 +7 -0
  113. litestar_vite/templates/react-router/src/main.tsx.j2 +10 -0
  114. litestar_vite/templates/react-router/vite.config.ts.j2 +39 -0
  115. litestar_vite/templates/react-tanstack/index.html.j2 +12 -0
  116. litestar_vite/templates/react-tanstack/openapi-ts.config.ts.j2 +18 -0
  117. litestar_vite/templates/react-tanstack/src/App.css.j2 +17 -0
  118. litestar_vite/templates/react-tanstack/src/main.tsx.j2 +21 -0
  119. litestar_vite/templates/react-tanstack/src/routeTree.gen.ts.j2 +7 -0
  120. litestar_vite/templates/react-tanstack/src/routes/__root.tsx.j2 +9 -0
  121. litestar_vite/templates/react-tanstack/src/routes/books.tsx.j2 +9 -0
  122. litestar_vite/templates/react-tanstack/src/routes/index.tsx.j2 +9 -0
  123. litestar_vite/templates/react-tanstack/vite.config.ts.j2 +39 -0
  124. litestar_vite/templates/svelte/index.html.j2 +13 -0
  125. litestar_vite/templates/svelte/src/App.svelte.j2 +30 -0
  126. litestar_vite/templates/svelte/src/app.css.j2 +45 -0
  127. litestar_vite/templates/svelte/src/main.ts.j2 +8 -0
  128. litestar_vite/templates/svelte/src/vite-env.d.ts.j2 +2 -0
  129. litestar_vite/templates/svelte/svelte.config.js.j2 +5 -0
  130. litestar_vite/templates/svelte/vite.config.ts.j2 +39 -0
  131. litestar_vite/templates/svelte-inertia/index.html.j2 +14 -0
  132. litestar_vite/templates/svelte-inertia/resources/app.css.j2 +21 -0
  133. litestar_vite/templates/svelte-inertia/resources/main.ts.j2 +11 -0
  134. litestar_vite/templates/svelte-inertia/resources/pages/Home.svelte.j2 +43 -0
  135. litestar_vite/templates/svelte-inertia/resources/vite-env.d.ts.j2 +2 -0
  136. litestar_vite/templates/svelte-inertia/svelte.config.js.j2 +5 -0
  137. litestar_vite/templates/svelte-inertia/vite.config.ts.j2 +37 -0
  138. litestar_vite/templates/sveltekit/openapi-ts.config.ts.j2 +15 -0
  139. litestar_vite/templates/sveltekit/src/app.css.j2 +40 -0
  140. litestar_vite/templates/sveltekit/src/app.html.j2 +12 -0
  141. litestar_vite/templates/sveltekit/src/hooks.server.ts.j2 +55 -0
  142. litestar_vite/templates/sveltekit/src/routes/+layout.svelte.j2 +12 -0
  143. litestar_vite/templates/sveltekit/src/routes/+page.svelte.j2 +34 -0
  144. litestar_vite/templates/sveltekit/svelte.config.js.j2 +12 -0
  145. litestar_vite/templates/sveltekit/tsconfig.json.j2 +14 -0
  146. litestar_vite/templates/sveltekit/vite.config.ts.j2 +31 -0
  147. litestar_vite/templates/vue/env.d.ts.j2 +7 -0
  148. litestar_vite/templates/vue/index.html.j2 +13 -0
  149. litestar_vite/templates/vue/src/App.vue.j2 +28 -0
  150. litestar_vite/templates/vue/src/main.ts.j2 +5 -0
  151. litestar_vite/templates/vue/src/style.css.j2 +45 -0
  152. litestar_vite/templates/vue/vite.config.ts.j2 +39 -0
  153. litestar_vite/templates/vue-inertia/env.d.ts.j2 +7 -0
  154. litestar_vite/templates/vue-inertia/index.html.j2 +14 -0
  155. litestar_vite/templates/vue-inertia/package.json.j2 +50 -0
  156. litestar_vite/templates/vue-inertia/resources/main.ts.j2 +18 -0
  157. litestar_vite/templates/vue-inertia/resources/pages/Home.vue.j2 +22 -0
  158. litestar_vite/templates/vue-inertia/resources/ssr.ts.j2 +21 -0
  159. litestar_vite/templates/vue-inertia/resources/style.css.j2 +21 -0
  160. litestar_vite/templates/vue-inertia/vite.config.ts.j2 +59 -0
  161. litestar_vite-0.15.0.dist-info/METADATA +230 -0
  162. litestar_vite-0.15.0.dist-info/RECORD +164 -0
  163. {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0.dist-info}/WHEEL +1 -1
  164. litestar_vite/config.py +0 -100
  165. litestar_vite/plugin.py +0 -45
  166. litestar_vite/template_engine.py +0 -103
  167. litestar_vite-0.1.1.dist-info/METADATA +0 -68
  168. litestar_vite-0.1.1.dist-info/RECORD +0 -11
  169. {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%sveltekit.assets%/favicon.png" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ %sveltekit.head%
8
+ </head>
9
+ <body data-sveltekit-preload-data="hover">
10
+ <div style="display: contents">%sveltekit.body%</div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,55 @@
1
+ /**
2
+ * SvelteKit server hooks for API proxying.
3
+ *
4
+ * In production, the SvelteKit Node.js server runs separately from Litestar.
5
+ * This hook proxies /api/* requests to the Litestar backend so client-side
6
+ * fetches work correctly without requiring an external reverse proxy.
7
+ *
8
+ * Environment variables:
9
+ * LITESTAR_API - Base URL of the Litestar API server (default: http://localhost:{{ litestar_port }})
10
+ */
11
+ import type { Handle } from "@sveltejs/kit"
12
+
13
+ const LITESTAR_API = process.env.LITESTAR_API || "http://localhost:{{ litestar_port }}"
14
+
15
+ export const handle: Handle = async ({ event, resolve }) => {
16
+ // Proxy /api/* requests to the Litestar backend
17
+ if (event.url.pathname.startsWith("/api")) {
18
+ const apiUrl = `${LITESTAR_API}${event.url.pathname}${event.url.search}`
19
+
20
+ try {
21
+ // Forward the request to Litestar
22
+ const response = await fetch(apiUrl, {
23
+ method: event.request.method,
24
+ headers: new Headers({
25
+ // Forward relevant headers
26
+ "content-type": event.request.headers.get("content-type") || "application/json",
27
+ accept: event.request.headers.get("accept") || "application/json",
28
+ // Forward auth headers if present
29
+ ...(event.request.headers.get("authorization")
30
+ ? { authorization: event.request.headers.get("authorization")! }
31
+ : {}),
32
+ ...(event.request.headers.get("cookie") ? { cookie: event.request.headers.get("cookie")! } : {}),
33
+ }),
34
+ body: event.request.method !== "GET" && event.request.method !== "HEAD" ? event.request.body : undefined,
35
+ // @ts-expect-error - duplex is required for streaming request bodies
36
+ duplex: "half",
37
+ })
38
+
39
+ // Return the proxied response
40
+ return new Response(response.body, {
41
+ status: response.status,
42
+ statusText: response.statusText,
43
+ headers: response.headers,
44
+ })
45
+ } catch (error) {
46
+ console.error(`[hooks.server] Failed to proxy ${event.url.pathname} to ${apiUrl}:`, error)
47
+ return new Response(JSON.stringify({ error: "API proxy failed", detail: String(error) }), {
48
+ status: 502,
49
+ headers: { "content-type": "application/json" },
50
+ })
51
+ }
52
+ }
53
+
54
+ return resolve(event)
55
+ }
@@ -0,0 +1,12 @@
1
+ <script lang="ts">
2
+ import "../app.css";
3
+ import type { Snippet } from "svelte";
4
+
5
+ interface Props {
6
+ children: Snippet;
7
+ }
8
+
9
+ let { children }: Props = $props();
10
+ </script>
11
+
12
+ {@render children()}
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ let count = $state(0);
3
+
4
+ function increment() {
5
+ count += 1;
6
+ }
7
+ </script>
8
+
9
+ <svelte:head>
10
+ <title>{{ project_name }}</title>
11
+ </svelte:head>
12
+
13
+ <main class="app">
14
+ <h1>{{ project_name }}</h1>
15
+ <p>SvelteKit + Litestar</p>
16
+ <div class="card">
17
+ <button onclick={increment}>
18
+ count is {count}
19
+ </button>
20
+ </div>
21
+ </main>
22
+
23
+ <style>
24
+ .app {
25
+ max-width: 1280px;
26
+ margin: 0 auto;
27
+ padding: 2rem;
28
+ text-align: center;
29
+ }
30
+
31
+ .card {
32
+ padding: 2em;
33
+ }
34
+ </style>
@@ -0,0 +1,12 @@
1
+ import adapter from "@sveltejs/adapter-auto";
2
+ import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
3
+
4
+ /** @type {import('@sveltejs/kit').Config} */
5
+ const config = {
6
+ preprocess: vitePreprocess(),
7
+ kit: {
8
+ adapter: adapter(),
9
+ },
10
+ };
11
+
12
+ export default config;
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./.svelte-kit/tsconfig.json",
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noUnusedLocals": true,
9
+ "noUnusedParameters": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "noUncheckedSideEffectImports": true,
12
+ "resolveJsonModule": true
13
+ }
14
+ }
@@ -0,0 +1,31 @@
1
+ import { sveltekit } from "@sveltejs/kit/vite";
2
+ import { litestarSvelteKit } from "litestar-vite-plugin/sveltekit";
3
+ import { defineConfig } from "vite";
4
+ {% if use_tailwind %}
5
+ import tailwindcss from "@tailwindcss/vite";
6
+ {% endif %}
7
+
8
+ // Litestar manages the dev server port via VITE_PORT and runtime config.
9
+ // The SvelteKit plugin reads the port automatically - no hardcoding needed.
10
+ // LITESTAR_PORT is the backend API server port (default {{ litestar_port }}).
11
+ const LITESTAR_PORT = process.env.LITESTAR_PORT ?? "{{ litestar_port }}";
12
+
13
+ export default defineConfig({
14
+ plugins: [
15
+ {% if use_tailwind %}
16
+ tailwindcss(),
17
+ {% endif %}
18
+ litestarSvelteKit({
19
+ // API proxy points to the Litestar backend
20
+ apiProxy: `http://localhost:${LITESTAR_PORT}`,
21
+ apiPrefix: "/api",
22
+ {% if enable_types %}
23
+ types: {
24
+ enabled: true,
25
+ output: "src/lib/generated/api",
26
+ },
27
+ {% endif %}
28
+ }),
29
+ sveltekit(),
30
+ ],
31
+ });
@@ -0,0 +1,7 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "*.vue" {
4
+ import type { DefineComponent } from "vue";
5
+ const component: DefineComponent<{}, {}, any>;
6
+ export default component;
7
+ }
@@ -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="app"></div>
11
+ <script type="module" src="/{{ resource_dir }}/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,28 @@
1
+ <script setup lang="ts">
2
+ import { ref } from "vue";
3
+
4
+ const count = ref(0);
5
+ </script>
6
+
7
+ <template>
8
+ <div class="app">
9
+ <h1>{{ "{{ project_name }}" }}</h1>
10
+ <p>Vue 3 + Litestar + Vite</p>
11
+ <div class="card">
12
+ <button type="button" @click="count++">count is {{ "{{ count }}" }}</button>
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <style scoped>
18
+ .app {
19
+ max-width: 1280px;
20
+ margin: 0 auto;
21
+ padding: 2rem;
22
+ text-align: center;
23
+ }
24
+
25
+ .card {
26
+ padding: 2em;
27
+ }
28
+ </style>
@@ -0,0 +1,5 @@
1
+ import { createApp } from "vue";
2
+ import App from "./App.vue";
3
+ import "./style.css";
4
+
5
+ createApp(App).mount("#app");
@@ -0,0 +1,45 @@
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
+ button {
17
+ border-radius: 8px;
18
+ border: 1px solid transparent;
19
+ padding: 0.6em 1.2em;
20
+ font-size: 1em;
21
+ font-weight: 500;
22
+ font-family: inherit;
23
+ background-color: #1a1a1a;
24
+ cursor: pointer;
25
+ transition: border-color 0.25s;
26
+ }
27
+
28
+ button:hover {
29
+ border-color: #646cff;
30
+ }
31
+
32
+ button:focus,
33
+ button:focus-visible {
34
+ outline: 4px auto -webkit-focus-ring-color;
35
+ }
36
+
37
+ @media (prefers-color-scheme: light) {
38
+ :root {
39
+ color: #213547;
40
+ background-color: #ffffff;
41
+ }
42
+ button {
43
+ background-color: #f9f9f9;
44
+ }
45
+ }
@@ -0,0 +1,39 @@
1
+ import { defineConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
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
+ vue(),
22
+ litestar({
23
+ input: ["{{ resource_dir }}/main.ts"],
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,7 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "*.vue" {
4
+ import type { DefineComponent } from "vue";
5
+ const component: DefineComponent<{}, {}, any>;
6
+ export default component;
7
+ }
@@ -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.ts') }}" }}
10
+ </head>
11
+ <body>
12
+ <div id="app" data-page='{{ "{{ inertia | safe }}" }}'></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,50 @@
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 %} && vue-tsc -b --noEmit{% endif %} && vite build --ssr {{ resource_dir }}/ssr.ts",
9
+ {% else %}
10
+ "build": "vite build{% if use_typescript %} && vue-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",
19
+ "update": "npm update"{% if generate_client %},
20
+ "generate-types": "openapi-ts"{% endif %}
21
+ },
22
+ "dependencies": {
23
+ {%- for dep in dependencies %}
24
+ "{{ dep }}": "latest"{% if not loop.last or generate_zod or generate_client or enable_ssr %},{% endif %}
25
+ {%- endfor %}
26
+ {%- if generate_client %}
27
+ "axios": "^1.13.2"{% if generate_zod or enable_ssr %},{% endif %}
28
+ {%- endif %}
29
+ {%- if generate_zod %}
30
+ "zod": "^4.1.13"{% if enable_ssr %},{% endif %}
31
+ {%- endif %}
32
+ {%- if enable_ssr %}
33
+ "@vue/server-renderer": "latest"
34
+ {%- endif %}
35
+ },
36
+ "devDependencies": {
37
+ {%- for dep in dev_dependencies %}
38
+ "{{ dep }}": "latest",
39
+ {%- endfor %}
40
+ {%- if use_tailwind %}
41
+ "@tailwindcss/vite": "^4.1.17",
42
+ "tailwindcss": "^4.1.17",
43
+ {%- endif %}
44
+ {%- if generate_client %}
45
+ "@hey-api/openapi-ts": "^0.88.0",
46
+ {%- endif %}
47
+ "litestar-vite-plugin": "latest",
48
+ "vite": "^7.2.6"
49
+ }
50
+ }
@@ -0,0 +1,18 @@
1
+ import { createInertiaApp } from "@inertiajs/vue3";
2
+ import { resolvePageComponent } from "litestar-vite-plugin/inertia-helpers";
3
+ import type { DefineComponent } from "vue";
4
+ import { createApp, h } from "vue";
5
+ import "./style.css";
6
+
7
+ createInertiaApp({
8
+ resolve: (name) =>
9
+ resolvePageComponent(
10
+ `./pages/${name}.vue`,
11
+ import.meta.glob<DefineComponent>("./pages/**/*.vue"),
12
+ ),
13
+ setup({ el, App, props, plugin }) {
14
+ createApp({ render: () => h(App, props) })
15
+ .use(plugin)
16
+ .mount(el);
17
+ },
18
+ });
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ import { Head, Link } from "@inertiajs/vue3";
3
+
4
+ defineProps<{
5
+ message?: string;
6
+ }>();
7
+ </script>
8
+
9
+ <template>
10
+ <Head title="Home" />
11
+ <div class="max-w-5xl mx-auto px-4 py-10 text-center space-y-6">
12
+ <h1 class="text-3xl font-semibold text-[#202235]">{{ "{{ project_name }}" }}</h1>
13
+ <p class="text-slate-600">Vue 3 + Inertia.js + Litestar</p>
14
+ <p v-if="message" class="text-[#646cff] font-medium">{{ "{{ message }}" }}</p>
15
+
16
+ <nav class="flex justify-center gap-4">
17
+ <Link href="/books" class="rounded-full bg-[#202235] px-6 py-2 font-semibold text-white text-sm transition hover:bg-[#2d3348]">
18
+ View Books
19
+ </Link>
20
+ </nav>
21
+ </div>
22
+ </template>
@@ -0,0 +1,21 @@
1
+ import { createInertiaApp } from "@inertiajs/vue3";
2
+ import createServer from "@inertiajs/vue3/server";
3
+ import { renderToString } from "@vue/server-renderer";
4
+ import { createSSRApp, h } from "vue";
5
+
6
+ import { resolvePageComponent } from "litestar-vite-plugin/inertia-helpers";
7
+
8
+ createServer(
9
+ (page) =>
10
+ createInertiaApp({
11
+ page,
12
+ render: renderToString,
13
+ resolve: (name) => resolvePageComponent(`./pages/${name}.vue`, import.meta.glob("./pages/**/*.vue")),
14
+ setup({ App, props, plugin }) {
15
+ return createSSRApp({
16
+ render: () => h(App, props),
17
+ }).use(plugin);
18
+ },
19
+ }),
20
+ Number.parseInt(process.env.INERTIA_SSR_PORT || "13714"),
21
+ );
@@ -0,0 +1,21 @@
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
+ @media (prefers-color-scheme: light) {
17
+ :root {
18
+ color: #213547;
19
+ background-color: #ffffff;
20
+ }
21
+ }
@@ -0,0 +1,59 @@
1
+ import { defineConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
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
+ vue(),
26
+ litestar({
27
+ input: ["{{ resource_dir }}/main.ts"],
28
+ {% if enable_ssr %}
29
+ ssr: "{{ resource_dir }}/ssr.ts",
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 %}