Skip to content

HTTP adapter module for using Fastify as an HTTP server

License

Notifications You must be signed in to change notification settings

cmmvio/cmmv-fastify

Repository files navigation

CMMV Logo

Contract-Model-Model-View (CMMV)
Building scalable and modular applications using contracts.

NPM Version Package License

DocumentationReport Issue

Description

CMMV (Contract-Model-Model-View) is a minimalistic and modular framework for building scalable applications in TypeScript. Inspired by modern design patterns, CMMV uses contracts to define the entire application, from ORM entities to REST controllers and WebSocket endpoints, allowing for a highly structured and maintainable codebase.

Legacy Setup (Manual)

If you prefer to set up the project manually, you can still install the necessary modules individually:

$ pnpm add @cmmv/fastify @fastify/compress @fastify/cors @fastify/helmet @fastify/secure-session @fastify/static @fastify/view

Quick Start

The @cmmv/fastify module provides an alternative HTTP adapter based on Fastify, allowing you to use Fastify middleware and features seamlessly with your CMMV application.

import { Application } from "@cmmv/core";
import { ViewModule } from "@cmmv/view";

import { 
  FastifyAdapter, 
  FastifyModule 
} from "@cmmv/fastify";

Application.create({
    httpAdapter: FastifyAdapter, // Add the FastifyAdapter here
    wsAdapter: WSAdapter,
    modules: [
        FastifyModule, // Add the FastifyModule here
    ],
    services: [...],
    contracts: [...]
});

About

HTTP adapter module for using Fastify as an HTTP server

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published