SlideShare a Scribd company logo
1 of 59
How to build a SaaS solution in
60 days using MeteorJS.
Brett McLain
Application Systems Architect
PotashCorp
About Me
• Application Systems Architect at PotashCorp
corporate office.
• Programming for 12 years.
• Married with a 20 month old son - free time
comes at a premium.
What am I going to talk about?
• Why I decided to build a SaaS solution.
• What is MeteorJS and why is it special?
• MongoDB
• Twilio
• Stripe
Background
• In 2009 I read this post on hackaday.com:
–http://hackaday.com/2010/01/15/gsm-car-
starter/
• The authors car starter had extremely poor range.
• He purchased a GSM controlled relay from China.
• Wired the relay to his car starters key fob.
• Calling the GSM relay would press the button on the
key fob.
hackaday.com device
Background
• My truck’s car starter was garbage as well.
• Purchased the same type of device from
China and implemented the same solution by
cannibalizing one of my car starters key fobs.
• Added a 12V adapter to plug into my
cigarette lighter.
My Device
Did others have the same problem
as me?
• Step 1 - Build a car starter.
• Step 2 - Buy some devices from China and put
them on eBay.
• Step 3 - Profit???
What else can these be used for?
• Common use cases for these devices are:
–Turning an irrigation pump on/off.
–Opening/closing a gate for gated communities.
–Starting a vehicle.
–Restarting remote servers.
–Wild animal traps (feral hogs).
• Sales grew over time: 3000+ devices sold and
nearly $500,000 in sales. Some customers are
operating over 100 devices.
Fast forward 4 years...problems...
• Customers were manually keeping track of
their devices in Excel spreadsheets.
• Each device has a “whitelist” of allowed
phone numbers that can call it. This list is
manually maintained in Excel as well.
• Complex syntax for SMS commands meant
that using these devices required training.
• Over one hundred different devices in their
contacts lists on multiple phones added
complexity.
Solution
• Build a centralized command and control web
application to manage these devices, send
and receive SMS & phone calls, abstract away
command complexity, control their
“whitelist”, monitor SMS usage, and review
audit logs.
Initial Requirements
• Needs to be a web application
– MEAN Stack (Mongo, Express.js, Angular JS, Node JS)
• Ideally can be compiled for mobile
– Phonegap
• Payments
– Paypal
• SMS & Phone Calls
– Twilio
• Reactive?
Quickly ran into problems…
• Needs to be a web application
– MEAN stack has a lot of moving parts.
– Need to establish patterns from the ground up.
• Ideally can be compiled for mobile
– Phonegap – good.
• Payments
– Paypal, frustrating test API/sandbox.
– Requires https to even begin testing on their modern API.
• SMS & Phone Calls
– Twilio – good.
• Reactive
– Didn’t know where to start.
MeteorJS to the rescue!
• Needs to be a web application
– MeteorJS provides a full cohesive stack right out of the box with
established patterns for everything.
• Mobile
– MeteorJS compiles to Phonegap.
• Payments
– Stripe.js is outrageously easy to use, same package as Node.js.
• SMS & Phone Calls
– Twilio uses same package as Node.js.
• Everything is reactive out of the box!
What is MeteorJS?
• Think of it as a skeleton into which a number
of components are inserted in a logical
manner to create a cohesive ecosystem for
application development.
• Out of the box it comes with most of what
you need, however you can swap out almost
any piece.
MeteorJS Features
• Compiling
–Isobuild Package Manager (coffeescript, less.js,
minifiers, templating compilation, npm packages,
cordova packages).
• Server Side
–Runs on Node.js.
–LiveQuery (Mongo or Redis) Replication Sets/oplog
tailing.
–Fibers/Futures for dealing with callback spaghetti.
MeteorJS Features
• Communication Layer
–DDP (Distributed Data Protocol)
–EJSON (Serializes Dates, Binary)
• Browser
–Tracker (backbone for reactivity).
–Iron router (routing).
–Blaze+Spacebars (templating).
–Minimongo.
–Hot Code Push.
–Session (reactive UI variables)
MongoDB Features
• Is a NoSQL, Document style database that
uses BSON (similar to JSON) for storing data.
• Has the concept of “databases”, and tables
(called collections).
• Strongly consistent (though that can be
changed).
• Sharding.
• High availability via replica sets.
MongoDB
MongoDB
MongoDB
So where to start?
• Tempting to just start building some initial
basic pages…
• Should really start with authentication first so
it’s baked in right from the start.
Authentication/Login
• Meteor provides an accounts package that
securely manages authentication for you.
• Install the base package to just use simple
username and password:
– meteor add accounts-base
– meteor add accounts-password
• Provides simple API’s for user creation, account
verification (email), login, password reset, and
forgotten password.
User Creation Code
Login Code
OAuth wut?
• Simple username and password is fine, but I
really love websites that allow me to use my
google account to login to their site. This is
called OAuth.
• “OAuth is an open standard for authorization,
commonly used as a way for internet users to
log into third party websites using their
Microsoft, Google, Facebook, or Twitter
accounts without exposing their password.” -
Wikipedia.
OAuth wut?
Google OAuth in 5 Minutes
• In MeteorJS you can implement Google
OAuth in less than 5 minutes.
• Step 1 -Add the accounts-google package:
–meteor add accounts-google
• Step 2 - Sign up for a google developer
account if you don’t already have one, then
go to the google developer console:
–https://console.developers.google.com/
• Step 3 - Create a project in the google
developer console.
Google OAuth in 5 Minutes
• Step 4 - Create OAuth client ID.
Google OAuth in 5 Minutes
• Step 5 - Add the OAuth keys to the MeteorJS
settings.json file. This makes them globally
accessible (private is server side only, public
is both client and server side).
Google OAuth in 5 Minutes
• Step 6 - Add the service configuration for
Google on the server side using the google
clientId and secret that was generated by
your OAuth client ID.
Google OAuth in 5 Minutes
• Step 7 - Add login code on the client.
Google OAuth in 5 Minutes
• Step 8 - Add an Accounts.onCreateUser() hook.
Google OAuth in 5 Minutes
Other OAuth Packages Available
● oauth-encryption
● accounts-password
● accounts-google
● accounts-facebook
● accounts-twitter
● accounts-weibo
● accounts-meteor-developer
● accounts-github
● accounts-meetup
● accounts-oauth
Auth is done, so what next?
• Build out the app to allow users to manage
their devices.
• Send and receive SMS, and place phone calls.
• Pay for their subscription.
• Let’s go over each of these.
Client side routing with iron-router
Manage User Devices
Manage User Devices
Client Side:
Server Side:
Manage User Devices
Send/Receive SMS with Twilio!
• Twilio is a service that sells you a phone
number and allows you to send/receive SMS
and phone calls using their API’s.
• Founded in 2007, SMS API released in 2010.
• Extremely cheap:
Setup Phone #’s
• Set up a phone number for each
environment.
Setup TwiML Apps
Send/Receive SMS with Twilio!
Send SMS:
Receive SMS:
Place a Phone Call with Twilio!
• Twilio uses TwiML, an XML-based language
that consists of five basic verbs for Voice
calls: Say, Play, Gather, Record, Dial.
Phonecall Callback
Show Me The Money
• Our service now displays some devices and
let’s you send/receive an SMS or phone call.
• How do you make money off your service?
PayPal?
• Initially used PayPal as I had some experience
with it from working on PHP based e-
commerce sites.
• Requires SSL for their modern API’s, however
older features such as PayPal buttons work
without SSL.
• Their TEST sandbox is a confusing nightmare.
PayPal sucks, Stripe.js is best!
• Stripe is a payment service that was founded
in 2010 by John and Patrick Collison.
• Went live 2012.
• Extremely clean and simple API.
• PCI compliant out of the box; nothing is
handled on the server side thanks to
Stripe.js!
Set up subscription plans in Stripe
Initialize Stripe.js on the Client
Add Credit Card Code
Client Side:
Add Credit Card Code
Server Side:
Create a Subscription
Subscription Changes/Billing
• Stripe allows you a user to change their
subscription at any time and pro-rate it.
• Changing the subscription is as simple as
updating which plan the user wants and
that’s it, no hassle refunding the customer or
messing around with account balances.
Conclusion
• I taught myself Meteor JS and built the
majority of this site over the course of 2
months.
• I have no time tracking data available and
unfortunately have no idea how much time I
spent on this.
Commit History
Punchcard
Questions?

