npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spirit.io

v1.0.24

Published

Extensible typescript ORM framework designed for MEAN stack

Downloads

66

Readme

Build Status Coverage Status

spirit.io

spirit.io is an extensible Node.JS ORM framework written with Typescript.
Its goal is to simplify complex application development by writing simple decorated model classes.
This classes will be translated by decorators and schemas compiler analysis in order to produce models schemas that would be used by spirit.io connectors...
At the end, the framework will produce CRUD operations usable from server side using all the power of Typescript language, but also from front-end applications a REST API with Express routes will be automatically generated.

Getting Started

First of all, spirit.io is a framework, so you need to create your own project to be able to use it.
Then, it's important to understand that spirit.io uses f-promise API, so please take a look to its documentation to learn all the benefits you will encounter.

When using spirit.io with Typescript, the Typescript compilation is done by common typescript compiler tsc.
But the first entry point is that you need to create a standard Javascript file.

index.js:

"use strict";
const fpromise = require('f-promise');

let MyApp = require('./lib/app').MyApp;
let app = new MyApp().init();
app.on('initialized', () => {
    fpromise.run(() => {
        app.start();
    }).catch(err => {
        console.error(err.stack);
    });
});

app.ts:

import { Server } from 'spirit.io/lib/application';
import { MongodbConnector } from 'spirit.io-mongodb-connector/lib/connector';
import { run } from 'f-promise';

export class MyApp extends Server {
    constructor(config?: any) {
        if (!config) config = require('./config').config;
        super(config);
    }

    init() {
        run(() => {
            console.log("\n========== Initialize server begins ============");
            
            // create a connector. Here mongodb for instance
            let mongoConnector = new MongodbConnector(this.config.connectors.mongodb);
            this.addConnector(mongoConnector);
            console.log("Mongo connector config: " + JSON.stringify(mongoConnector.config, null, 2));
            
            // register your own models
            this.contract.registerModelsByPath(path.resolve(path.join(__dirname, './models')));

            // load models
            super.init();
            this.on('initialized', () => {
                // Do your stuff here !!!
                console.log("========== Server initialized ============\n");
            });

        }).catch(err => {
            console.error(err.stack);
        })

        return this;
    }

    start(port?: number) {
        super.start(port || this.config.expressPort);
    }
}

Prerequisities

To use spirit.io, you need :

  • Node.JS 6.X
  • At least one spirit.io connector. eg: spirit.io-mongodb-connector
  • The connectors associated runtimes. eg: MongoDB server

Installing

Installing spirit.io is simple as :

# to install the framework
npm install --save spirit.io
# to install connectors
npm install --save spirit.io-mongodb-connector
...

Running the tests

npm test

Authors

  • Teddy Chambard

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details