Fastify DX has been deprecated in favor of @fastify/vite.
Read all about it in this blog post.
Archived
Fastify DX has been deprecated in favor of @fastify/vite.
Read all about it in this blog post.
3.x
v16.15.0
macOS
13
➜ npm run dev
dev
node server.js --dev
node:internal/process/esm_loader:94
internalBinding('errors').triggerUncaughtException(
^
TypeError: globalThis.Request is not a constructor
at file:///Users/me/Downloads/fastify-dx-main/starters/solid/node_modules/ky/distribution/core/constants.js:6:26
at file:///Users/me/Downloads/fastify-dx-main/starters/solid/node_modules/ky/distribution/core/constants.js:17:3
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async nodeImport (file:///Users/me/Downloads/fastify-dx-main/starters/solid/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:53137:21)
at async eval (/context.js:3:44)
at async instantiateModule (file:///Users/me/Downloads/fastify-dx-main/starters/solid/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:53058:9)
solid 示例目录
npm install
npm run dev
No response
starters/solid
can't run normally
4.2.1
0.0.4
18.5.0
Linux
Ubuntu 20.04.4 LTS x86_64
In the Solid template, for some reason, the actions aren't working
Run the Solid example as instructed
All of the examples involving sending API requests to the server would work
Is there any plans for a preact integration?
OFC we could use preact/compact
No response
No response
4.11.0
@fastify/vite: ^3.0.4, @fastify/vue: ^@0.1.0
18.x
Windows
10
When building project inside monorepo, file path is wrong.
vite v4.0.4 building for production...
✓ 11 modules transformed.
Could not resolve "./project/name/app/frontend/D:/project/name/app/frontend/src/pages/index.vue" from "../../../../../dx:routes.js"
file: /dx:routes.js
error during build:
RollupError: Could not resolve "./project/name/app/frontend/D:/project/name/app/frontend/src/pages/index.vue" from "../../../../../dx:routes.js"
at error (file:///D:/project/name/node_modules/rollup/dist/es/shared/rollup.js:1967:30)
at ModuleLoader.handleInvalidResolvedId (file:///D:/project/name/node_modules/rollup/dist/es/shared/rollup.js:23095:24)
at file:///D:/project/name/node_modules/rollup/dist/es/shared/rollup.js:23058:26
app/
|
|_backend/
| |_package.json
| |_src/
|
|_frontend/
| |_vite.config.ts
| |_client/
|
|_package.json
|_node_modules/
frontend
folder.Build success.
3.0.0-beta.23
No response
16.13.0
macOS
12.2
Getting npm install conflicts using the default vue template
npx degit fastify/fastify-dx/starters/vue
npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR! peer vue@"^3.2.25" from @vitejs/[email protected]
npm ERR! node_modules/@vitejs/plugin-vue
npm ERR! dev @vitejs/plugin-vue@"^2.3.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @vueuse/core@"^8.7.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR! peer vue@">= 2.5 < 3" from @vue/[email protected]
npm ERR! node_modules/@vue/composition-api
npm ERR! peerOptional @vue/composition-api@"^1.1.0" from @vueuse/[email protected]
npm ERR! node_modules/@vueuse/core
npm ERR! @vueuse/core@"^8.7.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
No response
3
0.03
18
macOS
Monterey 12.6
I'm just trying out the vue ts example, everything works fine but vue is not reactive (i.e : the original data is displayed, but if I do a simple count++
it won't update. It is also not detected by vue devtool
I use a basic vue-ts
example from the dev
branch, the only thing I've changed is updating @vueuse/core
to latest
Just install the basic vue example, try reactivity
No response
Fastify DX should provide easy integration with SQL databases.
No response
No response
Is your feature request related to a problem? Please describe.
There are cases where it is not possible to edit the host
file (i.e., CI phase), but still, the multi-tenancy layer needs to work.
Describe the solution you'd like
Given the following app.mjs
content:
export const tenants = {
foo: 'foo.dev',
bar: 'bar.dev',
}
it would be handy to configure a x-vhost
HTTP header which will tell universify which tenant we want to reach:
curl -H "x-vhost: foo.dev" -X GET http://localhost:3000
Testing frameworks such as Cypress already support the possibility to add custom HTTP headers to their test calls.
on the the previous version, i use the usePayload
as described in the docs:
import {usePayload} from 'fastify-vite-vue/core';
export default {
components: {},
setup() {
const myData = usePayload()
/// doing something..
return {myData}
}
}
on the new version I tried to import usePayload
from both: fastify-vite-vue/blueprint/entry/core
and /entry/core
both returned the same error:
ℹ at render (/my-app/node_modules/fastify-vite-vue/render.js:7:13)
ℹ at Object. (/my-app/node_modules/fastify-vite/mode/development.js:72:24)
ℹ at preHandlerCallback (/my-app/node_modules/fastify/lib/handleRequest.js:126:28)
ℹ at next (/my-app/node_modules/fastify/lib/hooks.js:158:7)
ℹ at handleResolve (/my-appnode_modules/fastify/lib/hooks.js:175:5)
ℹ at processTicksAndRejections (node:internal/process/task_queues:96:5)
is there a new way to use the payload behavior now?
I'm playing around with this library to figure out how I would create something that I would normally use a SPA for.
getData
export of the page module4.11.0
0.1.0
16.3.1
Linux
MacOS Ventura 13.1
Navigating using vue-router
named route is not working both during programmatic navigation and when using RouterLink
component. This is because the name
of the route is not passed when creating the routes here, https://github.com/fastify/fastify-dx/blob/main/packages/fastify-vue/virtual/routes.js#L33.
To fix, I will suggest adding name: routeDef.name
here.
I can open a PR for this.
index.vue
file, change the RouterLink
component to use a named route instead of a path.The application should navigate to a new route
I was reading the rendering options and was wondering if they were exclusive of eachother? And if so maybe they should be a string union or enum?
Prevents impossible states from happening.
interface RouteModule {
renderingMode?: 'server' | 'client' | 'isomorphic' // default is isomophic
streaming?: boolean
generated?: boolean // I noticed this wasn't documented
}
3.29.0
0.0.1
16.14.2
Linux
EndeavourOS 22.1
The react starter template is missing ky
package, it needs to be installed alongside ky-universal
.
Console output:
$ node server.js --dev
Sourcemap for "/dx:base.jsx" points to missing source files
Sourcemap for "/dx:router.jsx" points to missing source files
20:55:41 [vite] Error when evaluating SSR module /context.js:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ky' imported from /home/user/playground/fastify-dx-react/node_modules/ky-universal/index.js
at new NodeError (node:internal/errors:371:5)
at packageResolve (node:internal/modules/esm/resolve:932:9)
at moduleResolve (node:internal/modules/esm/resolve:978:18)
at defaultResolve (node:internal/modules/esm/resolve:1080:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
at link (node:internal/modules/esm/module_job:78:36)
node:internal/process/esm_loader:94
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ky' imported from /home/user/playground/fastify-dx-react/node_modules/ky-universal/index.js
at new NodeError (node:internal/errors:371:5)
at packageResolve (node:internal/modules/esm/resolve:932:9)
at moduleResolve (node:internal/modules/esm/resolve:978:18)
at defaultResolve (node:internal/modules/esm/resolve:1080:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn
;yarn dev
;No response
Is your feature request related to a problem? Please describe.
Domains can depend on the current environment. For example, when developing example.com
, we might have the following domains:
example.com
fix-JIRA-126300-somefix.user.staging.example.com
local.example.com
Describe the solution you'd like
I'd propose to change the tenants configuration in app.mjs
from this:
export const tenants = {
foo: 'foo.dev',
bar: 'bar.dev',
}
into something like this:
export const tenants = {
foo: {
dev: 'local.foo.dev',
stage: /[\w]+\.foo\.dev/,
prod: 'foo.dev'
},
// ...
}
Typically, the right domain gets selected by the NODE_ENV
environment variable. Still, I find it quite repetitive to maintain hundreds of domains by hand-writing them in the format above, so I'm open to discussing a better solution!
This issue links to #3, as domains could depend on the configuration layer.
4.0.3
No response
16
macOS
Monterey
It appears fastify-static requires version 3.x of fastify
❯ yarn build && yarn start
yarn run v1.22.17
warning package.json: No license field
$ npm run build:client && npm run build:server
> build:client
> vite build --outDir dist/client --ssrManifest
vite v2.9.12 building for production...
✓ 54 modules transformed.
dist/client/assets/logo.cc50e266.svg 6.08 KiB
dist/client/index.html 0.31 KiB
dist/client/ssr-manifest.json 2.07 KiB
dist/client/assets/client-only.53046d16.js 0.67 KiB / gzip: 0.43 KiB
dist/client/assets/index.38341194.js 1.55 KiB / gzip: 0.70 KiB
dist/client/assets/server-only.59b389c3.js 0.62 KiB / gzip: 0.40 KiB
dist/client/assets/streaming.ac73764e.js 0.59 KiB / gzip: 0.37 KiB
dist/client/assets/using-auth.6c7bd58d.js 1.24 KiB / gzip: 0.73 KiB
dist/client/assets/using-store.c395d616.js 1.07 KiB / gzip: 0.65 KiB
dist/client/assets/using-data.cf228474.js 1.29 KiB / gzip: 0.75 KiB
dist/client/assets/index.aa422626.css 2.68 KiB / gzip: 0.81 KiB
dist/client/assets/index.b29a6f0d.js 97.19 KiB / gzip: 37.57 KiB
> build:server
> vite build --outDir dist/server --ssr /index.js
vite v2.9.12 building SSR bundle for production...
transforming (16) assets/logo.svg"defineAsyncComponent" is imported from external module "vue" but never used in "../../../../../dx:core.js", "client/pages/client-only.vue", "client/pages/server-only.vue", "client/pages/using-store.vue", "client/pages/using-data.vue", "client/pages/using-auth.vue", "client/pages/index.vue", "client/components/Message.vue", "client/pages/streaming.vue", "client/layouts/auth.vue", "client/layouts/default.vue", "../../../../../dx:layout.vue", "client/root.vue" and "../../../../../dx:create.js".
✓ 20 modules transformed.
dist/server/index.js 26.46 KiB
✨ Done in 1.95s.
yarn run v1.22.17
warning package.json: No license field
$ node server.js
/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginUtils.js:118
throw new FST_ERR_PLUGIN_VERSION_MISMATCH(meta.name, requiredVersion, this.version)
^
FastifyError [Error]: fastify-plugin: fastify-static - expected '3.x' fastify version, '4.0.3' is installed
at Object.checkVersion (/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginUtils.js:118:11)
at Object.registerPlugin (/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginUtils.js:133:16)
at Boot.override (/Users/sebastian/code/playground/fastify-vue/node_modules/fastify/lib/pluginOverride.js:28:57)
at Plugin.exec (/Users/sebastian/code/playground/fastify-vue/node_modules/avvio/plugin.js:80:33)
at Boot.loadPlugin (/Users/sebastian/code/playground/fastify-vue/node_modules/avvio/plugin.js:273:10)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'FST_ERR_PLUGIN_VERSION_MISMATCH',
statusCode: 500
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Run yarn build && yarn start
on fresh install
No response
Fastify DX is a CLI for rapid application development using the Fastify stack. It aims to offer many of the same functionalities found in Next.js, Nuxt.js and Remix, but instead of relying on deep runtime internals, focus on code generation and glue code for setting up and running Fastify projects, both in development and production.
Packages that are part of the core boilerplate.
middie
fastify
fastify-redis
(optional)fastify-mongodb
(optional)fastify-postgresql
(optional)mercurius
(optional)fastify-api
(optional)fastify-vite
fastify-static
The CLI is meant to be installed globally, each command backed by zx script which can also be ejected and tweaked to meet custom project requirements.
fdx eject <boilerplate>
: ejects boilerplate in its original format.fdx apply
: modifies current boilerplate but based on settings uni.config.jsfdx dev <site>
: runs the specified site in development mode, or the last site ran.fdx build <site>
: runs the specified site in production modefdx start <site>
: runs the specified site in production modefdx gen <site>
: statically generates the specified siteThe goal is to build up from fastify-cli
with several DX oriented changes and additions, along with new and updated documentation.
3.29.1
No response
16
macOS
12.4
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/steve/Downloads/fastify-dx-main/starters/solid-ts/client/dist/server/index.ts' imported from /Users/steve/Downloads/fastify-dx-main/starters/solid-ts/node_modules/fastify-vite/mode/production.js
at __node_internal_captureLargerStackTrace (node:internal/errors:465:5)
at new NodeError (node:internal/errors:372:5)
at finalizeResolution (node:internal/modules/esm/resolve:437:11)
at moduleResolve (node:internal/modules/esm/resolve:1009:10)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at h (file:///Users/steve/Downloads/fastify-dx-main/starters/solid-ts/node_modules/@esbuild-kit/esm-loader/dist/index.js:1:2231)
at U (file:///Users/steve/Downloads/fastify-dx-main/starters/solid-ts/node_modules/@esbuild-kit/esm-loader/dist/index.js:1:1350)
at h (file:///Users/steve/Downloads/fastify-dx-main/starters/solid-ts/node_modules/@esbuild-kit/esm-loader/dist/index.js:1:2387)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ESMLoader.resolve (node:internal/modules/esm/loader:580:24)
at async ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:7)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15) {
code: 'ERR_MODULE_NOT_FOUND'
}
Run npm run build && npm run serve
in solid-ts starter project.
No response
Hi, I found a note in
fastify-dx/starters/react/vite.config.js
Line 14 in f40758a
So npm init dx
works as a replacement to dx setup
.
fastify-vite
is updated to @fastify/vite
. so please update the fastify-dx version.
No response
No response
3.29.2
0.0.5
16.14.2
macOS
11.6.6
[vite] Error when evaluating SSR module /context.ts:
TypeError: globalThis.Request is not a constructor
at /fastify-dx-react-ts/node_modules/ky/distribution/core/constants.js:6:26
at /fastify-dx-react-ts/node_modules/ky/distribution/core/constants.js:17:3
at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async nodeImport (/fastify-dx-react-ts/node_modules/fastify-vite/node_modules/vite/dist/node/chunks/dep-689425f3.js:724:749)
at async eval (/context.ts:3:31)
at async instantiateModule (/fastify-dx-react-ts/node_modules/fastify-vite/node_modules/vite/dist/node/chunks/dep-689425f3.js:722:2131)
Start from react-ts
Install missing dependencies vite
& ky
run yarn build && yarn dev
Working starter
In one of the starters there is a fetch function configured as
export const $fetch = ky.extend({
prefixUrl: 'http://localhost:3000',
})
This doesn't work when the application is deployed somewhere as the server needs to "call itself" and the client needs go to the right url where the application is running.
How do you handle this?
Hello! I'm looking to check out fastify-dx but unsure with how to integrate with a UI library like mantine.dev. Any chance you could provide a little info on how to go about it? https://mantine.dev/theming/ssr/ has an example for generic integration with ssr.
Thanks in advance!
Fastify DX should allow exporting a fully static or SPA bundle from the live application.
No response
No response
Is your feature request related to a problem? Please describe.
One common problem when working with multi-tenant applications is that they might need a strong configuration layer containing information to be used at build time (i.e., when statically generating a webapp), or at runtime (i.e. endpoints, third-party plugin configurations, etc.).
It would be useful to propose a standard way to manage configurations for every tenant.
Describe the solution you'd like
In Krabs, we used to put all the configuration inside a .krabs.js
file in the project's root:
module.exports = async () => ({
tenants: [
{
name: 'website-1',
// add any property here
domains: [
{
development: /dev\.[a-z]*\.local\.website-1\.com/,
staging: 'stage.website-1.com',
production: 'website-1.com',
},
],
},
{
name: 'website-2',
// add any property here
domains: [
{
development: 'local.website-2.com',
staging: 'stage.website-2.com',
production: /[\w|\d|-|_]+\.website-2.com/,
},
],
},
],
});
It is important that the configurations can be retrieved asynchronously, as they can come from different data sources (CMSs, e-commerce platforms, etc.) and depend on the current environment (stage, dev, prod, test).
I'm not sure this is the right way to proceed in Universify, I'm open to discussions!
Provide typing for all packages in this repo
Currently, all packages in this repo doesn't provide typing and us developers would have to use @ts-expect-error
and @ts-ignore
to supress errors, which is very annoying.
Inside vite.config.ts
.
The fallback for the default port should first fallback to process.env.PORT || 3000, and not directly to 3000.
3
0.0.4
16.15.1
Windows
10
HMR doesn't seem to be working with the Solid starter. If you make a change to a file, you can see in the console that vite is sending a hot update. However, you can see the entire app is unmounted and remounted to the dom when the update occurs.
install the solid starter, run dev environment and change any client file.
I expect the change to show in the browser without unmounting and remounting the main bundle
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.