Blame view
README.md
8.79 KB
043f0b290
|
1 |
# The Meteor Chef - Base (@1.0.4.2) |
aa8376fb4
|
2 |
A starting point for Meteor apps. |
8435208bb
|
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
|
4 |
|
7becce2b9
|
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
|
6 |
|
aa8376fb4
|
7 |
### Packages Included |
d30971538
|
8 9 10 |
- Accounts (Base) - `meteor add accounts-base` - Accounts (Password) - `meteor add accounts-password` - Audit Argument Checks - `meteor add audit-argument-checks` |
8391001a9
|
11 |
- Bert - `meteor add themeteorchef:bert` |
021324406
|
12 |
- Bootstrap 3 - `meteor add twbs:bootstrap` |
f12d9dc25
|
13 |
- Browser Policy - `meteor add browser-policy` |
d30971538
|
14 |
- Check - `meteor add check` |
07610a42f
|
15 16 |
- Handlebars Server - `meteor add cmather:handlebars-server` - Iron Router - `meteor add iron:router` |
d30971538
|
17 |
- jQuery - `meteor add jquery` |
10b1a6f3d
|
18 |
- jQuery Validation - `meteor add themeteorchef:jquery-validation` |
f12d9dc25
|
19 |
- NPM - `meteor add meteorhacks:npm` |
dfcb49d75
|
20 |
- Sass - `meteor add particle4dev:sass@0.3.0` |
d30971538
|
21 |
- Underscore - `meteor add underscore` |
aa8376fb4
|
22 |
|
f12d9dc25
|
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
|
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
|
29 |
---/.meteor |
d1f4dbea8
|
30 31 |
---/client ------/controllers |
39a8af161
|
32 |
---------/authenticated |
d36bdd404
|
33 |
------------header.js |
d1f4dbea8
|
34 |
---------/public |
d36bdd404
|
35 |
------------login.js |
d36bdd404
|
36 37 |
------------recover-password.js ------------reset-password.js |
95a4bb32c
|
38 |
------------signup.js |
d1f4dbea8
|
39 |
------/helpers |
d36bdd404
|
40 |
---------helpers-ui.js |
39a8af161
|
41 42 |
------/includes ---------_header.html |
d1f4dbea8
|
43 44 45 |
------/layouts ---------layout-default.html ------/routes |
f12d9dc25
|
46 |
---------hooks.js |
d36bdd404
|
47 |
---------routes-authenticated.js |
95a4bb32c
|
48 |
---------routes-global.js |
d36bdd404
|
49 |
---------routes-public.js |
d1f4dbea8
|
50 |
------/stylesheets |
07610a42f
|
51 52 53 |
---------/sass ------------/globals ---------------_extends.scss |
07610a42f
|
54 |
------------/views |
07610a42f
|
55 56 57 |
---------------/public ------------------_login.scss ---------application.scss |
cabe1c46e
|
58 |
-------/views |
39d39619c
|
59 60 |
---------/authenticated ------------index.html |
cabe1c46e
|
61 |
---------/public |
f12d9dc25
|
62 |
------------loading.html |
cabe1c46e
|
63 |
------------login.html |
07610a42f
|
64 |
------------not-found.html |
cabe1c46e
|
65 66 67 |
------------recover-password.html ------------reset-password.html ------------signup.html |
d1f4dbea8
|
68 |
---/collections |
d36bdd404
|
69 |
------example.js |
f12d9dc25
|
70 |
------users.js |
d1f4dbea8
|
71 |
---/packages |
39d39619c
|
72 |
------ (See List Above) |
d1f4dbea8
|
73 |
---/public |
c67f755ea
|
74 |
------/images |
d1f4dbea8
|
75 76 |
---/server ------/admin |
f12d9dc25
|
77 78 79 |
---------/startup-functions ------------browser-policies.js ------------test-accounts.js |
d36bdd404
|
80 |
---------startup.js |
07610a42f
|
81 |
|
07610a42f
|
82 |
---------/templates |
d36bdd404
|
83 |
------------reset-password.js |
6acecba62
|
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
|
95 |
------/publications |
f12d9dc25
|
96 |
---------example.js |
c67f755ea
|
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
|
107 |
``` |
d36bdd404
|
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
|
112 |
|
aa8376fb4
|
113 |
### Functionality |
7fa84d8b4
|
114 |
###### Configuration |
c67f755ea
|
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
|
116 |
|
c67f755ea
|
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
|
118 |
|
c67f755ea
|
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
|
127 |
|
95a4bb32c
|
128 |
###### Bootstrap (@3.2.1) |
f12d9dc25
|
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
|
130 |
|
95a4bb32c
|
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
|
132 |
|
39d39619c
|
133 |
###### Basic Routing |
95a4bb32c
|
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
|
135 136 137 138 |
``` - / (Authenticated) - /login (Public) |
39d39619c
|
139 140 |
- /recover-password (Public) - /reset-password (Public) |
95a4bb32c
|
141 |
- /signup (Public) |
39d39619c
|
142 |
``` |
aa8376fb4
|
143 |
|
95a4bb32c
|
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
|
145 |
|
f12d9dc25
|
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
|
147 |
###### Authentication |
95a4bb32c
|
148 |
Base includes a complete authentication pattern complete with: |
39d39619c
|
149 |
|
510619f55
|
150 |
- Login (at /login) |
d36bdd404
|
151 |
- Logout (no path, implemented as a dropdown item/click event in /client/controllers/header.js) |
510619f55
|
152 |
- Password Recovery (at /recover-password and /reset-password) |
95a4bb32c
|
153 |
- Signup (at /signup) |
39d39619c
|
154 |
|
f12d9dc25
|
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
|
157 |
|
10b1a6f3d
|
158 |
###### Validation |
95a4bb32c
|
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
|
160 |
|
8391001a9
|
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
|
163 |
###### Automatic Admin User Creation |
d36bdd404
|
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**. |