1
00:00:03,880 --> 00:00:06,860
Over the past several weeks,

2
00:00:06,860 --> 00:00:09,620
we have spent a lot of time learning how to

3
00:00:09,620 --> 00:00:12,330
build and deploy a full-fledged REST API server

4
00:00:12,330 --> 00:00:20,645
by mastering technologies like the Express Framework and INNOSQL database like MongoDB.

5
00:00:20,645 --> 00:00:27,090
This approach gives you full control over how you build and deploy your back-end server.

6
00:00:27,090 --> 00:00:29,260
But in many situations,

7
00:00:29,260 --> 00:00:34,870
we may have very little time to configure a server and then deploy it quickly.

8
00:00:34,870 --> 00:00:40,667
So for example, you are a startup that needs to reach the market very, very quickly,

9
00:00:40,667 --> 00:00:44,615
then you may want to quickly scaffold out the back-end server together with

10
00:00:44,615 --> 00:00:49,355
a front-end application and reach the market very, very quickly.

11
00:00:49,355 --> 00:00:52,280
In those circumstances, can we provide

12
00:00:52,280 --> 00:00:55,220
the back-end support in the form of

13
00:00:55,220 --> 00:00:58,750
a service that can be quickly configured and deployed?

14
00:00:58,750 --> 00:01:04,830
That is exactly what we will discuss in more detail in this lecture and the

15
00:01:04,830 --> 00:01:12,247
subsequent exercises in this lesson and the following lesson.

16
00:01:12,247 --> 00:01:14,890
So, as we have learned in this course,

17
00:01:14,890 --> 00:01:17,770
we have mastered the technologies,

18
00:01:17,770 --> 00:01:24,125
the frameworks necessary for us to build a full-fledged back-end REST API server.

19
00:01:24,125 --> 00:01:28,180
Now of course, as we have learned over the past several weeks,

20
00:01:28,180 --> 00:01:33,640
this approach requires us to set up our own server and then configure the server,

21
00:01:33,640 --> 00:01:35,860
we need to set up our back-end database and then

22
00:01:35,860 --> 00:01:38,320
configure the various aspects of the back-end database.

23
00:01:38,320 --> 00:01:43,800
We need to develop the REST API and various routes for our REST API,

24
00:01:43,800 --> 00:01:46,050
and also we may need to build in

25
00:01:46,050 --> 00:01:50,530
additional services like delivering push notifications to the user,

26
00:01:50,530 --> 00:01:55,240
user management, social networking services, and so on.

27
00:01:55,240 --> 00:02:01,465
So, all these mean that developing a full-fledged bank-end requires a lot of effort.

28
00:02:01,465 --> 00:02:07,270
Now, can we package this whole approach into a service that can be

29
00:02:07,270 --> 00:02:10,210
quickly configured and deployed without having

30
00:02:10,210 --> 00:02:13,380
to spend so much time configuring our server?

31
00:02:13,380 --> 00:02:16,075
Now you're looking at me strangely and saying,

32
00:02:16,075 --> 00:02:18,670
"You spent the past three weeks training us in

33
00:02:18,670 --> 00:02:21,790
all these technologies and now you're saying that it is very easy to

34
00:02:21,790 --> 00:02:25,690
configure a server using a back-end as

35
00:02:25,690 --> 00:02:31,000
a service to provide all these various features from our back-end."

36
00:02:31,000 --> 00:02:36,280
Well, every approach comes with its own advantages and disadvantages.

37
00:02:36,280 --> 00:02:41,425
Let's learn a little bit more about back-end as a service before we decide

38
00:02:41,425 --> 00:02:44,285
whether the full-fledged server development approach

39
00:02:44,285 --> 00:02:46,960
that we have learned so far is the right way for us,

40
00:02:46,960 --> 00:02:50,605
or quickly configuring and deploying back-end

41
00:02:50,605 --> 00:02:55,170
as a service is the approach that will satisfy our needs.

42
00:02:55,170 --> 00:02:58,150
So, what exactly is back-end as a service?

