├── .gitignore
├── .npmignore
├── .travis.yml
├── README.md
├── index.js
├── lib
├── installer.js
└── trinte.js
├── package.json
├── tea.yaml
└── trinte
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | /nbproject
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | *.sock
2 | logs/*
3 | pids/*
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 |
3 | node_js:
4 | - 0.10
5 | - 0.12
6 | - 4.0
7 | - 4.2
8 |
9 | services:
10 | - mysql
11 |
12 | before_script:
13 | - npm install --save-dev
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://travis-ci.org/biggora/trinte)
2 | [](https://gemnasium.com/biggora/trinte)
3 | [](http://badge.fury.io/js/trinte)
4 | # TrinteJS Javascript MVC Framework for NodeJS
5 |
6 | A [MVC](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) boilerplate for [ExpressJS](http://expressjs.com/) backed by [CaminteJS](http://camintejs.com/) and [Bootstrap](http://twitter.github.com/bootstrap/index.html).
7 |
8 | ## Description
9 |
10 | This application help to create a Webapp [MVC](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) `style` in few minutes. TrinteJS tuned for ExpressJS 4.x, jQuery 2.x and Twitter Bootstrap 3.3.6.
11 |
12 | ## Dependencies
13 |
14 | - [Express 4.x](http://expressjs.com/).
15 | - [jQuery 2.2.x](http://jquery.com/).
16 | - [Twitter Bootstrap 3.3.x](http://getbootstrap.com/).
17 | - [Bootswatch 3.3.x](https://bootswatch.com/).
18 |
19 | ## Installation
20 | Installation is done using the NodeJS Package Manager (npm). If you don't have npm installed on your system you can download it from [npmjs.org](http://npmjs.org/)
21 |
22 | First install required dependencies:
23 |
24 | $ sudo npm install bower mocha gulp npm -g
25 |
26 | To install trinte:
27 |
28 | $ sudo npm install trinte -g
29 |
30 | ### Get started!
31 |
32 | $ trinte -i HelloWorld --sess --theme semargl # Create application
33 | $ cd HelloWorld && npm install # intall dependencies
34 |
35 | # generate scaffold
36 | $ trinte -g crud User active:bool name email password about:text created:date
37 |
38 | # start test
39 | $ npm test
40 |
41 |
42 | ## Supported databases:
43 |
44 | * MySQL / MariaDB
45 | * PostgreSQL
46 | * SQlite
47 | * MongoDB
48 | * Redis
49 | * RethinkDB
50 | * Riak
51 | * CouchDB
52 | * Neo4j
53 | * Firebird
54 | * TingoDB
55 |
56 |
57 | ### Table of contents
58 | * [Get started!](#create-app)
59 | * [Usage overview](https://github.com/biggora/trinte/wiki/Command-format)
60 | * [Command format](https://github.com/biggora/trinte/wiki/Command-format)
61 | * [Create and initialize app](https://github.com/biggora/trinte/wiki/Create-App)
62 | * [Creates a Scaffold](https://github.com/biggora/trinte/wiki/Create-a-Scaffold)
63 | * [Creates a Model](https://github.com/biggora/trinte/wiki/Create-a-Model)
64 | * [Creates a Controller](https://github.com/biggora/trinte/wiki/Create-a-controller)
65 | * [Creates a View](https://github.com/biggora/trinte/wiki/Create-a-View)
66 | * [Creates a Rest](https://github.com/biggora/trinte/wiki/Create-a-Rest)
67 | * [Field types](https://github.com/biggora/trinte/wiki/Create-a-Model#field-types)
68 | * [Runs server](https://github.com/biggora/trinte/wiki/Runs-Server)
69 | * [Created application](https://github.com/biggora/trinte/wiki/Application-configuration)
70 | * [Application configuration](https://github.com/biggora/trinte/wiki/Application-configuration)
71 | * [Database configuration](https://github.com/biggora/trinte/wiki/Application-configuration#database-configuration)
72 | * [Directory structure](https://github.com/biggora/trinte/wiki/Directory-Structure)
73 | * [Routing](https://github.com/biggora/trinte/wiki/Routes)
74 | * [Param pre-condition functions](https://github.com/biggora/trinte/wiki/Routes#wiki-param-pre-condition-functions)
75 | * [Middleware](https://github.com/biggora/trinte/wiki/Middleware)
76 | * [Application Helper](https://github.com/biggora/trinte/wiki/Helpers)
77 | * [Views Helper](https://github.com/biggora/trinte/wiki/Helpers#views-helper)
78 | * [Models Helper](https://github.com/biggora/trinte/wiki/Helpers#models-helper)
79 | * [Examples](https://github.com/biggora/trinte/wiki/Examples)
80 | * [Database configuration](https://github.com/biggora/trinte/wiki/Examples#database-configuration)
81 | * [Authentication](https://github.com/biggora/trinte/wiki/Examples#authentication)
82 | * [Session](https://github.com/biggora/trinte/wiki/Examples#session)
83 | * [Multilingual support](https://github.com/biggora/trinte/wiki/Multilingual-support)
84 | * [Recommend extensions](https://github.com/biggora/trinte/wiki/Recommend-Extensions)
85 | * [Credits](#credits)
86 | * [Peoject Author](#author)
87 | * [Copyright & License](#license)
88 | * [Resources](#resources)
89 |
90 |
91 | ## Usage overview:
92 |
93 | $ trinte [command(s)] [argument(s)]
94 |
95 | Command format detail [here](https://github.com/biggora/trinte/wiki/Command-format)
96 |
97 |
98 |
99 | ### Get started!
100 |
101 | $ trinte -i HelloWorld --sess # Create application
102 | $ cd HelloWorld && npm install # intall dependencies
103 |
104 | # generate scaffold
105 | $ trinte -g crud User active:bool name email password about:text created:date
106 | $ trinte -s # running server (default in cluster mode)
107 |
108 | - Browse your application to [http://localhost:3000](http://localhost:3000)
109 |
110 | Full params list [here](https://github.com/biggora/trinte/wiki/Create-App)
111 |
112 |
113 | ### Used Middleware
114 |
115 | In generated trinte app used middleware and libraries:
116 |
117 | - [body-parser](https://github.com/expressjs/body-parser)
118 | - [connect-multiparty](https://github.com/andrewrk/connect-multiparty)
119 | - [compression](https://github.com/expressjs/compression)
120 | - [connect-timeout](https://github.com/expressjs/timeout)
121 | - [cookie-parser](https://github.com/expressjs/cookie-parser)
122 | - [csurf](https://github.com/expressjs/csurf)
123 | - [errorhandler](https://github.com/expressjs/errorhandler)
124 | - [express-session](https://github.com/expressjs/session)
125 | - [method-override](https://github.com/expressjs/method-override)
126 | - [morgan](https://github.com/expressjs/morgan)
127 | - [serve-static](https://github.com/expressjs/serve-static)
128 | - [static-favicon](https://github.com/expressjs/favicon)
129 | - [connect-flash](https://github.com/jaredhanson/connect-flash)
130 | - [express-useragent](https://github.com/biggora/express-useragent)
131 | - [express-params](https://github.com/visionmedia/express-params)
132 | - [connect-caminte](https://github.com/biggora/connect-caminte)
133 |
134 |
135 | ### Recommend extensions
136 |
137 | - [CaminteJS](http://www.camintejs.com/) - Cross-db ORM for NodeJS
138 | - [2CO](https://github.com/biggora/2co) - is the module that will provide nodejs adapters for 2checkout API payment gateway.
139 | - [connect-caminte](https://github.com/biggora/connect-caminte) CrossDB Session Storage for Connect/Express.
140 |
141 |
142 | ### In the Wild
143 |
144 | The following projects use TrinteJS.
145 |
146 | If you are using TrinteJS in a project, app, or module, get on the list below
147 | by getting in touch or submitting a pull request with changes to the README.
148 |
149 |
150 | ### Startups & Apps
151 |
152 | - [RVA](http://www.rva.lv/)
153 | - [RK69](http://www.rk69.lv/)
154 | - [TViMama](http://tvimama.com/)
155 |
156 |
157 | ### Credits
158 |
159 | - [Node.js](http://nodejs.org/): Amazing javascript asynchronous IO library, install manually.
160 | - [NPM](http://npmjs.org/): Node package manager, used to install:
161 | - [Express.Js](http://expressjs.com/): Application Framework for Node.js
162 | - [Caminte.Js](http://camintejs.com/): Node.JS ORM for Any DB.
163 | - [EJS](http://embeddedjs.com/): Embedded Javascript Templating Library.
164 | - [jQuery](http://jquery.com/): Best Javascript Library.
165 | - [Bootstrap](http://twitter.github.com/bootstrap/index.html): Powerful front-end CSS/JS framework.
166 | - [Bootswatch](https://bootswatch.com/): Free themes for Bootstrap.
167 | - [Font Awesome](https://fortawesome.github.io/Font-Awesome/): The iconic font and CSS toolkit.
168 | - [Glyphicons](http://glyphicons.com/): Fantastic library of precisely prepared monochromatic icons and symbols.
169 |
170 |
171 | ### Author
172 |
173 | Aleksej Gordejev (aleksej@gordejev.lv).
174 |
175 |
176 | ### Copyright & License
177 |
178 | (The MIT License)
179 |
180 | Copyright (c) 2012 Aleksej Gordejev
181 |
182 | Permission is hereby granted, free of charge, to any person obtaining
183 | a copy of this software and associated documentation files (the
184 | 'Software'), to deal in the Software without restriction, including
185 | without limitation the rights to use, copy, modify, merge, publish,
186 | distribute, sublicense, and/or sell copies of the Software, and to
187 | permit persons to whom the Software is furnished to do so, subject to
188 | the following conditions:
189 |
190 | The above copyright notice and this permission notice shall be
191 | included in all copies or substantial portions of the Software.
192 |
193 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
194 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
195 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
196 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
197 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
198 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
199 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
200 |
201 |
202 | ### Resources
203 |
204 | - Visit the [author website](http://www.gordejev.lv).
205 | - Follow [@biggora](https://twitter.com/#!/biggora) on Twitter for updates.
206 | - Report issues on the [github issues](https://github.com/biggora/trinte/issues) page.
207 |
208 | [](https://github.com/igrigorik/ga-beacon)
209 |
210 | [](https://bitdeli.com/free "Bitdeli Badge")
211 |
212 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * TrinteJS MVC Bootstrap
3 | *
4 | * @project trinte
5 | * @author Alexey Gordeyev
6 | * @created 2013-09-27 07:25:26
7 | * @Params - cmd - server | script | params
8 | *
9 | */
10 |
11 | module.exports = require('./lib/trinte.js');
--------------------------------------------------------------------------------
/lib/installer.js:
--------------------------------------------------------------------------------
1 | /**
2 | * TrinteJS MVC Bootstrap
3 | *
4 | * @project trinte
5 | * @author Alexey Gordeyev
6 | * @created 2013-09-27 07:25:26
7 | * @Params - cmd - server | script | params
8 | *
9 | */
10 |
11 | /**
12 | * Explicit module dependencies
13 | */
14 | var npm = require("npm");
15 | var creator = require('trinte-creator');
16 |
17 | /**
18 | * Main Installer
19 | * @param {Object} params
20 | */
21 | exports.installModule = function (params) {
22 | var module = params.name;
23 | var modules = [params.name];
24 | switch (params.name) {
25 | case 'authorization':
26 | module = 'trinte-auth';
27 | modules = [
28 | 'trinte-auth',
29 | 'pause',
30 | 'pkginfo',
31 | 'passport',
32 | 'passport-local',
33 | 'passport-strategy'
34 | ];
35 | break;
36 | case 'uploader':
37 | module = 'express-uploader';
38 | modules = [
39 | 'express-uploader',
40 | 'gm',
41 | 'uuid'
42 | ];
43 | break;
44 | default:
45 | }
46 |
47 | npm.load(params, function (err) {
48 | if (err) {
49 | return console.log(err);
50 | }
51 | npm.commands.install(modules, function (err, data) {
52 | if (err) {
53 | return console.log(err);
54 | }
55 | var instPath = './node_modules/' + module + '/install.js';
56 | try {
57 | require(instPath);
58 | } catch(err) {
59 | }
60 | // command succeeded, and data might have some info
61 | });
62 | npm.on("log", function (message) {
63 | // console.log(message);
64 | });
65 | });
66 | };
67 |
--------------------------------------------------------------------------------
/lib/trinte.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | /**
3 | * TrinteJS MVC Bootstrap
4 | *
5 | * @project trinte
6 | * @author Alexey Gordeyev
7 | * @created 2013-09-27 07:25:26
8 | * @Params - cmd - server | script | params
9 | *
10 | */
11 |
12 | /**
13 | * Explicit module dependencies
14 | */
15 | var fs = require('fs');
16 | var creator = require('trinte-creator');
17 | var util = creator.util;
18 | var logger = creator.logger;
19 | var installer = require('./installer');
20 | var child = require('child_process');
21 | var exec = child.exec;
22 |
23 | /**
24 | * Paths
25 | **/
26 | var projectPath = fs.realpathSync('.').replace(/\\/gi, "/");
27 | var bootstrapPath = __dirname.replace(/\\/gi, "/").replace(/\/lib$/gi, "");
28 | var args = process.argv.slice(2);
29 | var appLauncher = util.parseArgs(args);
30 | var ucmd = "echo $(whoami)";
31 |
32 | if (util.isWindows()) {
33 | ucmd = "echo %username%";
34 | }
35 |
36 | /**
37 | * Framework version.
38 | */
39 |
40 | var version = require(bootstrapPath + '/package.json').version;
41 |
42 | appLauncher.projectPath = projectPath;
43 | appLauncher.bootstrapPath = bootstrapPath;
44 |
45 | switch (appLauncher.command) {
46 | case 'V':
47 | case "version":
48 | process.stdout.write(version);
49 | process.exit(1);
50 | break;
51 | case 'init':
52 | exec(ucmd, function(error, stdout, stderr) {
53 | appLauncher.author = (stdout || "").replace(/^\s+|\s+$/, "");
54 | creator.createApp(appLauncher);
55 | logger.verbose('Create TrinteJS Application ' + appLauncher.name);
56 | });
57 | break;
58 | case 'script':
59 | creator.createScript(appLauncher);
60 | break;
61 | case 'server':
62 | util.runServer(appLauncher);
63 | break;
64 | case 'cluster':
65 | util.runCluster(appLauncher);
66 | break;
67 | case 'install':
68 | installer.installModule(appLauncher);
69 | break;
70 | default:
71 | creator.showHelp(appLauncher, version);
72 | }
73 |
74 | function allClose(e) {
75 | process.stdout.write('\x1B[39m\r\n');
76 | logger.critical('Process Aborting!', false);
77 | process.exit(1);
78 | }
79 |
80 | // process.on('SIGSTOP', allClose);
81 | process.on('SIGINT', allClose);
82 | process.on('SIGTSTP', allClose);
83 | process.on('SIGTERM', allClose);
84 |
85 | process.on('exit', function(e) {
86 | process.stdout.write('\x1B[39m\r\n');
87 | });
88 |
89 | /*
90 | logger.notice('notice log to file');
91 | logger.input('input log to file');
92 | logger.verbose('verbose log to file');
93 | logger.alert('alert log to file');
94 | logger.critical('crit log to file', true);
95 | logger.info('info log to file');
96 | logger.status('status log to file');
97 | logger.msg('msg log to file');
98 | logger.data('data log to file');
99 | logger.help('help log to file');
100 | logger.warning('warning log to file', true);
101 | logger.debug('debug log to file');
102 | logger.error('error log to file');
103 | console.log(appLauncher)
104 | */
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "trinte",
3 | "description": "TrinteJS - MVC framework for NodeJS",
4 | "version": "0.4.6",
5 | "keywords": [
6 | "app",
7 | "mvc",
8 | "web-framework",
9 | "framework",
10 | "trinte",
11 | "trintejs",
12 | "caminte",
13 | "mongoose",
14 | "express",
15 | "redis",
16 | "mongodb",
17 | "mysql",
18 | "postgres",
19 | "sqlite3"
20 | ],
21 | "homepage": "http://www.trintejs.com/",
22 | "author": {
23 | "name": "Aleksej Gordejev",
24 | "email": "aleksej@gordejev.lv",
25 | "url": "https://github.com/biggora/"
26 | },
27 | "repository": {
28 | "type": "git",
29 | "url": "git://github.com/biggora/trinte.git"
30 | },
31 | "license": "MIT",
32 | "main": "trinte",
33 | "engines": {
34 | "node": ">=4.3.0",
35 | "npm": ">=2.15.11"
36 | },
37 | "dependencies": {
38 | "trinte-creator": "^0.3.0",
39 | "trinte-themes": "^0.1.4"
40 | },
41 | "devDependencies": {
42 | },
43 | "optionalDependencies": {
44 | "npm": "^2.15.11"
45 | },
46 | "bin": {
47 | "trinte": "./lib/trinte.js",
48 | "trintejs": "./lib/trinte.js"
49 | }
50 | }
--------------------------------------------------------------------------------
/tea.yaml:
--------------------------------------------------------------------------------
1 | # https://tea.xyz/what-is-this-file
2 | ---
3 | version: 1.0.0
4 | codeOwners:
5 | - '0xdC30512ad161D6D26959cC706916Ae515d97fB26'
6 | quorum: 1
7 |
--------------------------------------------------------------------------------
/trinte:
--------------------------------------------------------------------------------
1 | ./trinte.js
--------------------------------------------------------------------------------