Hatch.js - not officially supported

Overview

(Hatch.js is no longer officially supported. Please feel free to fork, chop and change, use as reference)

Hatch.js documentation

Hatch.js is CMS platform with social features. This package is an Express application which can be extended with additional modules. All parts of this application are accesible via CompoundJS API.

License

Hatch.js dual-licensed under AGPL and Hatch Commercial License. AGPL means that if you fork the Hatch.js code or write a derivative application (an application which runs on the same CPU process), you must open-source and distribute your project freely under the same AGPL terms. Alternatively a commercial closed-source license is available. More details on our website.

Partner with us

We believe Hatch.js is a great platform for building social web applications. We are actively seeking partnerships with companies to build commercial products for any purpose on top of the platform. Contact us for more information.

Dependencies

Hatch.js requires Node 0.8+, Redis 2.6+ and imagemagick to be installed. Bower is also required to install client-side dependencies.

npm install -g bower

Installation

Use Hatch.js as an npm. Please see the examples for how to use Hatch.js in this way:

npm install hatchjs

Or standalone:

git clone https://github.com/inventures/hatchjs

Then:

npm install
bower install

Running Hatch.js

Like most node apps, Hatch.js listens by default on port 3000. We recommend using Nginx or similar to proxy requests via port 80 or 443.

node server

Running in production mode is strongly recommended for live sites. Assets are automatically combined, minified and strongly cached, view templates are pre-compiled resulting in better performance all round:

NODE_ENV=production node .
NODE_ENV=production CLUSTER=1 node .

Visit http://hostname:3000 to get started with your first group.

By default Hatch.js connects to Redis DB 0 on 127.0.0.1. You can change this by modifying ./config/database.js.

Package Structure Overview

./server.js

Exports application server builder function. This is main entry point to application.

./app

Hatch.js is express app structurized with Compound MVC, so this is standard directory structure for MVC app. It contains core models, controllers, views, helpers, assets and mailers.

./app/models

Hatch.js models define all of the business object classes within the application. These can be extended by placing model class files within the /app/models folder of your app or your app's modules.

Models are accessed via the application context as follows:

c.ModelName.functionName();

E.g.

c.Content.all({ where: { groupId: 1 }}, function (err, posts) { 
	// do some stuff with the results
});

Hatch.js uses the RedisHQ driver which is part of JugglingDB. Redis may seem like an unusual choice for a primary database. It was chosen because the requirements of Hatch.js and derived apps are usually fairly data-light + traffic-heavy. Redis is an ideal choice because of it's lightning quick performance. Due to the asynchronous nature of Node.js + Redis and the optimised implementation of MULTI batching within the RedisHQ driver, multiple duplicate requests within the same i/o callback context are also able to share queries and results-sets meaning that performance and scalability of the solution is significantly improved over what is achievable using a more conventional database such as MongoDB or MySQL. On rudimentary hardware (e.g. a standard 1 thread AWS micro instance), Hatch.js is easily able to cope with significant levels of traffic and a large number of concurrent users. We estimate the base performance is roughly 20-30x that of platforms such as Wordpress.

The Hatch.js database schema is self-explanatory and can be found here.

./lib

Hatch core. Contains API and core implementation. Hatch APIs are accessible via the context in code as follows:

c.compound.hatch.apiName.functionName();

Or globally:

var compound = require('compound');
compound.hatch.apiName.functionName();

The available APIs, documentation and their functions can be found here: ./lib/api

./hatch_modules

Built-in modules for Hatch.js. Each module is separate application mounted to root application on /do/{moduleName} route.

Modules can modify the existing functionality or models or provide new features. They can be enabled or disabled on a per-group or per-application basis via the management area of each group.

Modules documentation can be found within the README.

./test

Before running tests ensure you have installed dev dependencies:

npm install
bower install

Use make test command to run all tests. While debugging / TDD use make testing command which is the same as previous, but with --watch flag. For verbose output run make test-verbose.

Every piece of code should be tested (ideally). Make sure tests included in pull request.

Bitdeli Badge GA Badge