43
00:02:58,150 --> 00:03:02,170
The back-end is a service is designed as a model for providing

44
00:03:02,170 --> 00:03:07,260
mobile and web developers to link their applications to the back-end cloud.

45
00:03:07,260 --> 00:03:13,495
So typically, the back-end as a service is hosted in the cloud and then you expose

46
00:03:13,495 --> 00:03:16,570
the back-end to the front-end through

47
00:03:16,570 --> 00:03:22,150
a well-designed interface like the REST API endpoints.

48
00:03:22,150 --> 00:03:27,985
A fully packaged back-end as we see in this lesson,

49
00:03:27,985 --> 00:03:33,645
is a relatively recent phenomenon and has been taking the web world by storm.

50
00:03:33,645 --> 00:03:36,455
We will look at some examples in a bit more detail.

51
00:03:36,455 --> 00:03:42,760
Now, this provides a bridge between the front-end and the back-end data storage and

52
00:03:42,760 --> 00:03:50,320
the back-end database management through a unified API.

53
00:03:50,320 --> 00:03:53,780
And also many of these back-end as a service providers provide

54
00:03:53,780 --> 00:03:56,770
their own software development kit which will enable

55
00:03:56,770 --> 00:04:00,820
you to quickly get started on front-end development.

56
00:04:00,820 --> 00:04:05,590
This approach of course frees up the developers from having to concentrate on

57
00:04:05,590 --> 00:04:10,465
building a back-end and instead concentrate on their front-end development,

58
00:04:10,465 --> 00:04:15,650
or trying to design and deploy the user experience within

59
00:04:15,650 --> 00:04:17,685
the front-end be it in the form of

60
00:04:17,685 --> 00:04:21,470
an angular application or be it in the form of a mobile app.

61
00:04:21,470 --> 00:04:24,340
Now, if you are familiar with cloud computing,

62
00:04:24,340 --> 00:04:28,135
I'm sure you've heard terms like infrastructure as a service,

63
00:04:28,135 --> 00:04:31,385
platform as a service and software as a service.

64
00:04:31,385 --> 00:04:35,110
Now, the mobile back-end as a service, or BaaS,

65
00:04:35,110 --> 00:04:42,640
is essentially building upon this approach and targeting mobile and web developers

66
00:04:42,640 --> 00:04:50,560
with access to back-end cloud services and a much more packaged environment.

67
00:04:50,560 --> 00:04:55,540
So, this is how the back-end as a service enables you to

68
00:04:55,540 --> 00:05:01,280
leverage the cloud back-end for supporting your front-end application.

69
00:05:01,280 --> 00:05:05,030
Of course the next question that arises in your mind is what does

70
00:05:05,030 --> 00:05:08,697
the back-end as a service provide for you typically?

71
00:05:08,697 --> 00:05:11,930
A typical back-end as a service provides for you pushing

72
00:05:11,930 --> 00:05:16,865
notifications automatically built into the back-end cloud support.

73
00:05:16,865 --> 00:05:21,670
It provides you with file storage and sharing of files.

74
00:05:21,670 --> 00:05:24,880
It provides you with social network integration.

75
00:05:24,880 --> 00:05:27,500
Many of these back-end service providers provide

76
00:05:27,500 --> 00:05:31,030
social network integration automatically for you.

77
00:05:31,030 --> 00:05:34,310
It provides you with messaging and chat capabilities which you can

78
00:05:34,310 --> 00:05:38,780
leverage within your front-end to provide better user experience.

79
00:05:38,780 --> 00:05:41,280
It also provides you with user management.

80
00:05:41,280 --> 00:05:45,140
As we have seen when we built our user management and

81
00:05:45,140 --> 00:05:51,412
authentication support within our Express plus MongoDB server,

82
00:05:51,412 --> 00:05:54,675
we had to build in the full-fledged authentication server,

83
00:05:54,675 --> 00:05:57,005
we needed to build in the back-end services,

84
00:05:57,005 --> 00:06:00,575
we needed to do the token management both on the back-end

85
00:06:00,575 --> 00:06:05,240
and on the front-end and authentication of the user and so on.

