Fastify boilerplate with Vite & Vitest

Overview

Fastivite

Fastify boilerplate with Vite & Vitest

Coverage Status Sync Vulnerabilities Status

Enhance your Fastify DX with the power of Vite & Vitest.

Features

  •  All the power of Vite (Next Generation Frontend Isomorphic Tooling):
    • Lightning fast HMR (hot module replacement) in dev mode with Vite Plugin Node.
    • Smart & instant watch mode, like HMR for tests with Vitest.
  • 🛠️   DX setup:
    • Vite, Prettier and Typescript with common config, esnext ready and alias @/*
    • Tests with one Fastify instance setup, code coverage
    • Fastify with logger
    • Production build without Vite

So, it's super fast donc ça va super vite 🚀

Why and How

See Why and How Vite in node and Why Vitest.

Get started

  1. Clone this repo or use tiged with:
degit https://github.com/ManUtopiK/vite-fastify-boilerplate
  1. Install:
pnpm install

Start dev mode using Vite:

pnpm dev

Start test mode using Vitest:

pnpm test

Start test mode with coverage:

pnpm coverage

Compile typescript to javascript:

pnpm build

Start for production:

pnpm start

Code

  • Main file: src/app.ts
  • Configure logger: src/logger.ts
  • Change port in .env

Docs

Ressources

Add vite plugin example

Import .gql and .graphql files

  1. Install packages:

    pnpm add graphql graphql-tag
    pnpm add -D vite-plugin-simple-gql
  2. Configure vite.config.ts:

    import gql from 'vite-plugin-simple-gql'

    And add gql() to plugins:

    plugins: [gql(), ...]

Now you can import your graphql files in your code:

// example.ts
import MyQuery from './MyQuery.gql'

Contributions

If you would like to make any contribution you are welcome to do so.

Bugs

Please create an issue if you found any bugs, to help me improve this project!

Comments
  • Bump Fastify to v4, fix deprecated `prettyPrint` and variadic `listen` method

    Bump Fastify to v4, fix deprecated `prettyPrint` and variadic `listen` method

    Closes #8

    This PR includes 3 changes:

    1. Bump fastify to 4.0.2
    2. Use new listen method (ref: https://github.com/fastify/fastify/pull/3712)
    3. Replace LoggerOptions.prettyPrint to LoggerOptions.transport
    opened by davipon 1
  • `prettyPrint` is no longer supported after migrating to Fastify v4

    `prettyPrint` is no longer supported after migrating to Fastify v4

    Hi @ManUtopiK, first thank you for this great boilerplate.

    After upgrading fastify to 4.0.0, the below error message would show up in development: Error: prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)

    This can be addressed by using transport.

    I can open a PR if you think it's OK to bump fastify version to v4, thanks.

    opened by davipon 1
  • chore(deps): bump nanoid from 3.1.30 to 3.2.0

    chore(deps): bump nanoid from 3.1.30 to 3.2.0

    Bumps nanoid from 3.1.30 to 3.2.0.

    Changelog

    Sourced from nanoid's changelog.

    Change Log

    This project adheres to Semantic Versioning.

    3.2

    • Added --size and --alphabet arguments to binary (by Vitaly Baev).

    3.1.32

    • Reduced async exports size (by Artyom Arutyunyan).
    • Moved from Jest to uvu (by Vitaly Baev).

    3.1.31

    • Fixed collision vulnerability on object in size (by Artyom Arutyunyan).
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • [Snyk] Upgrade pino-pretty from 7.3.0 to 7.4.0

    [Snyk] Upgrade pino-pretty from 7.3.0 to 7.4.0

    Snyk has created this PR to upgrade pino-pretty from 7.3.0 to 7.4.0.

    merge advice :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 1 version ahead of your current version.
    • The recommended version was released 22 days ago, on 2022-01-19.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • [Snyk] Upgrade fastify from 3.25.3 to 3.26.0

    [Snyk] Upgrade fastify from 3.25.3 to 3.26.0

    Snyk has created this PR to upgrade fastify from 3.25.3 to 3.26.0.

    :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 1 version ahead of your current version.
    • The recommended version was released 22 days ago, on 2022-01-18.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • [Snyk] Upgrade env-schema from 3.5.1 to 3.5.2

    [Snyk] Upgrade env-schema from 3.5.1 to 3.5.2

    Snyk has created this PR to upgrade env-schema from 3.5.1 to 3.5.2.

    merge advice :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 1 version ahead of your current version.
    • The recommended version was released 21 days ago, on 2022-01-15.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • [Snyk] Upgrade pino from 7.6.2 to 7.6.3

    [Snyk] Upgrade pino from 7.6.2 to 7.6.3

    Snyk has created this PR to upgrade pino from 7.6.2 to 7.6.3.

    merge advice :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 1 version ahead of your current version.
    • The recommended version was released 22 days ago, on 2022-01-10.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • [Snyk] Upgrade fastify from 3.25.1 to 3.25.2

    [Snyk] Upgrade fastify from 3.25.1 to 3.25.2

    Snyk has created this PR to upgrade fastify from 3.25.1 to 3.25.2.

    merge advice :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 1 version ahead of your current version.
    • The recommended version was released 22 days ago, on 2021-12-23.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
Owner
Emmanuel Salomon
+12 years self-taught webdev with php, Node and front... Currently working with: hasura.io, serverless, nuxt.js, fastify... Happydev 😄  I accept remote jobs!
Emmanuel Salomon
Vite-plugin-web-extension - A vite plugin for generating cross browser platform, ES module based web extensions.

vite-plugin-web-extension A vite plugin for generating cross browser platform, ES module based web extensions. Features Manifest V2 & V3 Support Compl

Ruben Medina 81 Dec 31, 2022
Vue 3 + Vite + SSR template based on Vite Plugin SSR and inspired by Vitesse

Vite Vue SSR Starter Vue 3 + Vite + SSR template based on Vite Plugin SSR and inspired by Vitesse Features ⚡️ Vue 3, Vite 2, TypeScript ?? Domain-Driv

Oleg Koval 10 Aug 2, 2022
Modern ThreeJS boilerplate powered by Vite & Typescript

Modern ThreeJS ⚡️ Modern ThreeJS boilerplate powered by Vite & Typescript. Features Powered with Vite ?? GUI controls using Tweakpane ?? Typescript ??

Alvaro Saburido 64 Jan 4, 2023
⚡️ Vite + SolidJS + Electron boilerplate.

vite-solid-electron Overview Very simple Vite, SolidJS, Electron integration template. Contains only the basic dependencies. The extension is very fle

Christian Hansen 25 Dec 18, 2022
Chrome Extension Boilerplate with SolidJS + Vite + TypeScript + Manifest V3 + Hot Relaod

Chrome Extension Boilerplate with SolidJS + Vite + TypeScript + Manifest V3 + Hot Relaod Intro This boilerplate is made for creating chrome extensions

fuyutarow 34 Dec 27, 2022
Chrome Extension boilerplate with SolidJS + Vite + CRXJS

SolidJS Chrome Extension boilerplate An easy way to create Chrome extensions with SolidJS using Vite + CRXJS. Features For more functionality, check o

Ryan Conceicao 8 Dec 25, 2022
Real world app using Fastify-DX, Solid.js, Auth0 and GraphQL

Fastify DX and Solid.js In the Real World These are only the essentials to set up a "real world" application with Fastify DX, Solid.js, Auth0 and Grap

Zentered 6 Nov 14, 2022
A Marko plugin for Vite

@marko/vite A Marko plugin for Vite. Installation npm install @marko/vite Example config import { defineConfig } from "vite"; import marko from "@mark

Marko 49 Nov 26, 2022
🎉 基于 vite 2.0 + vue 3.0 + vue-router 4.0 + vuex 4.0 + element-plus 的后台管理系统vue3-element-admin

vue3-element-admin ?? 基于 Vite 2.0 + Vue3.0 + Vue-Router 4.0 + Vuex 4.0 + element-plus 的后台管理系统 简介 vue3-element-admin 是一个后台前端解决方案,它基于 vue3 和 element-plu

雪月欧巴 84 Nov 28, 2022
Vite template with TypeScript, Chakra UI, Eslint Airbnb, Prettier

Vite + Typescript + ChakraUI = ❤️ This is a vite template that combines several technologies: Vite React TypeScript ChakraUI Eslint with eslint-config

Lorenzo Rapetti 3 Mar 26, 2022
Integrate Tauri in a Vite project to build cross-platform apps.

vite-plugin-tauri Integrate Tauri in a Vite project to build cross-platform apps Install Make sure to setup your environment for Tauri development. Th

Amr Bashir 95 Dec 15, 2022
A template repository / quick start to build Azure Static Web Apps with a Node.js function. It uses Vue.js v3, Vue Router, Vuex, and Vite.js.

Azure Static Web App Template with Node.js API This is a template repository for creating Azure Static Web Apps that comes pre-configured with: Vue.js

Marc Duiker 6 Jun 25, 2022
⏳ vue3 + electron + ts + vite = mini template

v3-electron ?? Electron16 + Vue3 + Vite2 运行项目 # enter the project directory cd v3-electron # install dependency yarn # develop yarn dev # build exe

UNPany 8 Nov 11, 2022
Using Cypress with Vite, React, TypeScript, MSW and react-query

Vie + Cypress + MSW + react-query Demo Example of using Cypress with Vite, MSW and react-query. Uses the appReady pattern to signal to Cypress when th

Rob Caldecott 9 Jul 16, 2022
Some compile-time magic for your Vite project

?? You can help the author become a full-time open-source maintainer by sponsoring him on GitHub. vite-plugin-compile-time Use this plugin to generate

EGOIST 90 Dec 15, 2022
vite+vue3.2+setup+elementPlus+eslint+js+stylelint

前期准备工作,npm包和vscode配置 !!!很重要,关乎整个Vue3开发阶段的代码提示 Volar使用 使用Vue3开发需要禁用vscode插件Vetur 然后安装 Volar(Vue Language Features),这样Vue3代码提示即使是使用js开发也非常友好 如果volar没有任何

null 2 Feb 8, 2022
vue3 + vite + typescript template

Vue 3 + Typescript + Vite This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 <script setu

BrowLi 6 Aug 1, 2022
Minimal setup for a WebXR project using Vite, Babylon.js, TypeScript, and Vue

WebXR-Vite-Babylon-Simple Minimal setup for WebXR development using: vite typescript vue 3 babylonjs 5 (ES6) Intentionally made minimal changes from t

Josh Sanderson 6 Nov 13, 2022
Experimenting with vite typescript template rewrite for hot.opensauced.pizza

?? Open Sauced Vite Typescript Template Test ?? The path to your next Open Source contribution ?? Prerequisites In order to run the project we need th

TED Vortex (Teodor-Eugen Duțulescu) 3 Mar 11, 2022