Comments
  • Npm-cli.js error while installing in on window 7

    Npm-cli.js error while installing in on window 7

    Detail error

    npm http 304 https://registry.npmjs.org/http-signature npm http 304 https://registry.npmjs.org/node-uuid npm ERR! Error: ENOENT, lstat 'C:\Users\ajay\AppData\Local\Temp\npm-4216-3VuIyqA Z\1396539220032-0.5700292692054063\package\test\data\huge.pdf' npm ERR! If you need help, you may report this log at: npm ERR! http://github.com/isaacs/npm/issues npm ERR! or email it to: npm ERR! [email protected]

    npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nod ejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR! cwd C:\article\hatchjs npm ERR! node -v v0.10.18 npm ERR! npm -v 1.3.8 npm ERR! path C:\Users\ajay\AppData\Local\Temp\npm-4216-3VuIyqAZ\1396539220032-0 .5700292692054063\package\test\data\huge.pdf npm ERR! fstream_path C:\Users\ajay\AppData\Local\Temp\npm-4216-3VuIyqAZ\1396539 220032-0.5700292692054063\package\test\data\huge.pdf npm ERR! fstream_type File npm ERR! fstream_class FileWriter npm ERR! code ENOENT npm ERR! errno 34 npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fst ream\lib\writer.js:284:26 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm http 304 https://registry.npmjs.org/json-stringify-safe npm ERR! Error: ENOENT, lstat 'C:\Users\ajay\AppData\Local\Temp\npm-4216-3VuIyqA Z\1396539250221-0.3566357975360006\package\test\fixture\http\encoding\pf1y5.png. http' npm ERR! If you need help, you may report this log at: npm ERR! http://github.com/isaacs/npm/issues npm ERR! or email it to: npm ERR! [email protected]

    npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nod ejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR! cwd C:\article\hatchjs npm ERR! node -v v0.10.18 npm ERR! npm -v 1.3.8 npm ERR! path C:\Users\ajay\AppData\Local\Temp\npm-4216-3VuIyqAZ\1396539250221-0 .3566357975360006\package\test\fixture\http\encoding\pf1y5.png.http npm ERR! fstream_path C:\Users\ajay\AppData\Local\Temp\npm-4216-3VuIyqAZ\1396539 250221-0.3566357975360006\package\test\fixture\http\encoding\pf1y5.png.http npm ERR! fstream_type File npm ERR! fstream_class FileWriter npm ERR! code ENOENT npm ERR! errno 34 npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fst ream\lib\writer.js:284:26 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

    opened by manoj97738 2
  • Tried to set a wildcard URL... now I get 404

    Tried to set a wildcard URL... now I get 404

    I feel like not a very smart man.

    Anyway, I tried to set the URL for my group to https://*.blahblah.net and now all I get is a 404 no matter what I do. I have no idea how to go back. It's all 404's now. It's listening on 3000 and nginx is acting as reverse proxy on 80 and 443.

    Looking back now I cringe, but I've no idea where to go from here. Please help me recover my website, thank you.

    opened by thehobart 1
  • Project Dead

    Project Dead

    After 2 full days of mehs and moans, I gave up. This project haven't updated for years and the depenedencies are all broken. I managed to overcome hiredis compiling and some other dependency issues, and finally got through installation phace. But the app keeps crashing for god knows why reasons and I can not find much usefull information over the internet.

    Any one who come and see this in the future, for the sake of yourself, leave. This thing is not working any more, and I guess you came here because you've just read an outdated blog post.

    opened by davidaq 0
  • Session Problem of New Version Express?

    Session Problem of New Version Express?

    When I try to install current version hatch,js, I got following error after submit the admin registration.

    uncaughtException: Cannot set property ‘userId’ of undefined at done (/Users/xxxx//hatchjs/hatch_modules/setup/lib/controller.js:92:28)

    opened by Kennyl 0
  • Sharing objects between controllers.

    Sharing objects between controllers.

    How is this done? Is there anything other than anti-patterns that I can use to do this(globals)? I've looked at the 'c' param in one of my controllers and i've tried using things like 'controllerExtensions' etc to get something injected through that but no luck at all. I'm after something simple like sharing a log object and I feel like i'm hitting my head against a brick wall. Any ideas? Thanks!

    opened by jmgunn87 0
  • docs: Fix simple typo, hightlight -> highlight

    docs: Fix simple typo, hightlight -> highlight

    There is a small typo in public/admin/webarch/assets/js/form_validations.js, public/admin/webarch/assets/js/login.js, public/admin/webarch/assets/js/support_ticket.js.

    Should read highlight rather than hightlight.

    opened by timgates42 0
  • Broken Dependencies

    Broken Dependencies

    It would appear that hatch.js does not work with the latest version of file-finder.

    Stylesheet: not found. Setting default theme
    uncaughtException
    uncaughtException: Cannot read property 'contents' of undefined
      at Object.Parser.parse (/home/james/node_modules/hatchjs/node_modules/less/lib/less/parser/parser.js:117:20)
      at /home/james/node_modules/hatchjs/app/models/Stylesheet.js:118:20
      at /home/james/node_modules/hatchjs/node_modules/async/lib/async.js:119:25
      at /home/james/node_modules/hatchjs/node_modules/async/lib/async.js:24:16
      at /home/james/node_modules/hatchjs/app/models/Stylesheet.js:104:21
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:81:16
      at FSReqWrap.oncomplete (fs.js:95:15)
    
    Notify error
    uncaughtException: Cannot read property 'contents' of undefined
      at Object.Parser.parse (/home/james/node_modules/hatchjs/node_modules/less/lib/less/parser/parser.js:117:20)
      at /home/james/node_modules/hatchjs/app/models/Stylesheet.js:118:20
      at /home/james/node_modules/hatchjs/node_modules/async/lib/async.js:119:25
      at /home/james/node_modules/hatchjs/node_modules/async/lib/async.js:24:16
      at /home/james/node_modules/hatchjs/app/models/Stylesheet.js:104:21
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:71:17
      at /home/james/node_modules/hatchjs/node_modules/file-finder/file-finder.js:81:16
      at FSReqWrap.oncomplete (fs.js:95:15)
    
    opened by lottspot 2
  • Database configuration doesn't work

    Database configuration doesn't work

    After looking how a redis connection is setup on environment.js, I've tried to the following change to configure a different host for redis:

    diff --git a/config/database.js b/config/database.js
    index e0003f1..9d70faa 100644
    --- a/config/database.js
    +++ b/config/database.js
    @@ -1,4 +1,4 @@
    -module.exports = 
    +module.exports =
       { "development":
         { "driver":   "redis-hq"
         , "prefix":   "dev"
    @@ -6,7 +6,7 @@ module.exports =
         , "fulltext": {
             driver: 'reds'
         }
    -    , "session": {database: 10}
    +    , "session": {database: 10, host: "redis"}
         }
       , "test":
         { "driver":   "redis-hq"
    

    but I still get a connection error with

    UncaughtException: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
    

    How do I configure a different host? The docs mention that I need to change that file.

    opened by masm 0
  • uncaughtException: Cannot read property 'contents' of undefined   at Object.Parser.parse

    uncaughtException: Cannot read property 'contents' of undefined at Object.Parser.parse

    GET /do/stylesheet/css/0 controller: stylesheet action: css
    Params: {"version":"0"}
    >>> perform css
    MULTI
      GET dev/User:1
      EVALSHA [Lua: ZRANGE+MGET] 0 z:dev/Page:url:localhost:3000 0 0 dev/Page
    EXEC [41 ms]
    EVALSHA [Lua: ZRANGE+MGET] 0 z:dev/Stylesheet:groupId:1 0 0 dev/Stylesheet [0 ms]
    Stylesheet: not found. Setting default theme
    uncaughtException
    uncaughtException: Cannot read property 'contents' of undefined
      at Object.Parser.parse (/home/user/Workspace/NodeProjects/Hatch/node_modules/less/lib/less/parser/parser.js:108:20)
      at /home/user/Workspace/NodeProjects/Hatch/app/models/Stylesheet.js:118:20
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/async/lib/async.js:119:25
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/async/lib/async.js:24:16
      at /home/user/Workspace/NodeProjects/Hatch/app/models/Stylesheet.js:104:21
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:81:16
      at Object.oncomplete (fs.js:107:15)
    
    Notify error
    uncaughtException: Cannot read property 'contents' of undefined
      at Object.Parser.parse (/home/user/Workspace/NodeProjects/Hatch/node_modules/less/lib/less/parser/parser.js:108:20)
      at /home/user/Workspace/NodeProjects/Hatch/app/models/Stylesheet.js:118:20
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/async/lib/async.js:119:25
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/async/lib/async.js:24:16
      at /home/user/Workspace/NodeProjects/Hatch/app/models/Stylesheet.js:104:21
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:71:17
      at /home/user/Workspace/NodeProjects/Hatch/node_modules/file-finder/file-finder.js:81:16
      at Object.oncomplete (fs.js:107:15)
    
    user@system:~/Workspace/NodeProjects/Hatch$ 
    
    
    opened by chandanpasunoori 8
Owner
Inventures Software Ltd
Inventures Software Ltd
A "Basic-to-Lisp" compiler. But Basic is not real Basic, and Lisp is not real Lisp.

Basic2Lisp A "Basic-to-Lisp" compiler. But Basic is not real Basic, and Lisp is not real Lisp. Syntax Print-Sth Put some-value to standard output. PRI

Hana Yabuki 5 Jul 10, 2022
🧩 TypeScript utility type in order to ensure to return only properties (not methods) containing values in primitive types such as number or boolean (not Value Objects)

?? TypeScript Primitives type TypeScript utility type in order to ensure to return only properties (not methods) containing values in primitive types

CodelyTV 82 Dec 7, 2022
JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team ⚡

Handsontable is a JavaScript component that combines data grid features with spreadsheet-like UX. It provides data binding, data validation, filtering

Handsontable 17.4k Jan 1, 2023
JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team ⚡

Handsontable is a JavaScript component that combines data grid features with spreadsheet-like UX. It provides data binding, data validation, filtering

Handsontable 17.4k Dec 31, 2022
JavaScript data grid with a spreadsheet look & feel. Works for React, Angular, and Vue. Supported by the Handsontable team ⚡

Handsontable is a JavaScript component that combines data grid features with spreadsheet-like UX. It provides data binding, data validation, filtering

Handsontable 17.4k Dec 28, 2022
💻 Simple and flexible CLI Tool for your daily JIRA activity (supported on all OSes)

jirax ⭐ If you are using this tool or you like it, Star on GitHub — it helps! A CLI tool for JIRA for day to day usage with JIRA.Speed up your JIRA ac

জুনিপ 56 Oct 4, 2022
Hello! Welcome to Our own Live Code Editor 2!! This is supported tabs and full-screen editing, Console, tabs and more are coming. We uses this one in our all tutorials. Made by @E-Coders & @Genius398

Live Code Editor 2 Hello! this is our live code editor an another second release version of our main Resporibity. This have style as tabs and more fea

Educational Websites 5 Nov 18, 2021
Sheetzapper imports your account value accross Zapper.fi supported wallets and dapps into a Google Sheet

Overview Sheetzapper imports your account value accross Zapper.fi supported wallets and dapps into a Google Sheet. This allows you to chart your net w

null 4 Nov 27, 2022
A container-friendly alternative to os.cpus().length. Both cgroups v1 and cgroups v2 are supported.

node-cpu-count A container-friendly alternative to os.cpus().length. Both cgroups v1 and cgroups v2 are supported. Installation $ npm install node-cpu

Jiahao Lu 2 Jan 17, 2022
A website for detecting name of bank from card number, supported all Iranian banks

Detect Iranian Bank Web A website for detecting name of bank from card number, supported all Iranian banks. This package contains SVG logo and brand c

Max Base 12 Oct 2, 2022
Try Vant in the Playground. Currently only Vant 3+ is supported

SFC Playground with Vant This is an Vant SFC Playground. Detail vercel.app Or zhixiaoqiang.github.io NOTE! The reason why this is designed to manually

jzone 16 Dec 14, 2022
Multiple `.env` file supported.

Features Support multiple .env files and keep the inheritance Priority: local > not unassigned local mode > not unassigned mode e.g. .env.{{mode}}.loc

Tianyu Li 67 Oct 31, 2022
Create Angular Dynamic Forms with only JSON configuration. Full grid layout supported.

Angular Dynamic Forms Angular component that allows the creation of dynamic forms. You can use this component in situations where you get the configur

Martin Stefanovic 27 Nov 17, 2022
A decentralized protocol for indexing and querying data from DecentraMix's on chain contracts across all supported blockchains.

A decentralized protocol for indexing and querying data from DeMix contracts across all supported blockchains.

DecentraWorld Ecosystem 92 May 3, 2022
An Eleventy wrapper for type supported configurations

Shareable Eleventy configuration strap. The module can be dropped in to your .eleventy.js configuration file for Typed supported configuration options.

ΝΙΚΟΛΑΣ 5 Jun 17, 2022
automatic poits grabber for twitch, works with all supported langauges on twitch

Twitch Points Grabber It’s an extension for edge, is aviable in the microsoft Edge Add-ons. This extension will collect any channel points. Settings I

Claudio Menegotto 3 Nov 28, 2022
BetterScroll is a plugin which is aimed at solving scrolling circumstances on the mobile side (PC supported already).

BetterScroll is a plugin which is aimed at solving scrolling circumstances on the mobile side (PC supported already).

HuangYi 15.9k Dec 30, 2022
An obsidian plugin that allows code blocks executed interactively in sandbox like jupyter notebooks. Supported language rust、kotlin、python、Javascript、TypeScript etc.

Obsidian Code Emitter This plugin allows code blocks executed interactively like jupyter notebooks. Currently, support languages: Rust Kotlin JavaScri

YiiSh 38 Dec 28, 2022