86
00:06:05,240 --> 00:06:09,730
All these can be packaged and delivered to you as a unit with

87
00:06:09,730 --> 00:06:14,785
the software development kit that comes with the back-end as a service.

88
00:06:14,785 --> 00:06:20,090
And also, back-end since it is a package service,

89
00:06:20,090 --> 00:06:25,340
they also built in a lot of usage analysis tools which enable you to

90
00:06:25,340 --> 00:06:31,120
get a quick overview of how the users are interacting with your back-end.

91
00:06:31,120 --> 00:06:34,385
So, this usage tools give you a lot of

92
00:06:34,385 --> 00:06:38,760
insight into the user behavior from within your back-end.

93
00:06:38,760 --> 00:06:45,170
Also, many of these back-end services provide you with a method of

94
00:06:45,170 --> 00:06:48,605
building and deploying your own custom logic

95
00:06:48,605 --> 00:06:52,350
within the back-end to meet your specific requirements.

96
00:06:52,350 --> 00:06:56,465
Of course, they provide you with the framework within which you can

97
00:06:56,465 --> 00:07:02,625
design your custom business logic to meet your specific needs.

98
00:07:02,625 --> 00:07:07,250
So to summarize, a typical back-end provides a data storage API for

99
00:07:07,250 --> 00:07:12,785
cloud storage where you can upload and download files and also access these files,

100
00:07:12,785 --> 00:07:15,725
some kind of a binary storage for your data,

101
00:07:15,725 --> 00:07:20,620
perhaps device synchronization and caching capabilities.

102
00:07:20,620 --> 00:07:23,135
So, for example, when you build your front-end,

103
00:07:23,135 --> 00:07:27,190
the back-end data will be automatically cached in the front-end.

104
00:07:27,190 --> 00:07:31,835
They may also support offline operation of your front-end.

105
00:07:31,835 --> 00:07:37,280
So, even with your user device disconnected from the network,

106
00:07:37,280 --> 00:07:40,865
you will still provide sufficient amount of

107
00:07:40,865 --> 00:07:45,735
information to the user with offline capabilities.

108
00:07:45,735 --> 00:07:50,780
So, both online and offline workflow so you can even allow the user to

109
00:07:50,780 --> 00:07:57,120
perform their activities offline and then later on synchronize with the back-end.

110
00:07:57,120 --> 00:07:59,360
Third party integration.

111
00:07:59,360 --> 00:08:02,480
So, many times many of these back-end as a service providers

112
00:08:02,480 --> 00:08:06,380
allow third party developers to develop plugins that can then

113
00:08:06,380 --> 00:08:09,710
be leveraged together with the back-end to provide

114
00:08:09,710 --> 00:08:14,010
extensions to the services that the back-end already provides for you.

115
00:08:14,010 --> 00:08:19,064
Secure connectivity between the front-end application and the back-end,

116
00:08:19,064 --> 00:08:22,070
and also many times automatically generate

117
00:08:22,070 --> 00:08:27,200
the REST API endpoints for you based upon the data that you store in the back-end.

118
00:08:27,200 --> 00:08:29,685
We will see examples of this especially with

119
00:08:29,685 --> 00:08:34,435
LoopBack as we will see later on in the exercises.

120
00:08:34,435 --> 00:08:37,055
And also as I mentioned,

121
00:08:37,055 --> 00:08:41,210
many of these back-end as a service providers provide

122
00:08:41,210 --> 00:08:44,240
their own software development kits so that you

123
00:08:44,240 --> 00:08:48,025
can easily get started with your front-end development.

124
00:08:48,025 --> 00:08:52,670
The SDK comes with all the code necessary for

125
00:08:52,670 --> 00:08:58,010
your front-end application to automatically interact with your back-end application.

126
00:08:58,010 --> 00:09:01,760
So, for example, the SDK might already contain

127
00:09:01,760 --> 00:09:05,810
services that your angular application can leverage to talk to

128
00:09:05,810 --> 00:09:09,260
the back-end automatically so you may be left only with implementing

