Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrehrferreira/cmmv
Contract-Model-Model-View (CMMV) - Minimalistic Node.js Server Framework
https://github.com/andrehrferreira/cmmv
cmmv contracts nestjs nodejs protobuf rpc typescript websocket
Last synced: about 1 month ago
JSON representation
Contract-Model-Model-View (CMMV) - Minimalistic Node.js Server Framework
- Host: GitHub
- URL: https://github.com/andrehrferreira/cmmv
- Owner: andrehrferreira
- License: mit
- Created: 2024-08-21T15:01:15.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-12-04T10:15:44.000Z (about 1 month ago)
- Last Synced: 2024-12-04T11:24:17.640Z (about 1 month ago)
- Topics: cmmv, contracts, nestjs, nodejs, protobuf, rpc, typescript, websocket
- Language: TypeScript
- Homepage: https://cmmv.io
- Size: 6.3 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Contract-Model-Model-View (CMMV)
Building scalable and modular applications using contracts.
## 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.
## Philosophy
CMMV aims to simplify the development process by leveraging TypeScript's powerful type system and decorators. It eliminates the need for heavy frontend frameworks by focusing on direct control over data binding and interactions, while maintaining flexibility through modular design.
## Features
- **Contract-Driven Development:** Use TypeScript contracts to define models, controllers, and more.
- **Modular Architecture:** Compose your application using modules, making it easy to manage and scale.
- **RPC & REST Support:** Integrated support for both binary RPC via WebSocket and traditional REST APIs.
- **Express Integration:** Seamless integration with Express for a familiar and robust HTTP server environment.
- **Extensible:** Highly customizable and easy to extend with your own modules and components.## Setup with CLI
CMMV now provides a CLI (Command Line Interface) to streamline the installation process and quickly set up your project with the desired configurations.
To initialize a new project, you can use the following command:
```bash
$ pnpm dlx @cmmv/cli@latest init
```This command will walk you through a guided setup process, asking about your preferred configurations, such as enabling Vite, RPC, caching, repository type, and view setup (e.g., Vue 3 or Reactivity). It will automatically create the necessary files and folders, set up dependencies, and configure the project.
## Legacy Setup (Manual)
If you prefer to set up the project manually, you can still install the necessary modules individually:
```bash
$ pnpm add @cmmv/core @cmmv/http @cmmv/view rxjs reflect-metadata class-validator class-transformer fast-json-stringify
```## Quick Start
Below is a simple example of how to create a new CMMV application:
```typescript
import { Application } from "@cmmv/core";
import { DefaultAdapter, DefaultHTTPModule } from "@cmmv/http";
import { ProtobufModule } from "@cmmv/protobuf";
import { WSModule, WSAdapter } from "@cmmv/ws";
import { ViewModule } from "@cmmv/view";
import { RepositoryModule, Repository } from "@cmmv/repository";
import { ApplicationModule } from "./app.module";Application.create({
httpAdapter: DefaultAdapter,
wsAdapter: WSAdapter,
modules: [
DefaultHTTPModule,
ProtobufModule,
WSModule,
ViewModule,
RepositoryModule,
ApplicationModule
],
services: [Repository],
contracts: [...]
});
```