Build your own trello witihin 100 LOC (with Meteor)

Andy Dai
Andy DaiDeveloper at Dorm7 Software
Build your Own Trello
within 200100 LOC
Andy Dai
andy@dorm7.com
1
Who am I?
• Staff@PyCon Taiwan
• co-author@iCoding.co
• 寫 Python 比較多...
2
Andy
Trello
3
Trello
• Project Management Tool
3
Trello
• Project Management Tool
• Real-time Web APP
3
Trello
• Project Management Tool
• Real-time Web APP
• 來看個 Demo 好了...
3
A Real-Time Web APP
• Backbone.js
• HTML5 pushstate
• Mustache template
• Socket.io and websocket
• Ajax Polling
• node.js
• MongoDB
Reference: http://blog.fogcreek.com/the-trello-tech-stack/
4
Trallo - clone of Trello
5
Trallo - clone of Trello
• Demo - http://bit.ly/trallo
5
Trallo - clone of Trello
• Demo - http://bit.ly/trallo
• 59 LOC for template + 96 LOC for js
5
HOW?
6
USE Meteor!
7
Meteor
• http://www.meteor.com
• 9292 stars in Github (most among JS
projects in 2012)
• Real-Time Web Framework
• 2011/12/01 First Preview
8
Seven Principles of
Meteor
9
Data on the Wire
10
One Language
11
Database Everywhere
12
Latency Compensation
13
Full Stack Reactivity
14
Embrace the Ecosystem
15
Simplicity Equals
Productivity
16
Get Start!
17
Install
$ curl install.meteor.com | sh
Create Project
$ meteor create trallo
18
Meteor Project
$ cd trallo
$ meteor
Run Meteor Project
19
Meteor Project
.meteor
trallo.css
trallo.html
trallo.js
Project Structure
$ cd trallo
$ meteor
Run Meteor Project
19
trallo.js
// The Code here will run in both client & Server
Cards = new Meteor.Collection("cards");
if (Meteor.is_client) {
...
}
if (Meteor.is_server) {
...
}
20
Template
21
Handlebars.js
<template name="todo">
{{#each todos }}
{{> card }}
{{/each }}
</template>
<template name="card">
<li id="{{ _id }}" class="card ui-state-default"
data-status="{{ status }}">
{{ task }} <a class="edit" href='#'>edit</a>
</li>
</template>
22
Template Helpers
if (Meteor.is_client) {
Template.todo.helpers({
todos: ...
});
...
}
<template name="todo">
{{#each todos }}
{{> card }}
{{/each }}
</template>
<template name="card">
<li id="{{ _id }}" class="card ui-state-default"
data-status="{{ status }}">
{{ task }} <a class="edit" href='#'>edit</a>
</li>
</template>
23
Data
24
Meteor Use MongoDB
as database
25
Client Side - miniMongo
Cards = new Meteor.Collection("cards");
if (Meteor.is_client) {
Template.todo.helpers({
todos: Cards.find(
{status:'todo'},
{sort: {position: 1, task: 1}}
)
});
}
if (Meteor.is_server) {
...
}
26
Server Side
Cards = new Meteor.Collection("cards");
if (Meteor.is_client) {
...
}
if (Meteor.is_server) {
if ( Cards.find().count() === 0) {
Cards.insert({
task: 'One',
status: 'todo',
position: 1
});
}
}
27
Event
28
Event Handler
if (Meteor.is_client) {
...
Template.board.events = {
"click .edit": function() {
...
}
}
...
}
29
Deploy
meteor deploy http://trallo.meteor.com
meteor bundle trallo.tar.gz
Deploy to Meteor.com
Deploy to your own server
30
DEMO
31
小結
32
• Meteor is GOOD!
• 目前版號 0.6.4.1, 所以...
工商服務
• iCoding.co 徵稿中
• COSCUP 有 Python.tw 攤位
• 歡迎來 Taipei.py 玩玩
33
Q&A
34
35
• Meteor 初體驗 http://bit.ly/17q7RaA http://
bit.ly/17q7U6n
• Discover Meteor
www.discovermeteor.com
Reference
1 of 41

More Related Content

What's hot(18)

Pengenalan AngularJSPengenalan AngularJS
Pengenalan AngularJS
Edi Santoso405 views
Introduction to PolymerIntroduction to Polymer
Introduction to Polymer
Egor Miasnikov752 views
jQuery in 15 minutesjQuery in 15 minutes
jQuery in 15 minutes
Simon Willison41.5K views
Ext JS IntroductionExt JS Introduction
Ext JS Introduction
Anand Dayalan2.2K views
AngularJS and SPAAngularJS and SPA
AngularJS and SPA
Lorenzo Dematté1.3K views
Fluent Python - Chapter 15Fluent Python - Chapter 15
Fluent Python - Chapter 15
Sunghyun Lee50 views
Drupal node access system & AUL 7.x.-2.xDrupal node access system & AUL 7.x.-2.x
Drupal node access system & AUL 7.x.-2.x
Oleksandr Milkovskyi2.7K views
Modules and injectorModules and injector
Modules and injector
Eyal Vardi7.7K views
Open SelectorOpen Selector
Open Selector
jjdelc333 views
Backbone jsBackbone js
Backbone js
husnara mohammad209 views
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponents
Cyril Balit3.6K views

Viewers also liked(6)

Trello - University of St Andrews web teamTrello - University of St Andrews web team
Trello - University of St Andrews web team
Gareth Saunders5.8K views
FirehoseFirehose
Firehose
Luca Grulla2.1K views
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema Design
MongoDB25.5K views

Similar to Build your own trello witihin 100 LOC (with Meteor)

Node azureNode azure
Node azureEmanuele DelBono
1.6K views66 slides

Similar to Build your own trello witihin 100 LOC (with Meteor)(20)

More from Andy Dai

Grpc + python.keyGrpc + python.key
Grpc + python.keyAndy Dai
240 views23 slides
Power UP your CLIPower UP your CLI
Power UP your CLIAndy Dai
241 views23 slides
Search search searchSearch search search
Search search searchAndy Dai
595 views24 slides
Django channelsDjango channels
Django channelsAndy Dai
3.1K views27 slides

More from Andy Dai(17)

Grpc + python.keyGrpc + python.key
Grpc + python.key
Andy Dai240 views
Power UP your CLIPower UP your CLI
Power UP your CLI
Andy Dai241 views
Search search searchSearch search search
Search search search
Andy Dai595 views
Django channelsDjango channels
Django channels
Andy Dai3.1K views
Django Third party packagesDjango Third party packages
Django Third party packages
Andy Dai908 views
Practical django secuirtyPractical django secuirty
Practical django secuirty
Andy Dai613 views
總之來講講 Search總之來講講 Search
總之來講講 Search
Andy Dai847 views
Python web meetup 11 18Python web meetup 11 18
Python web meetup 11 18
Andy Dai513 views
ElastiCacheElastiCache
ElastiCache
Andy Dai1K views
Dynamo dbDynamo db
Dynamo db
Andy Dai2.1K views
Django deployDjango deploy
Django deploy
Andy Dai1.5K views

Recently uploaded(20)

CXL at OCPCXL at OCP
CXL at OCP
CXL Forum203 views
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptx
Hajira Mahmood21 views
ChatGPT and AI for Web DevelopersChatGPT and AI for Web Developers
ChatGPT and AI for Web Developers
Maximiliano Firtman161 views
The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)
CSUC - Consorci de Serveis Universitaris de Catalunya59 views
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
METHOD AND SYSTEM FOR PREDICTING OPTIMAL LOAD FOR WHICH THE YIELD IS MAXIMUM ...
Prity Khastgir IPR Strategic India Patent Attorney Amplify Innovation24 views
Java Platform Approach 1.0 - Picnic MeetupJava Platform Approach 1.0 - Picnic Meetup
Java Platform Approach 1.0 - Picnic Meetup
Rick Ossendrijver24 views

Build your own trello witihin 100 LOC (with Meteor)