129
00:09:09,260 --> 00:09:14,540
the components and the front-end templates for your application.

130
00:09:14,540 --> 00:09:18,140
All the interaction with the back-end is automatically

131
00:09:18,140 --> 00:09:22,390
managed by the package SDK that is provided for you.

132
00:09:22,390 --> 00:09:24,615
You will see examples of this both with

133
00:09:24,615 --> 00:09:27,285
Firebase that we will look at in a little bit later,

134
00:09:27,285 --> 00:09:33,885
and also with LoopBack that we will discuss in the next lesson.

135
00:09:33,885 --> 00:09:38,800
Of course, any approach has two sides to the coin.

136
00:09:38,800 --> 00:09:44,340
So, let's examine some of the advantages and disadvantages of back-end as a service.

137
00:09:44,340 --> 00:09:47,234
Now, one advantage of course is that with

138
00:09:47,234 --> 00:09:51,355
the back-end it provides you pre-built tried and tested components.

139
00:09:51,355 --> 00:09:54,308
So, the back-end is packaged for you

140
00:09:54,308 --> 00:09:58,140
so the back-end service provider would have ensured that

141
00:09:58,140 --> 00:10:05,010
the entire back-end is well tested and will deliver the service as promised to the users,

142
00:10:05,010 --> 00:10:06,940
to the front-end developers.

143
00:10:06,940 --> 00:10:10,020
So, you don't need to spend additional time having

144
00:10:10,020 --> 00:10:16,620
to worry about testing and ensuring that your back-end works correctly or not.

145
00:10:16,620 --> 00:10:19,750
Unlike when you build your own custom

146
00:10:19,750 --> 00:10:23,370
back-end using the frameworks that we have seen earlier,

147
00:10:23,370 --> 00:10:28,060
you are fully responsible to ensure that your back-end works correctly.

148
00:10:28,060 --> 00:10:31,969
The second advantage is of course,

149
00:10:31,969 --> 00:10:38,195
the concomitant reduction in the server-side efforts that you need to put in.

150
00:10:38,195 --> 00:10:41,958
So since the server-side comes as a packaged unit,

151
00:10:41,958 --> 00:10:46,000
you can concentrate primarily on the front-end development and leave

152
00:10:46,000 --> 00:10:50,375
the server-side for the backend as a service provider to deal with.

153
00:10:50,375 --> 00:10:53,830
And you're simply leveraging the flexibility that they

154
00:10:53,830 --> 00:10:57,829
provide for you in developing the front-end.

155
00:10:57,829 --> 00:11:01,810
And the typical backend as a service provider will

156
00:11:01,810 --> 00:11:06,835
take care of integrating any recent technological developments

157
00:11:06,835 --> 00:11:10,150
into their backend and provide

158
00:11:10,150 --> 00:11:17,300
updated versions of the backend as and when the newer technologies become available.

159
00:11:17,300 --> 00:11:21,700
So, that way you as a front-end developer is

160
00:11:21,700 --> 00:11:27,310
completely freed up from worrying about how the backend needs to evolve.

161
00:11:27,310 --> 00:11:31,660
That is automatically taken care of by the BaaS provider for you.

162
00:11:31,660 --> 00:11:35,650
Of course, everything comes with the flip side of the card.

163
00:11:35,650 --> 00:11:41,430
So lets examine what are some of the downsides of going backend as a service.

164
00:11:41,430 --> 00:11:45,580
First and foremost, most backends operate as a black box.

165
00:11:45,580 --> 00:11:48,950
You do not know exactly how the backend is implemented.

166
00:11:48,950 --> 00:11:53,610
If you are using an open source backend like LoopBack,

167
00:11:53,610 --> 00:11:57,745
for example, you do have access to that entire backend code,

168
00:11:57,745 --> 00:12:05,140
but still why would you want to spend time exploring the details of the backend,

169
00:12:05,140 --> 00:12:07,510
when you have been guaranteed that the backend has been

170
00:12:07,510 --> 00:12:10,600
built well and tested well for you.

171
00:12:10,600 --> 00:12:13,960
So you can simply treat it as a black box as long.

