https://github.com/vinejs/vinejs-example-fastify
An example application using VineJS to validate the Fastify request body along with functional tests.
https://github.com/vinejs/vinejs-example-fastify
Last synced: about 1 year ago
JSON representation
An example application using VineJS to validate the Fastify request body along with functional tests.
- Host: GitHub
- URL: https://github.com/vinejs/vinejs-example-fastify
- Owner: vinejs
- Created: 2023-06-16T07:50:08.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-13T14:29:21.000Z (over 2 years ago)
- Last Synced: 2025-03-28T09:21:16.124Z (about 1 year ago)
- Language: TypeScript
- Size: 458 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# VineJS ❤️ Fastify
> An example application using VineJS to validate the Fastify request body along with functional tests.

## What's in the box?
- ESM application 😍
- TypeScript setup with TS Node and SWC.
- A basic fastify application
- VineJS for validating request body
- Japa for writing HTTP requests ( real requests are sent to the server ).
## What is VineJS?
VineJS is a highly performant library to validate the HTTP request body in your backend applications. It is type-safe and has a vast collection of validation rules and schema types.
You can learn more about it on the [official documentation website](https://vinejs.dev/docs/introduction).
## Setup
- Clone this repo directly using Git or using `npx degit vinejs/vinejs-example-fastify`.
- Run `npm install` to install dependencies.
- Start the development server using the `npm run dev` script.
- Run tests using the `npm test` script.
## Code organization
- The functional code is kept inside the `./src/` directory. It includes routes and validators.
- The fastify application is created inside the `app.ts` file. The same instance is used for testing and running the server.
- The `server.ts` file starts the server.
- The `bin/test.ts` file is used to run the tests. We use the Japa setup hooks to start the server before running any tests.