Waiski / O.js

App for keeping track of drinks and their drinkers
0 stars 0 forks source link

OTY app

Contributing

Everyone's help is needed! No matter how little you code, there's something to do. Please check the issues at GitHub and find something where you can contribute.

To make changes to the code:

  1. Read this readme
  2. Install the app locally using the instructions here
  3. Learn basic JavaScript syntax and learn about CoffeeScript
  4. Familiarize yourself with Meteor basics
  5. If you want to contribute to the front-end, learn about Semantic UI, Font Awesome and LESS
  6. If you want to contribute to the back-end, learn about Meteor collections and MongoDB
  7. Push commits!

Technical basis

This app is based on Meteor, a full-stack node.js web framework. Meteor is pure javascript, and most of the code works both in the front- as well as back-end. Meteor application can be tested on Windows using Vagrant to create a Linux virtual machine, that runs Meteor. This project contains a Vagrantfile and a provision.sh shell script that set up a virtual machine for this purpose (based loosely on a Gist by Gabriel Pugliese).

The app makes use of several Javascript libraries and technologies, some of which are built-in to Meteor, and some of which are added with Meteor's packaging system. The most important ones are:

Software requirements

In order to develop this app, your computer needs to have Git, VirtualBox and Vagrant installed. On Windows, you also need to install the unix-like tools that come with Git or some other package to be able to run ssh from command line. Using a virtual machine guarantees that development can be done on any platform and minimizes "works on my machine" -type problems.

Installation

  1. Clone this repository to your machine

  2. Run vagrant up in the main folder (the one with Vagrantfile). Vagrant's automated process will create a 64bit Ubuntu 14.01 virtual machine with all necessary sofware installed.

  3. Run vagrant ssh. This will connect you to your virtual machine.

  4. Run the following commands:

    # Still in the home folder (of the freshly created virtual machine)
    meteor create app
    cd app
    meteor run
  5. Now you have created a dummy version of your app. Press Ctrl+C to stop the app. This meteor app in your virtual machine's home folder will only be used to store the database, as the VirtualBox synced folder does not support it.

  6. Now you can change to the actual project folder and create symlinks to the dummy app too make the database work:

    # Still in the same shell, within the virtual machine
    cd /vagrant/app
    rm -rf .meteor/local
    mkdir .meteor/local
    echo "sudo mount --bind /home/vagrant/app/.meteor/local /vagrant/app/.meteor/local" >> ~/.bashrc && source ~/.bashrc
  7. Now your're all set. Run meteor run to run the app and navigate your browser to http://localhost:3000 to see it. To quit the app, press Ctrl+C, to exit the virtual machine connection, run exit, and to shut down the virtual machine, run vagrant halt.

Practical tips

Coding guidelines

App structure

In Meteor framework the same code can run in the browser and server. This is a great and powerful feature. However many functions need to only work on the client or the server. Folders app/client/ and app/server/ house these respectively.

The basic idea is that as much of the logic as possible is run on the client. This makes for a better user experience and simpler code. The server's number one priority is security. The files app/server/publications.coffee and app/server/rules.js are most important for data security.

Meteor automatically includes all code in all files to the application, there is no need to import anything specifically. Thus you are free to place code wherever you think is best.

Read more at Meteor docs.

Resources