172
00:12:13,960 --> 00:12:16,750
As you have confidence that this black box is going to

173
00:12:16,750 --> 00:12:19,865
deliver the services that you expect it to deliver,

174
00:12:19,865 --> 00:12:23,050
you can simply use the backend without

175
00:12:23,050 --> 00:12:26,985
having to worry about how it is actually implemented.

176
00:12:26,985 --> 00:12:29,290
The second aspect is that,

177
00:12:29,290 --> 00:12:33,021
if you choose to go with one backend as a service provider,

178
00:12:33,021 --> 00:12:36,190
there is the issue of vendor lock-in.

179
00:12:36,190 --> 00:12:39,340
So once you choose one of the BaaS providers,

180
00:12:39,340 --> 00:12:45,150
you'll be locked into their environment and the way they store their data.

181
00:12:45,150 --> 00:12:49,470
Many a time once you adopt one of these backend as a service providers,

182
00:12:49,470 --> 00:12:54,550
all your data gets locked in to their service and you may have to go

183
00:12:54,550 --> 00:12:56,500
through an inordinate effort in order to

184
00:12:56,500 --> 00:12:59,755
retrieve the data that you have already stored in the backend,

185
00:12:59,755 --> 00:13:04,470
should you choose to migrate from one backend as a service provider to another.

186
00:13:04,470 --> 00:13:10,180
So deploying your service using one backend is a very straightforward task,

187
00:13:10,180 --> 00:13:13,120
but then if you choose to change your BaaS provider,

188
00:13:13,120 --> 00:13:16,080
that is going to be an uphill battle for you.

189
00:13:16,080 --> 00:13:20,110
So that is something that you should be fully aware of before committing

190
00:13:20,110 --> 00:13:24,229
to using one of the backend as a service providers.

191
00:13:24,229 --> 00:13:27,700
This issue does not become a problem when you are

192
00:13:27,700 --> 00:13:31,914
doing your full fledged backend development on your own.

193
00:13:31,914 --> 00:13:34,750
Again, your win some and you lose some.

194
00:13:34,750 --> 00:13:41,716
So we always take that with their whole picture in mind.

195
00:13:41,716 --> 00:13:44,310
So, the loss of flexibility that you

196
00:13:44,310 --> 00:13:48,990
entail by using one of the backend as service providers may be something that

197
00:13:48,990 --> 00:13:54,363
you're willing to live with because of the fact that you have reduced amount of

198
00:13:54,363 --> 00:13:57,570
backend development time and you can concentrate

199
00:13:57,570 --> 00:14:01,473
more on delivering your product to the market.

200
00:14:01,473 --> 00:14:04,465
So, if you trust the BaaS provider,

201
00:14:04,465 --> 00:14:09,045
then you can simply go with your selected BaaS provider and then

202
00:14:09,045 --> 00:14:14,880
not worry too much about the loss of flexibility that ensues because of that.

203
00:14:14,880 --> 00:14:20,588
Again, as I said, not everything comes with only advantages,

204
00:14:20,588 --> 00:14:24,330
there are always advantages and disadvantages to any approach that you

205
00:14:24,330 --> 00:14:28,545
choose for developing and deploying your backend.

206
00:14:28,545 --> 00:14:33,720
BaaS is just one alternative that might be the approach

207
00:14:33,720 --> 00:14:39,820
that you choose to for your specific needs.

208
00:14:39,820 --> 00:14:41,655
And finally, of course,

209
00:14:41,655 --> 00:14:48,412
not every BaaS comes without its own set of additional training requirements.

210
00:14:48,412 --> 00:14:50,675
If you need to use one of the BaaS providers,

211
00:14:50,675 --> 00:14:52,894
instead of the black box, you need to learn the API,

212
00:14:52,894 --> 00:14:54,725
you need to learn how to configure it,

213
00:14:54,725 --> 00:14:59,664
you need to learn how to customize parts of it should you choose to do so, and so on.

214
00:14:59,664 --> 00:15:04,245
So the training effort you spent learning

