Skip to content

Commit

Permalink
more bitcentive
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed Jan 12, 2017
2 parents f10c169 + 5101f44 commit 79e75a8
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 145 deletions.
17 changes: 14 additions & 3 deletions docs/about.md
Expand Up @@ -7,7 +7,6 @@

<img src="http://blog.bitovi.com/wp-content/uploads/2015/10/donejs-logo-ie.png"/>


DoneJS' goal is to help the JavaScript community get amazing applications done fast.
Amazing applications are fast, sublimely usable, and maintainable.

Expand Down Expand Up @@ -202,6 +201,18 @@ Mohamed Cherif BOUCHELAGHEM from Algiers, Algeria, almost a server side develope

</div>


<div class="core-team-member">
<img class="member-avatar" src="https://avatars1.githubusercontent.com/u/5851984?v=3&s=300"/>
<h4>Kevin Phillips</h4>
<p>
Kevin is based in Chicago (well, close enough). He wants to make it easy for anyone to get started with DoneJS and will work on features that help solve complex problems.
</p>
<a href="https://twitter.com/kdotphil" target="_blank">@kdotphil</a>
<a href="https://github.com/phillipskevin" target="_blank">Github</a>

</div>

### Fulltime team

There are currently 3 fulltime contributors to DoneJS and its subprojects:
Expand Down Expand Up @@ -241,8 +252,8 @@ Matthew, keeper of beards, is the lead maintainer of StealJS and its related too

### Sponsors

If you'd like to support the development of DoneJS, please find available options on our [Patreon page](https://www.patreon.com/donejs). If you have other ideas, or would like to customize your support,
If you'd like to support the development of DoneJS, please find available options on our [Patreon page](https://www.patreon.com/donejs). If you have other ideas, or would like to customize your support,
please [email us](mailto:contact@bitovi.com).


Bitovi, a JavaScript consulting company, is the primary sponsor of DoneJS.
Bitovi, a JavaScript consulting company, is the primary sponsor of DoneJS.
72 changes: 70 additions & 2 deletions docs/guides/bitcentive.md
@@ -1,3 +1,4 @@
<<<<<<< HEAD
@page bitcentive Example: Bitcentive
@parent DoneJS
@hide sidebar
Expand All @@ -8,7 +9,7 @@ In this guide, you'll learn how [Bitcentive](http://bitcentive.herokuapp.com) -
Specifically, this guide will walk through the implementation of the following behaviors or functionality:

- Working with document-based data structures (MongoDB).
- Registration, login, user sessions, and access rights with FeathersJS.
- Registration, login, user sessions, and access rights with FeathersJS and websockets.
- Using streams to manage state.

@body
Expand All @@ -19,6 +20,13 @@ Specifically, this guide will walk through the implementation of the following b

### Data Model and Service Layer

- Feathers
- feathers-mongoose
- only used for the model validation
- MongoDB
- Session Management: feathers-authentication
- Loosely using the word “session” feels fine unless you have experience with sessions on the server.

### Component Map

## Document data structures
Expand All @@ -28,6 +36,8 @@ ContributionMonth is nested ... nice to operate on items individually.
### Relationships

