https://github.com/pedroaurelli/fastify-swagger
Fastify Node example application auto documatated by Swagger
https://github.com/pedroaurelli/fastify-swagger
autodoc fastify nodejs solid swagger zod-validation
Last synced: 4 months ago
JSON representation
Fastify Node example application auto documatated by Swagger
- Host: GitHub
- URL: https://github.com/pedroaurelli/fastify-swagger
- Owner: pedroaurelli
- Created: 2024-12-23T12:48:11.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-01-22T15:47:19.000Z (11 months ago)
- Last Synced: 2025-02-17T09:45:08.948Z (10 months ago)
- Topics: autodoc, fastify, nodejs, solid, swagger, zod-validation
- Language: TypeScript
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
- [**src**](https://github.com/pedroaurelli/fastify-swager/tree/main/src)
- [**controllers**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/controllers)
- [**lib**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib)
- [definitions](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/definitions)
- [schemas](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/schemas)
- [types](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/types)
- [utils](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/utils)
- [**services**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/services)
| **Folder** | **Description** |
|-------|---------|
| [**src**](https://github.com/pedroaurelli/fastify-swager/tree/main/src) | Root folder of the project's source code. |
| [**controllers**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/controllers) | Contains controllers responsible for handling route requests and responses. |
| [**lib**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib) | Folder with libraries and auxiliary resources for the project. |
| [**definitions**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/definitions) | Define endpoint schema. |
| [**schemas**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/schemas) | Defines validation and data structure schemas. |
| [**types**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/types) | Contains type and interface definitions for the project. |
| [**utils**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/lib/utils) | Includes utility functions and helpers to support core functionalities. |
| [**services**](https://github.com/pedroaurelli/fastify-swager/tree/main/src/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