Skip to content

Fastify Node example application auto documatated by Swagger

Notifications You must be signed in to change notification settings

pedroaurelli/fastify-swagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.JS app (Fastify) auto documented by Swagger

Objective

  • The objective of this project is not to create a new API. I was testing some project structures to validate the input and output values from the controller. I applied knowledge from all the API projects I have worked on and merged only the best practices that I consider essential for any API project. This includes: route documentation, input and output value validation, tests (coming soon), directory structure, some SOLID principles, and Design Patterns.

Project Structure

Folder Description
src Root folder of the project's source code.
controllers Contains controllers responsible for handling route requests and responses.
lib Folder with libraries and auxiliary resources for the project.
definitions Define endpoint schema.
schemas Defines validation and data structure schemas.
types Contains type and interface definitions for the project.
utils Includes utility functions and helpers to support core functionalities.
services Implements business logic.

Scripts

Script Description
dev Runs the server in development mode
build Build app to production

Packages

Dependency Description
typescript Typed JavaScript language.
tsx TypeScript runtime with ES module support.
fastify Fast web framework for Node.js.
@fastify/swagger Swagger/OpenAPI plugin for Fastify.
zod Schema validation library for TypeScript.

Swagger

  • Swagger UI available in /docs route

About

Fastify Node example application auto documatated by Swagger

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published