215
00:15:04,245 --> 00:15:13,320
specific or generic frameworks like Express and databases like MongoDB,

216
00:15:13,320 --> 00:15:16,820
instead you will be spending time learning

217
00:15:16,820 --> 00:15:22,715
their specifics of their backend as a service that you choose to use.

218
00:15:22,715 --> 00:15:26,070
So, it is a question of where you want to spend your time.

219
00:15:26,070 --> 00:15:29,211
The additional training will always be involved,

220
00:15:29,211 --> 00:15:34,020
except that with a BaaS provider you might be able to get started more

221
00:15:34,020 --> 00:15:38,981
quickly than building your own custom backend.

222
00:15:38,981 --> 00:15:44,770
The BaaS market is full of a number of choices.

223
00:15:44,770 --> 00:15:47,900
And indeed, these choices keep increasing by the day.

224
00:15:47,900 --> 00:15:50,115
Now when you go into the BaaS market,

225
00:15:50,115 --> 00:15:52,860
you might see commercial vendors.

226
00:15:52,860 --> 00:15:56,810
Here is a small list of commercial vendors.

227
00:15:56,810 --> 00:16:01,460
Again, there are more and more that get added by the day to this list,

228
00:16:01,460 --> 00:16:05,675
and I have just listed only a small subset of them.

229
00:16:05,675 --> 00:16:10,658
Of course, if your favorite BaaS provider is not in this list, don't blame me,

230
00:16:10,658 --> 00:16:13,950
maybe I'm just unaware of them or maybe they are just too

231
00:16:13,950 --> 00:16:17,400
new to the market and so I haven't come across them.

232
00:16:17,400 --> 00:16:24,525
But here is a list of some of the commercial vendors that provide BaaS services for us.

233
00:16:24,525 --> 00:16:27,540
In particular, I'm going to concentrate on firebase,

234
00:16:27,540 --> 00:16:29,780
which is provided by Google.

235
00:16:29,780 --> 00:16:34,530
In this lesson we'll explore how to make use of firebase in a

236
00:16:34,530 --> 00:16:40,055
little bit detailed in this lesson in the exercises that follow.

237
00:16:40,055 --> 00:16:43,960
Now, if you want to go with an open source provider,

238
00:16:43,960 --> 00:16:47,706
there are plenty of open source alternatives that are available for us,

239
00:16:47,706 --> 00:16:50,490
of course there you will be

240
00:16:50,490 --> 00:16:55,770
acquiring this open source software and then building your server end and deploying it.

241
00:16:55,770 --> 00:16:57,300
Except that it'll come as

242
00:16:57,300 --> 00:17:01,465
a prepackaged entity that you can quickly configure and deploy to the backend.

243
00:17:01,465 --> 00:17:06,630
We will look at LoopBack as one of the examples of an open source software that

244
00:17:06,630 --> 00:17:11,909
can be deployed very quickly for building your backend.

245
00:17:11,909 --> 00:17:17,177
And as I said, more and more choices are coming into the market, day by day.

246
00:17:17,177 --> 00:17:23,952
So, should you explore the market tomorrow to find new BaaS providers?

247
00:17:23,952 --> 00:17:27,463
By all means, examine what is provided by them,

248
00:17:27,463 --> 00:17:29,505
what kind of services that they provide.

249
00:17:29,505 --> 00:17:34,440
Will those services that they provide meet to your requirements and can you quickly

250
00:17:34,440 --> 00:17:39,865
leverage the service that they provide to get to the market quickly.

251
00:17:39,865 --> 00:17:43,263
So these are issues that I will leave you within a day.

252
00:17:43,263 --> 00:17:45,310
As I said, we should look at

253
00:17:45,310 --> 00:17:50,897
all the possible alternatives and then make our own decisions independently.

254
00:17:50,897 --> 00:17:57,510
But unless we are aware of the alternatives we won't be able to make informed choices.

255
00:17:57,510 --> 00:18:02,355
So that is why the last few lessons of this course I'm spending

256
00:18:02,355 --> 00:18:08,940
on exploring some examples of backend as service providers.