More Related Content

What's hot

What's hot (20)

Azure and web sites hackaton deck
Azure and web sites hackaton deckAzure and web sites hackaton deck
Azure and web sites hackaton deck
 
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
 
Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011Java PaaS Vendor Survey - September 2011
Java PaaS Vendor Survey - September 2011
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
 
WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release Pipelines
 
Sebastien goasguen cloud stack and docker
Sebastien goasguen   cloud stack and dockerSebastien goasguen   cloud stack and docker
Sebastien goasguen cloud stack and docker
 
Microservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudMicroservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring Cloud
 
Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...
 
Building Micro-Services with Scala
Building Micro-Services with ScalaBuilding Micro-Services with Scala
Building Micro-Services with Scala
 
Giles sirett welcome and cloud stack news
Giles sirett   welcome and cloud stack newsGiles sirett   welcome and cloud stack news
Giles sirett welcome and cloud stack news
 
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
Microservices + Events + Docker = A Perfect Trio by Docker Captain Chris Rich...
 
Fuse integration-services
Fuse integration-servicesFuse integration-services
Fuse integration-services
 
Using Rancher and Docker with RightScale at Industrie IT
Using Rancher and Docker with RightScale at Industrie IT Using Rancher and Docker with RightScale at Industrie IT
Using Rancher and Docker with RightScale at Industrie IT
 
