SlideShare ist ein Scribd-Unternehmen logo
1 von 20
John Culviner
GitHub: github.com/johnculviner
Blog: johnculviner.com
Twitter: @johnculviner
Email: john@johnculviner.com
+
About Me
 Independent Consultant @ BestBuy
 Backend
 DevOps (Docker, Ansible, Linux etc)
 Node.js
 NoSql (ElasticSearch, MongoDB)
 C# .NET
 Groovy/Spring/Java
 MS-SQL/MySQL
 Front End
 Manual, jQuery, Knockout.js, Durandal.js, Ember.js, Angular.js, Aurelia, React.js
 SPA development
 Open Source “Street Cred”
 AngularAgility
 jQuery File Download
 FluentKnockoutHelpers
Overview
 What is Node.js & what's it good for?
 vs .NET, Java etc.
 What is MongoDB & what's it good for?
 vs YOUR_FAV_SQL_DB_HERE
 Building a CMS from scratch
 Environment setup
 Simple API Endpoint
 Objective: What you should and shouldn't use this
stack for. To help you on your feet nice and easy!
What is ?
 Node.js is a JavaScript runtime built on Chrome's V8
JavaScript engine.
 It's like Chrome but it has framework modules that make
it useful on a server
Assertion
Testing
Buffer C/C++ Addons Child
Processes
Cluster Console
Crypto Debugger DNS Domain Errors Events
File System
Globals HTTP HTTPS Modules Net
OS Path Process Punycode Query Strings Readline
REPL Stream String Decoder Timers TLS/SSL TTY
UDP/Datagra
m
URL Utilities V8 VM ZLIB
 Node.js' package ecosystem, npm (node package
manager), is the largest ecosystem of open source
libraries in the world. modulecounts.com
What is ?
 Node.js uses an event-driven, non-blocking I/O model
that makes it lightweight and efficient.
 Single threaded event loop just like the browser
JavaScript you know and ¿love?
Event loop?
 EVERYTHING that is I/O bound blocking in Node.js is
async
 Node FORCES you to deal with I/O bound nature of
most of the apps we build* up front rather than
adding parallelization later on….
*by we I mean me and likely 90% of you
CPU bound?
 Don't block the single thread or else your app
will grind to a halt
 Think of times a website has locked up your
browser’s UI Classic while true
CPU intensive operations
Stack overflow
SUPER efficient with pipes
Actual entire node application
Why do I care ¯_(ツ)_/¯
 Allegedly (when
they aren’t using
Go)
--------------------------Big places in town you could work for ------------------------------
 Places with my
crappy Node code
in production 
Node.js - Good, Bad
 GOOD
 Web(like) applications that are limited
by I/O blocking (DB, backend service, file system, etc.
calls).
 Micro-services
 Moving data around/transforming data
 Rapid application development
 BAD
 Large, monolithic ‘enterprisey’
applications (strong typing *can* be nice)
 CPU intensive apps (you'll block the event loop and JS is
slow(er) than .NET, JVM, C++, etc.)
 You don’t think JavaScript is a “real” language
What is
 A “NoSQL” BSON (binary JSON) document DB
 Indexable, deep queryable, map-reduce aggregations
 Sharding – for data distribution “Scale out” on a shard key
(usually the document ID)
 Replication– for instance failure ‘safety’
Example
Shard Cluster (not required!)
Server A Server B
{ _id: ‘UUID’,
customerName: ‘Foo’
customerDomain ‘foo.com’
….}, {/*cust.*/},{/*cust.*/}
Collections
Pages
Cutomers
{ _id: ‘UUID’,
customerId: ‘UUID’
url: ‘/someurl’,
widgets: [
{name: ‘WidgetA’ /*settings*/},
{name: ‘WidgetB’, /*settings*/}
]
…..}, {/*page*/}, {/*page*/}…..
- Similar BSON documents
that end up here due to a
differing shard key from left
- BSON documents WITHIN
A COLLECTION can have
a varying schema! (but in
practice that might be a
bad idea)
Actual* email from MongoDB….
*minus the bro
part
Cutting through the BS…
 NoSQL works well for apps with few