- Ref type
- Explain how we are using it.
- [https://v3.canjs.com/doc/can-connect/can/ref/ref.html](https://v3.canjs.com/doc/can-connect/can/ref/ref.html)

### Mutations on children

Expand All @@ -40,6 +50,12 @@ How do you setup this relationship? `added` and `removed`.
What do you do if a `monthlyClientProject` is created without an associated
contributionMonth?

### ContributionMonth uses

- MonthlyOSProject
- MonthlyClientProject
- MonthlyContributions

## Users, Sessions, and Access

### Behavior
Expand All @@ -48,4 +64,56 @@ contributionMonth?

## Streams

The hub and errors.

## GitHub Auth

### Client popup flow

- **Client**: Open popup window
- feathers-authentication-popups openLoginPopups()
- **Server**: direct popup to GitHub login window with configuration data on the server.
- feathers-authentication OAuth2 plugin
- **Client**: User grants access
- **Server**: middleware to handle popup returns a pre-made page to handle the success response
- feathers-authentication-popups express.js middleware
- **Client**: popup window sends “session” data (JWT) to the parent window.
- feathers-authentication-popups window.authAgent
- **Client**: Event streams in the main window respond to the session data
- can-stream
- **We get a JWT back in this process, let’s talk about JWTs, now**.

### JWTs

- Explaining the in a way that’s easy to understand is difficult.
- Give basic overview and provide links out to good sources for more information.
- We could get into the weeds and talk security
- How we avoid CSRF vulnerabilities while still using cookies.
- This would probably serve better as its own blog article with the diagrams that I made.


## Fixturizing WebSockets

### can-fixture-socket

- Intercepts [socket.io](http://socket.io) requests
- returns data from a fixture store
- can-set algebra
- link to blog article on fixture stores
- [https://v3.canjs.com/doc/can-fixture-socket.html](https://v3.canjs.com/doc/can-fixture-socket.html)

### steal-socket.io

- Needed in order to proxy and delay the socket for fixture use.
- [https://stealjs.github.io/stealjs/docs/steal-socket.io.html](https://stealjs.github.io/stealjs/docs/steal-socket.io.html)

### How to use socket fixtures in

- Tests
- Demos


## Permissions / Access Control

### Explain the high level permissions logic, setup / groups, etc

### How we used the JWT payload combined with feathers hooks to lock down the API server.
12 changes: 6 additions & 6 deletions docs/guides/generator.md
Expand Up @@ -21,7 +21,7 @@ It will also update the `npm test` script to run JSHint with our tests. You can

Currently it will only ask if we want to use spaces or tabs and to overwrite the `package.json` to add the npm scripts for JSHint:

<img src="http://blog.bitovi.com/wp-content/uploads/2016/03/Screen-Shot-2016-03-09-at-2.47.43-PM.png" alt="DoneJS generator" style="width: 100%;" class="alignnone size-full wp-image-3023" />
<img src="https://www.bitovi.com/hubfs/Imported_Blog_Media/Screen-Shot-2016-03-09-at-2_47_43-PM.png" alt="DoneJS generator" style="width: 100%;" class="alignnone size-full wp-image-3023" />

> __Note:__ Since `donejs-jshint` already exists we will use `donejs-<username>-jshint` with `<username>` being your GitHub username for the remainder of this article. Once published it can then be used as `donejs add <username>-jshint`.
Expand All @@ -36,7 +36,7 @@ If you don't have an account yet, go to [GitHub](https://github.com/join) to sig

Calling the repository `donejs-<username>-jshint` and initializing it empty (without any of the default files) looks like this:

<img src="http://blog.bitovi.com/wp-content/uploads/2016/04/generator-repository1.png" alt="generator-repository" style="width: 100%;" class="alignnone size-full wp-image-3077" />
<img src="http://www.bitovi.com/hubfs/Imported_Blog_Media/generator-repository1.png" alt="generator-repository" style="width: 100%;" class="alignnone size-full wp-image-3077" />

After creating the repository, clone it into a new folder:

Expand Down Expand Up @@ -73,7 +73,7 @@ The generator will ask several question that should be answered as follows:

Once all done, the final prompt looks similar to this:

<img src="http://blog.bitovi.com/wp-content/uploads/2016/04/generator-init.png" alt="generator-init" style="width: 100%;" class="alignnone size-full wp-image-3050" />
<img src="http://www.bitovi.com/hubfs/Imported_Blog_Media/generator-init.png" alt="generator-init" style="width: 100%;" class="alignnone size-full wp-image-3050" />

Now the generator will initialize the default layout and install all its dependencies.

Expand All @@ -91,7 +91,7 @@ This command can also be used to automatically run the tests on a [continuous in

We will use Travis CI as our hosted solution because it is free for open source projects. It works with your GitHub account which it will use to sign up. Once signed in, go to `Accounts` (in the dropdown under you name) to enable the `donejs-<username>-jshint` repository:

<img src="http://blog.bitovi.com/wp-content/uploads/2016/04/generator-travis.png" alt="generator-travis" style="width: 100%;" class="alignnone size-full wp-image-3054" />
<img src="http://www.bitovi.com/hubfs/Imported_Blog_Media/generator-travis.png" alt="generator-travis" style="width: 100%;" class="alignnone size-full wp-image-3054" />

You may have to click the *"Sync account"* button for the repository to show up. Now, every time we push to GitHub the tests will run automatically. We can do so with our initial commit:

Expand Down Expand Up @@ -338,11 +338,11 @@ Although we are working on the generator by ourselves for now, [GitHub pull requ

And then create a new pull request by going to `https://github.com/<username>/donejs-<username>-jshint` which will now show an option like this:

<img src="http://blog.bitovi.com/wp-content/uploads/2016/04/generator-pr.png" alt="generator-pr" style="width: 100%;" class="alignnone size-full wp-image-3055" />
<img src="http://www.bitovi.com/hubfs/Imported_Blog_Media/generator-pr.png" alt="generator-pr" style="width: 100%;" class="alignnone size-full wp-image-3055" />

Once you created the pull request, you will see a `Some checks haven’t completed yet` message that will eventually turn green:

<img src="http://blog.bitovi.com/wp-content/uploads/2016/04/generator-pull-request.png" alt="generator-pull-request" style="width: 100%;" class="alignnone size-full wp-image-3056" />
<img src="http://www.bitovi.com/hubfs/Imported_Blog_Media/generator-pull-request.png" alt="generator-pull-request" style="width: 100%;" class="alignnone size-full wp-image-3056" />

Now you can click the "Merge pull request" button. Then in the console, checkout the *master* branch and pull down the latest changes with:

Expand Down
24 changes: 8 additions & 16 deletions docs/guides/guide.md
Expand Up @@ -326,7 +326,7 @@ Now that we verified that our application works in production, we can deploy it

### Set up Firebase

Sign up for free at [Firebase](https://www.firebase.com/). After you have an account go to [the account page](https://www.firebase.com/account/) and create an app called `donejs-chat-<user>` where `<user>` is your GitHub username. Write down the name of your app because you'll need it in the next section.
Sign up for free at [Firebase](https://firebase.google.com/). After you have an account go to [Firebase console](https://console.firebase.google.com/) and create an app called `donejs-chat-<user>` where `<user>` is your GitHub username. Write down the name of your app because you'll need it in the next section.

> You'll get an error if your app name is too long, so pick something on the shorter side.
Expand All @@ -336,25 +336,17 @@ When you deploy for the first time it will ask you to authorize, but first we ne

Now we can add the Firebase deployment configuration to our `package.json` like this:

@sourceref guides/guide/steps/16-cdn/deploy.json

Change the `<appname>` to the name of the application created when you set up the Firebase app.
```
donejs add firebase
```

And also update the production `baseURL` in the `system` section:
When prompted, enter the name of the application created when you set up the Firebase app. Before you can deploy your app you need to login and authorize the Firebase tools, which you can do with:

```
...
"system": {
...
"envs": {
"server-production": {
"renderingBaseURL": "https://<appname>.firebaseapp.com/"
}
}
}
node_modules/.bin/firebase login
```

Again, make sure to replace the URL with your Firebase application name. Then we can deploy the application by running:
Then we can deploy the application by running:

```
donejs build
Expand All @@ -363,7 +355,7 @@ donejs deploy

Static files are deployed to Firebase.

<img src="static/img/donejs-firebase.png" alt="two browsers" style="box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2); border-radius: 5px; border: 1px #E7E7E7 solid;" />
<img src="static/img/donejs-firebase.png" alt="two browsers" />

And verify that the application is loading from the CDN by loading it after running:

Expand Down

0 comments on commit 79e75a8

Please sign in to comment.