Jeffrey Richter
Jeffrey RichterJeffrey Richter
Jeffrey Richter
 
Structured Container Delivery by Oscar Renalias, Accenture
Structured Container Delivery by Oscar Renalias, AccentureStructured Container Delivery by Oscar Renalias, Accenture
Structured Container Delivery by Oscar Renalias, Accenture
 
Mini-Training: Netflix Simian Army
Mini-Training: Netflix Simian ArmyMini-Training: Netflix Simian Army
Mini-Training: Netflix Simian Army
 
Simple tweaks to get the most out of your JVM
Simple tweaks to get the most out of your JVMSimple tweaks to get the most out of your JVM
Simple tweaks to get the most out of your JVM
 
Building a PaaS with Docker and AWS
Building a PaaS with Docker and AWSBuilding a PaaS with Docker and AWS
Building a PaaS with Docker and AWS
 
ASP.NET Core deployment options
ASP.NET Core deployment optionsASP.NET Core deployment options
ASP.NET Core deployment options
 
NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013NetflixOSS for Triangle Devops Oct 2013
NetflixOSS for Triangle Devops Oct 2013
 

Viewers also liked

Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor app
Ritik Malhotra
 
Leveraging azure and cello for multi tenancy
Leveraging azure and cello for multi tenancyLeveraging azure and cello for multi tenancy
Leveraging azure and cello for multi tenancy
Techcello
 

Viewers also liked (14)

Build Your Own SaaS using Docker
Build Your Own SaaS using DockerBuild Your Own SaaS using Docker
Build Your Own SaaS using Docker
 
How to build, manage and operate a successful saas business
How to build, manage and operate a successful saas businessHow to build, manage and operate a successful saas business
How to build, manage and operate a successful saas business
 
How To Deploy And Scale Meteor Applications
How To Deploy And Scale Meteor ApplicationsHow To Deploy And Scale Meteor Applications
How To Deploy And Scale Meteor Applications
 
Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor app
 
Building a SaaS with Nodejs, Docker, and CoreOS
Building a SaaS with Nodejs, Docker, and CoreOSBuilding a SaaS with Nodejs, Docker, and CoreOS
Building a SaaS with Nodejs, Docker, and CoreOS
 
Saas Challenges and Solutions
Saas Challenges and SolutionsSaas Challenges and Solutions
Saas Challenges and Solutions
 
SaaS Model & Metrics - How to build a successful software business
SaaS Model & Metrics - How to build a successful software businessSaaS Model & Metrics - How to build a successful software business
SaaS Model & Metrics - How to build a successful software business
 
Leveraging azure and cello for multi tenancy
Leveraging azure and cello for multi tenancyLeveraging azure and cello for multi tenancy
Leveraging azure and cello for multi tenancy
 
Leverage Azure and SQL Azure to build SaaS applications
Leverage Azure and SQL Azure to build SaaS applications Leverage Azure and SQL Azure to build SaaS applications
Leverage Azure and SQL Azure to build SaaS applications
 
How to Build a Great Cloud/SaaS Business Case Analysis for Technology Investment
How to Build a Great Cloud/SaaS Business Case Analysis for Technology InvestmentHow to Build a Great Cloud/SaaS Business Case Analysis for Technology Investment
How to Build a Great Cloud/SaaS Business Case Analysis for Technology Investment
 
