Blame view

README.md 8.79 KB
043f0b290   Ryan Glover   Update Meteor to ...
1
  # The Meteor Chef - Base (@1.0.4.2)
aa8376fb4   Ryan Glover   Add basic README ...
2
  A starting point for Meteor apps.
8435208bb   Ryan Glover   Add nod to recipe...
3
  Base is the lazy person's starter kit for Meteor. It includes some commonly used packages (biased to The Meteor Chef) and code for common functionality. This is the starter kit for all Meteor Chef recipes.
aa8376fb4   Ryan Glover   Add basic README ...
4

7becce2b9   The Meteor Chef   Add note about co...
5
  For more detail on updates, [read the Changelog](https://github.com/themeteorchef/base/wiki/Changelog). If you're interested in contributing to Base, checkout the [Contribution wiki](https://github.com/themeteorchef/base/wiki/Contributing-to-Base) to get started.
8651eb8e0   Ryan Glover   Add link to Chang...
6

aa8376fb4   Ryan Glover   Add basic README ...
7
  ### Packages Included
d30971538   Ryan Glover   Update formatting...
8
9
10
  - Accounts (Base) - `meteor add accounts-base`
  - Accounts (Password) - `meteor add accounts-password`
  - Audit Argument Checks - `meteor add audit-argument-checks`
8391001a9   Ryan Glover   Update README to ...
11
  - Bert - `meteor add themeteorchef:bert`
021324406   Ryan Glover   Remove pinglamb:b...
12
  - Bootstrap 3 - `meteor add twbs:bootstrap`
f12d9dc25   Ryan Glover   Update README to ...
13
  - Browser Policy - `meteor add browser-policy`
d30971538   Ryan Glover   Update formatting...
14
  - Check - `meteor add check`
07610a42f   Ryan Glover   Update README to ...
15
16
  - Handlebars Server - `meteor add cmather:handlebars-server`
  - Iron Router - `meteor add iron:router`
d30971538   Ryan Glover   Update formatting...
17
  - jQuery - `meteor add jquery`
10b1a6f3d   Ryan Glover   Update documentat...
18
  - jQuery Validation - `meteor add themeteorchef:jquery-validation`
f12d9dc25   Ryan Glover   Update README to ...
19
  - NPM - `meteor add meteorhacks:npm`
dfcb49d75   Ryan Glover   Additional edits ...
20
  - Sass - `meteor add particle4dev:sass@0.3.0`
d30971538   Ryan Glover   Update formatting...
21
  - Underscore - `meteor add underscore`
aa8376fb4   Ryan Glover   Add basic README ...
22

f12d9dc25   Ryan Glover   Update README to ...
23
  **Note:** Base also supports loading NPM packages using the `meteorhacks:npm` package. To load NPM packages, add name and version information to `/packages.json` and inside of your file (server only), load the package with `var package = Meteor.npmRequire('package-name');`. For more information, see the [meteorhacks:npm documentation](https://github.com/meteorhacks/npm/).
d1f4dbea8   Ryan Glover   Additional README...
24
25
26
27
28
  ### File Structure
  Base comes with a pre-defined file structure common to all projects along with some skeleton files for getting started quickly. Here's what it looks like:
  
  ```
  /root
07610a42f   Ryan Glover   Update README to ...
29
  ---/.meteor
d1f4dbea8   Ryan Glover   Additional README...
30
31
  ---/client
  ------/controllers
39a8af161   Ryan Glover   Add bootstrap hea...
32
  ---------/authenticated
d36bdd404   Ryan Glover   Update README.md ...
33
  ------------header.js
d1f4dbea8   Ryan Glover   Additional README...
34
  ---------/public
d36bdd404   Ryan Glover   Update README.md ...
35
  ------------login.js
d36bdd404   Ryan Glover   Update README.md ...
36
37
  ------------recover-password.js
  ------------reset-password.js
95a4bb32c   Ryan Glover   Stylistic improve...
38
  ------------signup.js
d1f4dbea8   Ryan Glover   Additional README...
39
  ------/helpers
d36bdd404   Ryan Glover   Update README.md ...
40
  ---------helpers-ui.js
39a8af161   Ryan Glover   Add bootstrap hea...
41
42
  ------/includes
  ---------_header.html
d1f4dbea8   Ryan Glover   Additional README...
43
44
45
  ------/layouts
  ---------layout-default.html
  ------/routes
f12d9dc25   Ryan Glover   Update README to ...
46
  ---------hooks.js
d36bdd404   Ryan Glover   Update README.md ...
47
  ---------routes-authenticated.js
95a4bb32c   Ryan Glover   Stylistic improve...
48
  ---------routes-global.js
d36bdd404   Ryan Glover   Update README.md ...
49
  ---------routes-public.js
d1f4dbea8   Ryan Glover   Additional README...
50
  ------/stylesheets
07610a42f   Ryan Glover   Update README to ...
51
52
53
  ---------/sass
  ------------/globals
  ---------------_extends.scss
07610a42f   Ryan Glover   Update README to ...
54
  ------------/views
07610a42f   Ryan Glover   Update README to ...
55
56
57
  ---------------/public
  ------------------_login.scss
  ---------application.scss
cabe1c46e   Ryan Glover   Add a simple sign...
58
  -------/views
39d39619c   Ryan Glover   Add automatic acc...
59
60
  ---------/authenticated
  ------------index.html
cabe1c46e   Ryan Glover   Add a simple sign...
61
  ---------/public
f12d9dc25   Ryan Glover   Update README to ...
62
  ------------loading.html
cabe1c46e   Ryan Glover   Add a simple sign...
63
  ------------login.html
07610a42f   Ryan Glover   Update README to ...
64
  ------------not-found.html
cabe1c46e   Ryan Glover   Add a simple sign...
65
66
67
  ------------recover-password.html
  ------------reset-password.html
  ------------signup.html
d1f4dbea8   Ryan Glover   Additional README...
68
  ---/collections
d36bdd404   Ryan Glover   Update README.md ...
69
  ------example.js
f12d9dc25   Ryan Glover   Update README to ...
70
  ------users.js
d1f4dbea8   Ryan Glover   Additional README...
71
  ---/packages
39d39619c   Ryan Glover   Add automatic acc...
72
  ------ (See List Above)
d1f4dbea8   Ryan Glover   Additional README...
73
  ---/public
c67f755ea   Ryan Glover   Add support for p...
74
  ------/images
d1f4dbea8   Ryan Glover   Additional README...
75
76
  ---/server
  ------/admin
f12d9dc25   Ryan Glover   Update README to ...
77
78
79
  ---------/startup-functions
  ------------browser-policies.js
  ------------test-accounts.js
d36bdd404   Ryan Glover   Update README.md ...
80
  ---------startup.js
07610a42f   Ryan Glover   Update README to ...
81
  ------/email
07610a42f   Ryan Glover   Update README to ...
82
  ---------/templates
d36bdd404   Ryan Glover   Update README.md ...
83
  ------------reset-password.js
6acecba62   Ryan Glover   Update README wit...
84
85
86
87
88
89
90
91
92
93
94
  ------/methods
  ---------/insert
  ------------example.js
  ---------/read
  ------------example.js
  ---------/remove
  ------------example.js
  ---------/update
  ------------example.js
  ---------/utility
  ------------example.js
07610a42f   Ryan Glover   Update README to ...
95
  ------/publications
f12d9dc25   Ryan Glover   Update README to ...
96
  ---------example.js
c67f755ea   Ryan Glover   Add support for p...
97
98
99
100
101
102
103
104
105
106
  ---.editorconfig
  ---.gitignore
  ---application.html
  ---package.json
  ---packages.json
  ---README.MD (this file)
  ---settings-development.json
  ---settings-production.json
  ---smart.json (added by Meteor)
  ---smart.lock (added by Meteor)
d1f4dbea8   Ryan Glover   Additional README...
107
  ```
d36bdd404   Ryan Glover   Update README.md ...
108
109
110
111
  ### JavaScript & CSS
  Prior to v2.0.0, Base was written in CoffeeScript. At the request of the community, Base was ported _back_ to native JavaScript.
  
  CSS in Base is written using [Sass](http://sass-lang.com).
d1f4dbea8   Ryan Glover   Additional README...
112

aa8376fb4   Ryan Glover   Add basic README ...
113
  ### Functionality
7fa84d8b4   Ryan Glover   Add settings.json...
114
  ###### Configuration
c67f755ea   Ryan Glover   Add support for p...
115
  Base includes a pattern for managing your API keys, connection strings, and other configuration information using two files: `settings-development.json` and `settings-production.json`. This pattern separates your development and production configuration into two separate files for the sake of security.
c445a14b9   Ryan Glover   Add mention of us...
116

c67f755ea   Ryan Glover   Add support for p...
117
  Per [Josh Owen's article](http://joshowens.me/environment-settings-and-security-with-meteor-js/), it's considered "bad practice" to check your production keys into your repo (private or otherwise). Base accounts for this by giving you two separate files, but also specifies that your `settings-production.json` file should be ignored by git in `.gitignore`.
c445a14b9   Ryan Glover   Add mention of us...
118

c67f755ea   Ryan Glover   Add support for p...
119
120
121
122
123
124
125
126
  This means that keys that are only used for testing or development purposes can be placed in `settings-development.json`, while keys used in your production application should be placed in `settings-production.json`. Sharing and management of `settings-production.json` should be done on a person-to-person basis and _not_ made globally accessible.
  
  ###### Startup & Deployment
  A tip picked up from [Gerard Sychay at Differential](http://blog.differential.com/use-package-json-in-your-meteor-app-for-fun-profit/), Base makes use of the NPM `package.json` convention to make startup and deployment super easy. Within `package.json`, three scripts have been defined for you:
  
  1. `npm start` - Starts your Meteor server locally with `settings-development.json` in tow. Equivalent to typing out `meteor --settings settings-development.json`.
  2. `npm staging` - Deploys your Meteor app to a [Modulus](http://modulus.io) server defined as your "Staging" environment. This requires you to have a Modulus account set up and a server titled "Staging" set up. You can customize this to match your own naming conventions. This also automatically sets your `METEOR_SETTINGS` environment variable on Modulus equal to the contents of your `settings-development.json` file so you don't have to do it by hand.
  3. `npm production` - Deploys your Meteor app to a [Modulus](http://modulus.io) server defined as your "Production" environment. This requires you to have a Modulus account set up and a server titled "Production" set up. You can customize this to match your own naming conventions. This also automatically sets your `METEOR_SETTINGS` environment variable on Modulus equal to the contents of your `settings-production.json` file so you don't have to do it by hand.
7fa84d8b4   Ryan Glover   Add settings.json...
127

95a4bb32c   Ryan Glover   Stylistic improve...
128
  ###### Bootstrap (@3.2.1)
f12d9dc25   Ryan Glover   Update README to ...
129
  Base makes use of the [Bootstrap](http://getbootstrap.com) front-end Framework. It may not be your bag of chips and is *definitely not required*. If you want to swap it out, you'll need to unhook the markup in each of the included template files in `/client/views` and uninstall the `twbs:bootstrap` package by running `meteor remove twbs:bootstrap` in your terminal.
3f0a97317   Ryan Glover   Update README wit...
130

95a4bb32c   Ryan Glover   Stylistic improve...
131
  In respect to UI, Base uses Bootstrap's `.navbar` element, as well as its `.container` and a few `.row`/`.col-<size>-<columns>` wrappers. You'll also find the `.btn` class and its modifiers (`.success, .warning, etc.`) in use throughout the app. All of these implementations are merely presentational and can be changed (or removed) as you see fit.
c7fad243d   Ryan Glover   Add note in READM...
132

39d39619c   Ryan Glover   Add automatic acc...
133
  ###### Basic Routing
95a4bb32c   Ryan Glover   Stylistic improve...
134
  Base comes with a collection of pre-defined routes and templates for common functionality. Base also includes a set of common route filters for managing user access. Routes bundled include:
39d39619c   Ryan Glover   Add automatic acc...
135
136
137
138
  
  ```
  - / (Authenticated)
  - /login (Public)
39d39619c   Ryan Glover   Add automatic acc...
139
140
  - /recover-password (Public)
  - /reset-password (Public)
95a4bb32c   Ryan Glover   Stylistic improve...
141
  - /signup (Public)
39d39619c   Ryan Glover   Add automatic acc...
142
  ```
aa8376fb4   Ryan Glover   Add basic README ...
143

95a4bb32c   Ryan Glover   Stylistic improve...
144
  A UI helper called `currentRoute` has been added to Base which allows you to add an `active` class to menu items in your navigation to reflect the user's current location.
45fadbd0b   Ryan Glover   Add UI helper to ...
145

f12d9dc25   Ryan Glover   Update README to ...
146
  A collection of hooks has also been added to Base to control route access based on different conditions (e.g. whether a user is logged in or not).
033f96299   Ryan Glover   Update README wit...
147
  ###### Authentication
95a4bb32c   Ryan Glover   Stylistic improve...
148
  Base includes a complete authentication pattern complete with:
39d39619c   Ryan Glover   Add automatic acc...
149

510619f55   Ryan Glover   Clean up document...
150
  - Login (at /login)
d36bdd404   Ryan Glover   Update README.md ...
151
  - Logout (no path, implemented as a dropdown item/click event in /client/controllers/header.js)
510619f55   Ryan Glover   Clean up document...
152
  - Password Recovery (at /recover-password and /reset-password)
95a4bb32c   Ryan Glover   Stylistic improve...
153
  - Signup (at /signup)
39d39619c   Ryan Glover   Add automatic acc...
154

f12d9dc25   Ryan Glover   Update README to ...
155
156
  ###### Example Collection/Publication/Subscription
  Base includes a collection called `Example`, along with a publication and subscription pattern to show moving data from the server to the client. Publications are defined in `/server/publications/example.js` and a subscription is demonstrated on the `index` route in `/client/routes/routes-authenticated.js`.
8391001a9   Ryan Glover   Update README to ...
157

10b1a6f3d   Ryan Glover   Update documentat...
158
  ###### Validation
95a4bb32c   Ryan Glover   Stylistic improve...
159
  Base includes support for client-side validation via [jQuery Validation](http://jqueryvalidation.org). Validation is provided for all public templates: login, signup, recover password, and reset password.
033f96299   Ryan Glover   Update README wit...
160

8391001a9   Ryan Glover   Update README to ...
161
162
  ###### Alerts
  Base includes support for fixed bar (top and bottom) and growl-style alerts on the client via [`themeteorchef:bert`](https://atmospherejs.com/themeteorchef/bert).
39d39619c   Ryan Glover   Add automatic acc...
163
  ###### Automatic Admin User Creation
d36bdd404   Ryan Glover   Update README.md ...
164
  When developing, having a handful of user accounts to test your application with can come in handy. Base comes with an automated account generation script located in `server/admin/startup.js` that creates accounts based on an array of specified users. **Note: by default this creates one Admin user on server startup, so make sure to customize or remove this user so the public can't access your app**.