1
00:00:02,000 --> 00:00:03,000
[Maximilian Schwarzmuller] So now that we know

2
00:00:03,000 --> 00:00:08,000
how we can build our site and what the implications are,

3
00:00:08,000 --> 00:00:09,000
let's take a look at

4
00:00:09,000 --> 00:00:12,000
general deployment steps and considerations,

5
00:00:12,000 --> 00:00:16,000
no matter how you will build your site.

6
00:00:16,000 --> 00:00:18,000
The first step should always be

7
00:00:18,000 --> 00:00:20,000
that you double-check all your pages,

8
00:00:20,000 --> 00:00:23,000
you make sure you added all the head metadata

9
00:00:23,000 --> 00:00:26,000
to all your pages, titles, descriptions,

10
00:00:26,000 --> 00:00:28,000
whatever else you might need.

11
00:00:28,000 --> 00:00:31,000
Of course, you wannna optimize your code,

12
00:00:31,000 --> 00:00:34,000
remove console log statements,

13
00:00:34,000 --> 00:00:37,000
shrink it as much as possible, things like that.

14
00:00:37,000 --> 00:00:40,000
And you wanna remove unnecessary dependencies

15
00:00:40,000 --> 00:00:44,000
and make your code as small and optimized as possible.

16
00:00:44,000 --> 00:00:46,000
So that is step number one.

17
00:00:46,000 --> 00:00:51,000
Now once you did that, there is another kind of related step

18
00:00:51,000 --> 00:00:54,000
which I still wanna list as a separate step.

19
00:00:54,000 --> 00:00:56,000
You wanna double-check your configuration,

20
00:00:56,000 --> 00:00:58,000
and you especially wanna consider

21
00:00:58,000 --> 00:01:01,000
working with environment variables

22
00:01:01,000 --> 00:01:05,000
for data that might not be the same during development

23
00:01:05,000 --> 00:01:06,000
and during production.

24
00:01:06,000 --> 00:01:09,000
For example, in our blog application

25
00:01:09,000 --> 00:01:12,000
we have an API route where I connect to a database,

26
00:01:12,000 --> 00:01:16,000
and, at the moment, the way I connect here

27
00:01:16,000 --> 00:01:17,000
is always the same.

28
00:01:17,000 --> 00:01:21,000
My connection string is hard-coded in the API route,

29
00:01:21,000 --> 00:01:23,000
so I always use the same user,

30
00:01:23,000 --> 00:01:26,000
the same cluster, the same database.

31
00:01:26,000 --> 00:01:29,000
It's more realistic that I want to use

32
00:01:29,000 --> 00:01:34,000
some development dummy database during development

33
00:01:34,000 --> 00:01:36,000
and switch to a different database

34
00:01:36,000 --> 00:01:40,000
and maybe also an entirely different cluster and user

35
00:01:40,000 --> 00:01:41,000
for production.

36
00:01:41,000 --> 00:01:44,000
And, therefore, we want to swap

37
00:01:44,000 --> 00:01:47,000
this connection string dynamically,

38
00:01:47,000 --> 00:01:49,000
depending on the environment in which we're running.

39
00:01:49,000 --> 00:01:53,000
And that is something where environment variables

40
00:01:53,000 --> 00:01:55,000
will be able to help us.

41
00:01:55,000 --> 00:01:58,000
Another use case could be API keys.

42
00:01:58,000 --> 00:02:02,000
If you're using the Google Maps SDK, for example.

43
00:02:02,000 --> 00:02:04,000
These are things which you might wanna manage

44
00:02:04,000 --> 00:02:06,000
with environment variables.

45
00:02:06,000 --> 00:02:09,000
And therefore, that is, of course, also something

46
00:02:09,000 --> 00:02:11,000
we're going to explore in this course section.

47
00:02:13,000 --> 00:02:16,000
Now once you did all of that, you should to do a test build

48
00:02:16,000 --> 00:02:21,000
and test your production-ready app on your local machine.

49
00:02:21,000 --> 00:02:25,000
Since you just need a node server for running it,

50
00:02:25,000 --> 00:02:28,000
and we already have Node.js installed,

51
00:02:28,000 --> 00:02:30,000
building and running the application

52
00:02:30,000 --> 00:02:32,000
is rather straightforward.

53
00:02:32,000 --> 00:02:35,000
And we should do that to make sure that everything works,

54
00:02:35,000 --> 00:02:37,000
that we're happy with the file sizes,

55
00:02:37,000 --> 00:02:40,000
with the code bundle sizes, and so on.

56
00:02:40,000 --> 00:02:43,000
Now that step, of course, can involve

57
00:02:43,000 --> 00:02:45,000
that you go back to step one

58
00:02:45,000 --> 00:02:47,000
and implement further optimizations.

59
00:02:48,000 --> 00:02:50,000
Now once you're happy with all of that,

60
00:02:50,000 --> 00:02:53,000
then it's time to finally deploy.

61
00:02:53,000 --> 00:02:58,000
That is roughly how the deployment process will look like.

62
00:02:58,000 --> 00:03:01,000
And that, therefore, is the process and the list

63
00:03:01,000 --> 00:03:04,000
we will go through over the next lectures.

