Git Product home page Git Product logo

clincoud's Introduction

NPM Version Package License

Clincoud

Clincoud logo

The Node.js framework that encourages you to create a clean, layered architecture.

Table of Contents

Introduction

// TODO

Philosophy

// TODO

Architecture

The main reason that hinders the correct implementation of a clean architecture is that, as it is a set of theoretical principles, each developer implements it in a different way:

  • The number of layers may vary.
  • The name of each layer can also be different.
  • Depending on the programming language used, the implementations of each of the layers can be influenced by the conventions and good practices of the language.

For these reasons it is important to clarify that this is simply ANOTHER IMPLEMENTATION of a clean architecture, but that is why we accompany it with documentation that explains its peculiarities.

And of course this architecture is open to be modified in later versions if at some point we understand that there is a better way of doing things.

Clincoud architecture

Layers

// TODO

Domain

// TODO

Application

// TODO

Infrastructure

// TODO

Presentation

// TODO

Overview

This section is a tour to understand the main concepts of the framework.

Getting Started

// TODO

App

The Clincoud application is where controllers are registered and lifecycle events are managed.

Write your App extending BaseApp and add all the logic you need. A good example of use is to establish the connection to the database in the callback of the initialized event.

import { BaseApp, MongooseConnectionToken } from "clincoud";
import { imported, injectable, provided } from "inversify-sugar";
import { Connection } from "mongoose";

@injectable()
export default class App extends BaseApp {
  constructor(
    @provided(MongooseConnectionToken)
    private readonly mongooseConnectionProvider: () => Promise<Connection>
  ) {
    super();
  }

  public async onInitialized() {
    await this.mongooseConnectionProvider();
  }
}

Then you have to bind the App class as a provider to the AppModule using the AppToken service identifier.

import {
  AppConfigToken,
  PortToken,
  CoreModule,
  AppToken,
  MongooseModule,
} from "clincoud";
import { module } from "inversify-sugar";
import App from "./App";

@module({
  imports: [
    CoreModule,
    MongooseModule.forRoot({ uri: process.env.DATABASE_URI }),
  ],
  providers: [
    {
      provide: PortToken,
      useValue: process.env.PORT,
    },
    { useClass: App, provide: AppToken },
    {
      provide: AppConfigToken,
      useValue: appConfig,
    },
  ],
})
export class AppModule {}

Modules

Clincoud delegates the hierarchical dependency system to the inversify-sugar package, which offers a rather elegant agnostic API.

See the inversify-sugar documentation documentation to learn more about this Inversify framework.

Controllers

// TODO

Middlewares

// TODO

Support the Project

โ˜•๏ธ Buy me a coffee so the open source party never ends.

Buy Me A Coffee

YouTube | Instagram | Twitter | Facebook

godofprogramming.com

License

The Clincoud source code is made available under the MIT license.

Some of the dependencies are licensed differently, with the BSD license, for example.

clincoud's People

Contributors

carlossalasamper avatar gamesmayer avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.