SporeJS - Efficient, fast and robust MVC / PAC (Presentation Abstraction Control) Framework.
###Build efficient, fast and robust applications in Node.js SporeJS is a PAC (Presentation Abstraction Control) Framework which helps developers build solid web applications and RESTful APIs.
Express 4 - Under the hood we use Express as a minimal and flexible application core, providing a robust set of features for building your applications.
Sequelize ORM - The Sequelize library provides easy access to MySQL, MariaDB, SQLite or PostgreSQL databases by mapping database entries to objects and vice versa.
User - Role access distinction - Out of the box support for user / roles access distinction. Only show specific content to certain users.
Full CRUD implementation - Build CRUD interfaces from your models in minutes.
RAD optimized - We take care of the API and provide you with an "easy as" application framework, so you can focus on building a great user experience.
NOTE: You need to have node.js, mysql and npm installed
- Clone the project
$ git clone firstname.lastname@example.org:springload/SporeJS.git
- Install (You might be able to skip the first two steps and " grunt build" if you have bower & grunt already installed)
$ npm install -g bower $ npm install -g grunt-cli $ npm install $ grunt build $ cp config.disk.js app/config/config.js $ vim app/config/config.js
Set your DB user/password config in
config.js, for both development and test and production environment.
(If you're running the server in Vagrant you probably want to set the host to an empty string).
If using MySQL as a choice of storage, start your MySQL service
Create the required databse
$ mysql -u root -p > create database spore > quit
- On the first run of SporeJS add the argument "--run-migration" to install all needed tables
$ node spore --run-migration # Later, you can run with the handy default grunt task: $ grunt # or just plain $ node spore
IMPORTANT: if you have the flag
forceRebuild to true (in your config.js file), the DB will be re-built from scratch. You should only run this option when changing DB tables. Please be aware that all existent table data is lost!
When building from scratch what happens is:
- Models are sync (tables are created, previously deleted if existed)
- Migrations run (if the argument "--run-migration" was added)
- Fixtures (migrations/fixtures.yaml file containing the very basic objects)
You can watch the front-end JS and SaSS with:
$ grunt watch
login => http://localhost:3000/login logout => http://localhost:3000/logout register => http://localhost:3000/register
Default root user
email: email@example.com password: springload
Make sure you change your
app/config/config.js to set the correct test database. You don't want to wipe all the data.. do you?
... database: 'spcore_test' host: '10.0.0.10', ...
Run the tests:
Server config for production
1. Install pm2
pm2 is a great process manager for node. It's much better than forever, the less-awesome alternative.
$ npm install pm2@latest -g
2. Run app with pm2
# Will start maximum processes depending on available CPUs $ pm2 start spore.js -i max --name "sporejs"
Restart the app. This will also clear all associated sessions.
$ pm2 restart sporejs
Stopping the app. This will also clear all associated sessions.
$ pm2 stop sporejs
$ pm2 list
NOTE: currently the pm2 init script does not work correctly. The current implmentation runs via /etc/rc/local which in turn calls /root/node_startup at boot time.
Full documentation is available on the pm2 github page.