How do i build the right SAAS application
How do i build the right SAAS applicationHow do i build the right SAAS application
How do i build the right SAAS application
 
Building the Billion Dollar SaaS Unicorn: CEO Guide
Building the Billion Dollar SaaS Unicorn: CEO GuideBuilding the Billion Dollar SaaS Unicorn: CEO Guide
Building the Billion Dollar SaaS Unicorn: CEO Guide
 
2016 SaaS Metrics Report
2016 SaaS Metrics Report2016 SaaS Metrics Report
2016 SaaS Metrics Report
 
The SaaS business model and metrics
The SaaS business model and metricsThe SaaS business model and metrics
The SaaS business model and metrics
 

Similar to How to build a SaaS solution in 60 days

Narender Soni Resume - Updated
Narender Soni Resume - UpdatedNarender Soni Resume - Updated
Narender Soni Resume - Updated
Narender Soni
 
6 ways DevOps helped PrepSportswear move from monolith to microservices
6 ways DevOps helped PrepSportswear move from monolith to microservices6 ways DevOps helped PrepSportswear move from monolith to microservices
6 ways DevOps helped PrepSportswear move from monolith to microservices
Dynatrace
 

Similar to How to build a SaaS solution in 60 days (20)

Simple Cloud with Amazon Lightsail - Mike Coleman
Simple Cloud with Amazon Lightsail - Mike ColemanSimple Cloud with Amazon Lightsail - Mike Coleman
Simple Cloud with Amazon Lightsail - Mike Coleman
 
Simple Cloud with Amazon Lightsail
Simple Cloud with Amazon LightsailSimple Cloud with Amazon Lightsail
Simple Cloud with Amazon Lightsail
 
Jumpstarting Your Cloud Journey with OSS on Amazon Lightsail
 Jumpstarting Your Cloud Journey with OSS on Amazon Lightsail Jumpstarting Your Cloud Journey with OSS on Amazon Lightsail
Jumpstarting Your Cloud Journey with OSS on Amazon Lightsail
 
Simple Cloud with Amazon Lightsail
Simple Cloud with Amazon LightsailSimple Cloud with Amazon Lightsail
Simple Cloud with Amazon Lightsail
 
ServerSentEvents.pdf
ServerSentEvents.pdfServerSentEvents.pdf
ServerSentEvents.pdf
 
Tech Thursdays: Building Products
Tech Thursdays: Building ProductsTech Thursdays: Building Products
Tech Thursdays: Building Products
 
Deploying and Scaling Your First Cloud Application with Amazon Lightsail
Deploying and Scaling Your First Cloud Application with Amazon LightsailDeploying and Scaling Your First Cloud Application with Amazon Lightsail
Deploying and Scaling Your First Cloud Application with Amazon Lightsail
 
Tech Talk on Cloud Computing
Tech Talk on Cloud ComputingTech Talk on Cloud Computing
Tech Talk on Cloud Computing
 
Mobile Devices and SharePoint - Sahil Malik
Mobile Devices and SharePoint - Sahil MalikMobile Devices and SharePoint - Sahil Malik
Mobile Devices and SharePoint - Sahil Malik
 
Mobile devices and SharePoint
Mobile devices and SharePointMobile devices and SharePoint
Mobile devices and SharePoint
 
Narender Soni Resume - Updated
Narender Soni Resume - UpdatedNarender Soni Resume - Updated
Narender Soni Resume - Updated
 
presentation slides
presentation slidespresentation slides
presentation slides
 
resume
resumeresume
resume
 
ServerSentEventsV2.pdf
ServerSentEventsV2.pdfServerSentEventsV2.pdf
ServerSentEventsV2.pdf
 
Eric Proegler Oredev Performance Testing in New Contexts
Eric Proegler Oredev Performance Testing in New ContextsEric Proegler Oredev Performance Testing in New Contexts
Eric Proegler Oredev Performance Testing in New Contexts
 
[Pinto] Is my SharePoint Development team properly enlighted?
[Pinto] Is my SharePoint Development team properly enlighted?[Pinto] Is my SharePoint Development team properly enlighted?
[Pinto] Is my SharePoint Development team properly enlighted?
 
