|
| 1 | +# fastify-dx-vue [](https://www.npmjs.com/package/fastify-dx-vue) [](https://standardjs.com/) |
| 2 | + |
| 3 | +- [**Introduction**](https://github.com/fastify/fastify-dx/blob/main/packages/fastify-dx-vue/README.md#introduction) |
| 4 | +- [**Quick Start**](https://github.com/fastify/fastify-dx/blob/main/packages/fastify-dx-vue/README.md#quick-start) |
| 5 | +- [**Package Scripts**](https://github.com/fastify/fastify-dx/blob/main/packages/fastify-dx-vue/README.md#package-scripts) |
| 6 | +- [**Basic Setup**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/basic-setup.md) |
| 7 | +- [**Project Structure**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/project-structure.md) |
| 8 | +- [**Rendering Modes**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/rendering-modes.md) |
| 9 | +- [**Routing Configuration**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/routing-config.md) |
| 10 | +- [**Data Prefetching**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/data-prefetching.md) |
| 11 | +- [**Route Layouts**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/route-layouts.md) |
| 12 | +- [**Route Context**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/route-context.md) |
| 13 | +- [**Route Enter Event**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/route-enter.md) |
| 14 | +- [**Virtual Modules**](https://github.com/fastify/fastify-dx/blob/main/docs/vue/virtual-modules.md) |
| 15 | + |
| 16 | +## Introduction |
| 17 | + |
| 18 | +**Fastify DX for Vue** is a renderer adapter for [**fastify-vite**](https://github.com/fastify/fastify-vite). |
| 19 | + |
| 20 | +It lets you run and SSR (server-side render) **Vue 3 applications built with Vite** on [Fastify](https://fastify.io/), with a minimal and transparent **server-first approach** — everything starts with `server.js`, your actual Fastify server). |
| 21 | + |
| 22 | +It also provides a set of built-in utilities for ease of development and managing a universal JavaScript context (SSR to CSR), very much like **Nuxt.js**, **Next.js** and **Remix**. Both **Fastify DX for Vue** and [**Fastify DX for React**](https://github.com/fastify/fastify-dx/tree/main/packages/fastify-dx-react) implement the [URMA specification](https://github.com/fastify/fastify-dx/blob/main/URMA.md) and have almost the same API, with only minimal differences due to specific framework APIs or idioms. |
| 23 | + |
| 24 | +It is a **fast**, **lightweight** alternative to Nuxt.js packed with **Developer Experience** features. |
| 25 | + |
| 26 | +It has an extremely small core (~1k LOC total) and is built on top of [Fastify](https://github.com/fastify/fastify), [Vite](https://vitejs.dev/) and [Vue Router](https://router.vuejs.org/). |
| 27 | + |
| 28 | +[**See the release notes for the 0.0.1 alpha release**](https://github.com/fastify/fastify-dx/releases/tag/vue-v0.0.1). |
| 29 | + |
| 30 | +> At this stage this project is mostly a [**one-man show**](https://github.com/sponsors/galvez), who's devoting all his free time to its completion. Contributions are extremely welcome, as well as bug reports for any issues you may find. |
| 31 | +
|
| 32 | +In this first alpha release it's still missing a test suite. The same is true for [**fastify-vite**](). |
| 33 | + |
| 34 | +It'll move into **beta** status when test suites are added to both packages. |
| 35 | + |
| 36 | +## Quick Start |
| 37 | + |
| 38 | +Ensure you have **Node v16+**. |
| 39 | + |
| 40 | +Make a copy of [**starters/vue**](https://github.com/fastify/fastify-dx/tree/dev/starters/vue). If you have [`degit`](https://github.com/Rich-Harris/degit), run the following from a new directory: |
| 41 | + |
| 42 | +```bash |
| 43 | +degit fastify/fastify-dx/starters/vue |
| 44 | +``` |
| 45 | + |
| 46 | +> **If you're starting a project from scratch**, you'll need these packages installed. |
| 47 | +> |
| 48 | +> ```bash |
| 49 | +> npm i fastify fastify-vite fastify-dx-vue -P |
| 50 | +> npm i @vitejs/plugin-vue -D |
| 51 | +> ``` |
| 52 | +
|
| 53 | +
|
| 54 | +Run `npm install`. |
| 55 | + |
| 56 | +Run `npm run dev`. |
| 57 | +
|
| 58 | +Visit `http://localhost:3000/`. |
| 59 | +
|
| 60 | +## What's Included |
| 61 | +
|
| 62 | +That will get you a **starter template** with: |
| 63 | + |
| 64 | +- A minimal [Fastify](https://github.com/fastify/fastify) server. |
| 65 | +- Some dummy API routes. |
| 66 | +- A `pages/` folder with some [demo routes](https://github.com/fastify/fastify-dx/tree/dev/starters/vue/client/pages). |
| 67 | +- All configuration files. |
| 68 | +
|
| 69 | +It also includes some _**opinionated**_ essentials: |
| 70 | +
|
| 71 | +- [**PostCSS Preset Env**](https://www.npmjs.com/package/postcss-preset-env) by [**Jonathan Neal**](https://github.com/jonathantneal), which enables [several modern CSS features](https://preset-env.cssdb.org/), such as [**CSS Nesting**](https://www.w3.org/TR/css-nesting-1/). |
| 72 | +
|
| 73 | +- [**UnoCSS**](https://github.com/unocss/unocss) by [**Anthony Fu**](https://antfu.me/), which supports all [Tailwind utilities](https://uno.antfu.me/) and many other goodies through its [default preset](https://github.com/unocss/unocss/tree/main/packages/preset-uno). |
| 74 | +
|
| 75 | +- [**VueUse**](https://vueuse.org/) by [**Anthony Fu**](https://antfu.me/), which provides an extremely rich set of utilities — they're not included in the project build unless explicitly imported and used. |
| 76 | +
|
| 77 | +## Package Scripts |
| 78 | +
|
| 79 | +`npm run dev` boots the development server. |
| 80 | + |
| 81 | +`npm run build` creates the production bundle. |
| 82 | + |
| 83 | +`npm run serve` serves the production bundle. |
| 84 | +
|
| 85 | +## Meta |
| 86 | +
|
| 87 | +Created by [Jonas Galvez](https://github.com/sponsors/galvez), **Engineering Manager** and **Open Sourcerer** at [NearForm](https://nearform.com). |
| 88 | +
|
| 89 | +## Sponsors |
| 90 | +
|
| 91 | +<a href="https://nearform.com"><img width="200px" src="https://user-images.githubusercontent.com/12291/172310344-594669fd-da4c-466b-a250-a898569dfea3.svg"></a> |
| 92 | +
|
| 93 | +Also [**Duc-Thien Bui**](https://github.com/aecea) and [**Tom Preston-Werner**](https://github.com/mojombo) [via GitHub Sponsors](https://github.com/sponsors/galvez). _Thank you!_ |
0 commit comments