“Aggregate Roots”
 “A group/cluster of objects that work together, are treated as
a unit that must remain consistent together”
Martin Fowler
likes aggregate
roots
Good use case
Pages
have Sections
have Widgets
have Settings
- settings might contain
nested object graphs etc.
• Only operate on a page
(read/write) as an atomic unit
• Duplication of data is small if
not non existent
Bad use case
Customers
Orders
LineItems
Products
Customer
Categories
Merchant
Categories
Vendors
• “Spiderweb” of relationships that
duplicate in a JOIN
• Care about operating on various “entities”
individually or within the bounds of an
atomic transaction
Random DB observations
 Why not BOTH relational and Document?
 Stores JSON natively and is querable/indexable!

 queries get slow in the millions of objects in a collection (w/o
index)
 Server side joins just added in version 3.2 (latest)
 ElasticSearch
 Built on Apache Lucene (just like Solr)
 Insanely fast search, data retrieval and full text queries
 Insanely fast n-levels deep aggregations and custom Groovy
scripts
 Very easy clustering/sharding/replication. Scale out!
Before we code…
 Tooling we are using:
 JetBrains IntelliJ/Webstorm
 NodeJS 6.3
 MongoDB 3.x
 iTerm + oh-my-zsh (z-shell)
 RoboMongo (the Mongo GUI)
 Install on *NIX
 [brew|apt-get|yum|etc..] install [mongodb|nodejs]
 Install on Windows
 Download MSIs/EXEs from respective websites
Node REPL
V8 JavaScript engine in
Node.js 4+ and Chrome
45+ supports string
templating and
LAMBDAS (w00t)
Okay seriously code now…
Questions/Comments?
John Culviner
GitHub: github.com/johnculviner
Blog: johnculviner.com
Twitter: @johnculviner
Email: john@johnculviner.com

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire dotCloud
 
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerShipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerJérôme Petazzoni
 
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena TapiaFrom Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena TapiaDocker, Inc.
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App EngineDocker, Inc.
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013dotCloud
 
Docker and java, at Montréal JUG
Docker and java, at Montréal JUGDocker and java, at Montréal JUG
Docker and java, at Montréal JUGAnthony Dahanne
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and DockerPaolo latella
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewiredotCloud
 
Dockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterDockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterdotCloud
 
Docker presentation | Paris Docker Meetup
Docker presentation | Paris Docker MeetupDocker presentation | Paris Docker Meetup
Docker presentation | Paris Docker MeetupdotCloud
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Carlos Sanchez
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...Docker, Inc.
 
Docker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XJérôme Petazzoni
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryUsing Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryCarlos Sanchez
 
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015Codemotion
 
Dockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec KraloveDockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec Kralovedamovsky
 
Docker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registryDocker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registrydotCloud
 

Was ist angesagt? (20)

Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
 
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerShipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with Docker
 
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena TapiaFrom Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery Workshop
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App Engine
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
 
Docker and java, at Montréal JUG
Docker and java, at Montréal JUGDocker and java, at Montréal JUG
Docker and java, at Montréal JUG
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and Docker
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
 
Dockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterDockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @Twitter
 
Docker presentation | Paris Docker Meetup
Docker presentation | Paris Docker MeetupDocker presentation | Paris Docker Meetup
Docker presentation | Paris Docker Meetup
 
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12X
 
Using Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous DeliveryUsing Kubernetes for Continuous Integration and Continuous Delivery
Using Kubernetes for Continuous Integration and Continuous Delivery
 
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
 
Dockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec KraloveDockerize the World - presentation from Hradec Kralove
Dockerize the World - presentation from Hradec Kralove
 
Docker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registryDocker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registry
 

Ähnlich wie Node.js and MongoDB from scratch, fully explained and tested

Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlightsdswork
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptAndrew Lovett-Barron
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17Jared Faris
 
Publishing strategies for API documentation
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentationTom Johnson
 
Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)Benjamin Howarth
 
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...Bojan Veljanovski
 