6 ways DevOps helped PrepSportswear move from monolith to microservices
6 ways DevOps helped PrepSportswear move from monolith to microservices6 ways DevOps helped PrepSportswear move from monolith to microservices
6 ways DevOps helped PrepSportswear move from monolith to microservices
 
An Introduction to Web Components
An Introduction to Web ComponentsAn Introduction to Web Components
An Introduction to Web Components
 
Sitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helixSitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helix
 
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
(SPOT205) 5 Lessons for Managing Massive IT Transformation Projects
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

How to build a SaaS solution in 60 days

  • 1. How to build a SaaS solution in 60 days using MeteorJS. Brett McLain Application Systems Architect PotashCorp
  • 2. About Me • Application Systems Architect at PotashCorp corporate office. • Programming for 12 years. • Married with a 20 month old son - free time comes at a premium.
  • 3. What am I going to talk about? • Why I decided to build a SaaS solution. • What is MeteorJS and why is it special? • MongoDB • Twilio • Stripe
  • 4. Background • In 2009 I read this post on hackaday.com: –http://hackaday.com/2010/01/15/gsm-car- starter/ • The authors car starter had extremely poor range. • He purchased a GSM controlled relay from China. • Wired the relay to his car starters key fob. • Calling the GSM relay would press the button on the key fob.
  • 6. Background • My truck’s car starter was garbage as well. • Purchased the same type of device from China and implemented the same solution by cannibalizing one of my car starters key fobs. • Added a 12V adapter to plug into my cigarette lighter.
  • 8. Did others have the same problem as me? • Step 1 - Build a car starter. • Step 2 - Buy some devices from China and put them on eBay. • Step 3 - Profit???
  • 9. What else can these be used for? • Common use cases for these devices are: –Turning an irrigation pump on/off. –Opening/closing a gate for gated communities. –Starting a vehicle. –Restarting remote servers. –Wild animal traps (feral hogs). • Sales grew over time: 3000+ devices sold and nearly $500,000 in sales. Some customers are operating over 100 devices.
  • 10. Fast forward 4 years...problems... • Customers were manually keeping track of their devices in Excel spreadsheets. • Each device has a “whitelist” of allowed phone numbers that can call it. This list is manually maintained in Excel as well. • Complex syntax for SMS commands meant that using these devices required training. • Over one hundred different devices in their contacts lists on multiple phones added complexity.
  • 11. Solution • Build a centralized command and control web application to manage these devices, send and receive SMS & phone calls, abstract away command complexity, control their “whitelist”, monitor SMS usage, and review audit logs.
  • 12. Initial Requirements • Needs to be a web application – MEAN Stack (Mongo, Express.js, Angular JS, Node JS) • Ideally can be compiled for mobile – Phonegap • Payments – Paypal • SMS & Phone Calls – Twilio • Reactive?
  • 13. Quickly ran into problems… • Needs to be a web application – MEAN stack has a lot of moving parts. – Need to establish patterns from the ground up. • Ideally can be compiled for mobile – Phonegap – good. • Payments – Paypal, frustrating test API/sandbox. – Requires https to even begin testing on their modern API. • SMS & Phone Calls – Twilio – good. • Reactive – Didn’t know where to start.
  • 14. MeteorJS to the rescue! • Needs to be a web application – MeteorJS provides a full cohesive stack right out of the box with established patterns for everything. • Mobile – MeteorJS compiles to Phonegap. • Payments – Stripe.js is outrageously easy to use, same package as Node.js. • SMS & Phone Calls – Twilio uses same package as Node.js. • Everything is reactive out of the box!
  • 15. What is MeteorJS? • Think of it as a skeleton into which a number of components are inserted in a logical manner to create a cohesive ecosystem for application development. • Out of the box it comes with most of what you need, however you can swap out almost any piece.
  • 16. MeteorJS Features • Compiling –Isobuild Package Manager (coffeescript, less.js, minifiers, templating compilation, npm packages, cordova packages). • Server Side –Runs on Node.js. –LiveQuery (Mongo or Redis) Replication Sets/oplog tailing. –Fibers/Futures for dealing with callback spaghetti.
  • 17. MeteorJS Features • Communication Layer –DDP (Distributed Data Protocol) –EJSON (Serializes Dates, Binary) • Browser –Tracker (backbone for reactivity). –Iron router (routing). –Blaze+Spacebars (templating). –Minimongo. –Hot Code Push. –Session (reactive UI variables)
  • 18. MongoDB Features • Is a NoSQL, Document style database that uses BSON (similar to JSON) for storing data. • Has the concept of “databases”, and tables (called collections). • Strongly consistent (though that can be changed). • Sharding. • High availability via replica sets.
  • 22. So where to start? • Tempting to just start building some initial basic pages… • Should really start with authentication first so it’s baked in right from the start.
  • 23. Authentication/Login • Meteor provides an accounts package that securely manages authentication for you. • Install the base package to just use simple username and password: – meteor add accounts-base – meteor add accounts-password • Provides simple API’s for user creation, account verification (email), login, password reset, and forgotten password.
  • 26. OAuth wut? • Simple username and password is fine, but I really love websites that allow me to use my google account to login to their site. This is called OAuth. • “OAuth is an open standard for authorization, commonly used as a way for internet users to log into third party websites using their Microsoft, Google, Facebook, or Twitter accounts without exposing their password.” - Wikipedia.
  • 28. Google OAuth in 5 Minutes • In MeteorJS you can implement Google OAuth in less than 5 minutes. • Step 1 -Add the accounts-google package: –meteor add accounts-google • Step 2 - Sign up for a google developer account if you don’t already have one, then go to the google developer console: –https://console.developers.google.com/ • Step 3 - Create a project in the google developer console.
  • 29. Google OAuth in 5 Minutes • Step 4 - Create OAuth client ID.
  • 30. Google OAuth in 5 Minutes • Step 5 - Add the OAuth keys to the MeteorJS settings.json file. This makes them globally accessible (private is server side only, public is both client and server side).
  • 31. Google OAuth in 5 Minutes • Step 6 - Add the service configuration for Google on the server side using the google clientId and secret that was generated by your OAuth client ID.
  • 32. Google OAuth in 5 Minutes • Step 7 - Add login code on the client.
  • 33. Google OAuth in 5 Minutes • Step 8 - Add an Accounts.onCreateUser() hook.
  • 34. Google OAuth in 5 Minutes
  • 35. Other OAuth Packages Available ● oauth-encryption ● accounts-password ● accounts-google ● accounts-facebook ● accounts-twitter ● accounts-weibo ● accounts-meteor-developer ● accounts-github ● accounts-meetup ● accounts-oauth
  • 36. Auth is done, so what next? • Build out the app to allow users to manage their devices. • Send and receive SMS, and place phone calls. • Pay for their subscription. • Let’s go over each of these.
  • 37. Client side routing with iron-router
  • 39. Manage User Devices Client Side: Server Side:
  • 41. Send/Receive SMS with Twilio! • Twilio is a service that sells you a phone number and allows you to send/receive SMS and phone calls using their API’s. • Founded in 2007, SMS API released in 2010. • Extremely cheap:
  • 42. Setup Phone #’s • Set up a phone number for each environment.
  • 44. Send/Receive SMS with Twilio! Send SMS: Receive SMS:
  • 45. Place a Phone Call with Twilio! • Twilio uses TwiML, an XML-based language that consists of five basic verbs for Voice calls: Say, Play, Gather, Record, Dial.
  • 47. Show Me The Money • Our service now displays some devices and let’s you send/receive an SMS or phone call. • How do you make money off your service?
  • 48. PayPal? • Initially used PayPal as I had some experience with it from working on PHP based e- commerce sites. • Requires SSL for their modern API’s, however older features such as PayPal buttons work without SSL. • Their TEST sandbox is a confusing nightmare.
  • 49. PayPal sucks, Stripe.js is best! • Stripe is a payment service that was founded in 2010 by John and Patrick Collison. • Went live 2012. • Extremely clean and simple API. • PCI compliant out of the box; nothing is handled on the server side thanks to Stripe.js!
  • 50. Set up subscription plans in Stripe
  • 52. Add Credit Card Code Client Side:
  • 53. Add Credit Card Code Server Side:
  • 55. Subscription Changes/Billing • Stripe allows you a user to change their subscription at any time and pro-rate it. • Changing the subscription is as simple as updating which plan the user wants and that’s it, no hassle refunding the customer or messing around with account balances.
  • 56. Conclusion • I taught myself Meteor JS and built the majority of this site over the course of 2 months. • I have no time tracking data available and unfortunately have no idea how much time I spent on this.