Super Sizing Youtube with Python
Super Sizing Youtube with PythonSuper Sizing Youtube with Python
Super Sizing Youtube with Pythondidip
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by GoogleASG
 
Viacheslav Eremin interview about DOT NET (eng lang)
Viacheslav Eremin interview about DOT NET (eng lang)Viacheslav Eremin interview about DOT NET (eng lang)
Viacheslav Eremin interview about DOT NET (eng lang)Viacheslav Eremin
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
 
Building Cloud-Native Applications with Microsoft Windows Azure
Building Cloud-Native Applications with Microsoft Windows AzureBuilding Cloud-Native Applications with Microsoft Windows Azure
Building Cloud-Native Applications with Microsoft Windows AzureBill Wilder
 
DevOne - How to not fail with Azure
DevOne - How to not fail with AzureDevOne - How to not fail with Azure
DevOne - How to not fail with AzureMartin Gutenbrunner
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Pierre Joye
 

Ähnlich wie Node.js and MongoDB from scratch, fully explained and tested (20)

Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlights
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate Javascript
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17
 
Publishing strategies for API documentation
Publishing strategies for API documentationPublishing strategies for API documentation
Publishing strategies for API documentation
 
Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)Canopy view of single-page applications (SPAs)
Canopy view of single-page applications (SPAs)
 
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
AngularJS + NancyFx + MongoDB = The best trio for ultimate SPA by Bojan Velja...
 
Os Solomon
Os SolomonOs Solomon
Os Solomon
 
Super Sizing Youtube with Python
Super Sizing Youtube with PythonSuper Sizing Youtube with Python
Super Sizing Youtube with Python
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
Viacheslav Eremin interview about DOT NET (eng lang)
Viacheslav Eremin interview about DOT NET (eng lang)Viacheslav Eremin interview about DOT NET (eng lang)
Viacheslav Eremin interview about DOT NET (eng lang)
 
MyReplayInZen
MyReplayInZenMyReplayInZen
MyReplayInZen
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
What is mean stack?
What is mean stack?What is mean stack?
What is mean stack?
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
 
Building Cloud-Native Applications with Microsoft Windows Azure
Building Cloud-Native Applications with Microsoft Windows AzureBuilding Cloud-Native Applications with Microsoft Windows Azure
Building Cloud-Native Applications with Microsoft Windows Azure
 
DevOne - How to not fail with Azure
DevOne - How to not fail with AzureDevOne - How to not fail with Azure
DevOne - How to not fail with Azure
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
 
CouchDB
CouchDBCouchDB
CouchDB
 

Kürzlich hochgeladen

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Kürzlich hochgeladen (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

Node.js and MongoDB from scratch, fully explained and tested

  • 1. John Culviner GitHub: github.com/johnculviner Blog: johnculviner.com Twitter: @johnculviner Email: john@johnculviner.com +
  • 2. About Me  Independent Consultant @ BestBuy  Backend  DevOps (Docker, Ansible, Linux etc)  Node.js  NoSql (ElasticSearch, MongoDB)  C# .NET  Groovy/Spring/Java  MS-SQL/MySQL  Front End  Manual, jQuery, Knockout.js, Durandal.js, Ember.js, Angular.js, Aurelia, React.js  SPA development  Open Source “Street Cred”  AngularAgility  jQuery File Download  FluentKnockoutHelpers
  • 3. Overview  What is Node.js & what's it good for?  vs .NET, Java etc.  What is MongoDB & what's it good for?  vs YOUR_FAV_SQL_DB_HERE  Building a CMS from scratch  Environment setup  Simple API Endpoint  Objective: What you should and shouldn't use this stack for. To help you on your feet nice and easy!
  • 4. What is ?  Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.  It's like Chrome but it has framework modules that make it useful on a server Assertion Testing Buffer C/C++ Addons Child Processes Cluster Console Crypto Debugger DNS Domain Errors Events File System Globals HTTP HTTPS Modules Net OS Path Process Punycode Query Strings Readline REPL Stream String Decoder Timers TLS/SSL TTY UDP/Datagra m URL Utilities V8 VM ZLIB
  • 5.  Node.js' package ecosystem, npm (node package manager), is the largest ecosystem of open source libraries in the world. modulecounts.com
  • 6. What is ?  Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.  Single threaded event loop just like the browser JavaScript you know and ¿love?
  • 7. Event loop?  EVERYTHING that is I/O bound blocking in Node.js is async  Node FORCES you to deal with I/O bound nature of most of the apps we build* up front rather than adding parallelization later on…. *by we I mean me and likely 90% of you
  • 8. CPU bound?  Don't block the single thread or else your app will grind to a halt  Think of times a website has locked up your browser’s UI Classic while true CPU intensive operations Stack overflow
  • 9. SUPER efficient with pipes Actual entire node application
  • 10. Why do I care ¯_(ツ)_/¯  Allegedly (when they aren’t using Go) --------------------------Big places in town you could work for ------------------------------  Places with my crappy Node code in production 
  • 11. Node.js - Good, Bad  GOOD  Web(like) applications that are limited by I/O blocking (DB, backend service, file system, etc. calls).  Micro-services  Moving data around/transforming data  Rapid application development  BAD  Large, monolithic ‘enterprisey’ applications (strong typing *can* be nice)  CPU intensive apps (you'll block the event loop and JS is slow(er) than .NET, JVM, C++, etc.)  You don’t think JavaScript is a “real” language
  • 12. What is  A “NoSQL” BSON (binary JSON) document DB  Indexable, deep queryable, map-reduce aggregations  Sharding – for data distribution “Scale out” on a shard key (usually the document ID)  Replication– for instance failure ‘safety’
  • 13. Example Shard Cluster (not required!) Server A Server B { _id: ‘UUID’, customerName: ‘Foo’ customerDomain ‘foo.com’ ….}, {/*cust.*/},{/*cust.*/} Collections Pages Cutomers { _id: ‘UUID’, customerId: ‘UUID’ url: ‘/someurl’, widgets: [ {name: ‘WidgetA’ /*settings*/}, {name: ‘WidgetB’, /*settings*/} ] …..}, {/*page*/}, {/*page*/}….. - Similar BSON documents that end up here due to a differing shard key from left - BSON documents WITHIN A COLLECTION can have a varying schema! (but in practice that might be a bad idea)
  • 14. Actual* email from MongoDB…. *minus the bro part
  • 15. Cutting through the BS…  NoSQL works well for apps with few “Aggregate Roots”  “A group/cluster of objects that work together, are treated as a unit that must remain consistent together” Martin Fowler likes aggregate roots Good use case Pages have Sections have Widgets have Settings - settings might contain nested object graphs etc. • Only operate on a page (read/write) as an atomic unit • Duplication of data is small if not non existent Bad use case Customers Orders LineItems Products Customer Categories Merchant Categories Vendors • “Spiderweb” of relationships that duplicate in a JOIN • Care about operating on various “entities” individually or within the bounds of an atomic transaction
  • 16. Random DB observations  Why not BOTH relational and Document?  Stores JSON natively and is querable/indexable!   queries get slow in the millions of objects in a collection (w/o index)  Server side joins just added in version 3.2 (latest)  ElasticSearch  Built on Apache Lucene (just like Solr)  Insanely fast search, data retrieval and full text queries  Insanely fast n-levels deep aggregations and custom Groovy scripts  Very easy clustering/sharding/replication. Scale out!
  • 17. Before we code…  Tooling we are using:  JetBrains IntelliJ/Webstorm  NodeJS 6.3  MongoDB 3.x  iTerm + oh-my-zsh (z-shell)  RoboMongo (the Mongo GUI)  Install on *NIX  [brew|apt-get|yum|etc..] install [mongodb|nodejs]  Install on Windows  Download MSIs/EXEs from respective websites
  • 18. Node REPL V8 JavaScript engine in Node.js 4+ and Chrome 45+ supports string templating and LAMBDAS (w00t)
  • 20. Questions/Comments? John Culviner GitHub: github.com/johnculviner Blog: johnculviner.com Twitter: @johnculviner Email: john@johnculviner.com