You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,17 @@ Vapor 4 code samples for the [Practical Server Side Swift book](https://gumroad.
4
4
5
5
## Chapter 1: Introduction
6
6
7
-
Chapter 1 is an introduction to the Server side Swift world, explaining the evolution of Swift as a universal programming language. We'll talk about both the strenghts and weaknesses of the language and discuss why Swift is a good choice to build backend applications. We'll explore the Swift ecosystem and the open-source movement that made it possible to create the necessary tools on Linux to turn Swift into a server side language. You'll get introduced to Vapor, the most popular web application framework that we're going to use in this book.
7
+
This chapter is an introduction to the Server side Swift world, explaining the evolution of Swift as a universal programming language. We'll talk about both the strengths and weaknesses of the language and discuss why Swift is a good choice to build backend applications. We'll explore the Swift ecosystem and the open-source movement that made it possible to create the necessary tools on Linux to turn Swift into a server side language. You'll get introduced to Vapor, the most popular web application framework that we're going to use in this book.
8
8
9
9
## Chapter 2: Hello Vapor
10
10
11
-
This chapter contains detailed instructions about how to install all the required components to build server side Swift applicaitons both on Linux and macOS. You'll meet some command line tools that can help your every day life as a backend developer and we'll create our very first Vapor project using the Swift Package Manager. We'll also set up Vapor toolbox a handy little tool that can help you to bootstrap projects based on a template. In the very last section we will briefly take a look at the architecture of a Vapor application.
11
+
This chapter contains detailed instructions about how to install all the required components to build server side Swift applications both on Linux and macOS. You'll meet some command line tools that can help your every day life as a backend developer and we'll create our very first Vapor project using the Swift Package Manager. We'll also set up Vapor toolbox a handy little tool that can help you to bootstrap projects based on a template. In the very last section we will briefly take a look at the architecture of a Vapor application.
12
12
13
13
## Chapter 3: Building a website using Leaf
14
14
15
-
In this chapter we're going to build our first website using the Leaf template engine. We are going to write some basic HTML and CSS code and learn how to connect Swift objects with the template engine using contexts. You'll learn about the syntax of Leaf files using variables, conditions, how to iterate through objects and we'll even extend a base template to provide a reusable frame for our website. We'll build a blog layout with post list and detail pages.
15
+
In this chapter we're going to build our first website using the Leaf template engine. We are going to write some basic HTML and CSS code and learn how to connect Swift objects with the template engine using contexts. You'll learn about the syntax of Leaf files using variables, conditions, how to iterate through objects and we will extend a base template to provide a reusable frame for our website. We'll build a blog layout with post list and detail pages.
16
16
17
-
## Chapter 4: Modelling a blog using Fluent
17
+
## Chapter 4: Creating a blog database
18
18
19
19
You'll learn about the Fluent ORM framework and the advantages of using such tool instead of writing raw database queries. We'll setup Fluent powered by the SQLite driver, and model our database fields using property wrappers in Swift. We are going to provide a seed for our database, get familiar with migration scripts and make some changes on the website, so it can query blog posts from the local database and render them using Leaf.
20
20
@@ -36,35 +36,35 @@ In this chapter we will apply the same principles for the category model that we
36
36
37
37
## Chapter 9: Building a generic REST API
38
38
39
-
You'll learn abut building a standard JSON based API service. In the first section we discuss how to design a REST API, then we start building CRUD endpoints using a generic protocol oriented way. We'll talk a lot about the HTTP layer, learn how to use the cURL command line utility to test the endpoints. You'll see why it is a bad practice to use database models as API objects and finally we are going to replace our own implementation with an existing library.
39
+
You'll learn abut building a standard JSON based API service. In the first section we will discuss how to design a REST API, then we will build some building CRUD endpoints in a generic, protocol oriented way. We'll talk a lot about the HTTP layer, learn how to use the cURL command line utility to test the endpoints. You'll discover why it is a bad practice to use database models as API objects and, finally, we will protect the routes using a token based auth system.
40
40
41
-
## Chapter 10: The elephant in the room
41
+
## Chapter 10: Shared libraries & API design
42
42
43
-
In this chapter we're going to put everything into a production ready shape. We'll learn how to move away from the file based SQLite database and connect to a PostgreSQL database server. We're going to get familiar with the new Vapor command API and write a basic data transfer script. We'll refactor the modules by using ViperKit and replace the asset manager with the Liquid library to store files on AWS S3. We'll also secure the API using a token based authentication layer.
43
+
In this chapter we are going to split up some of our code into a separate library. This will allow us to use the library in other applications as well. You will learn how to create a new Swift Package from scratch and use it as a local dependency. We will move some of the API layer into the newly created package and reconnect it as a dependency. We are also going to talk about Data Transfer Objects. In the very last part I'll show you how to perform a HTTP request on the server side using the built-in async HTTP client.
44
44
45
-
## Chapter 11: Test everything
45
+
## Chapter 11: System under testing
46
46
47
47
This chapter is about learning the brand new XCTVapor framework. First we'll set up the test environment, write some basic unit tests for our application and run them. Next we are going to dig a little bit deeper in the XCTVapor framework so you can see how to write more complex tests. In the last part you will meet with a super lightweight and clean testing tool. The Spec library will allow us to write declarative specifications for our test cases.
48
48
49
-
## Chapter 12: Continuous delivery
49
+
## Chapter 12: Don't repeat yourself
50
50
51
-
Setting up a good continuous deployment workflow for an application can be hard. In this chapter we are going to containerize our backend by using Docker. After the app can run in a container we are going to use GitHub Actions to run automated unit tests. Next we set up a container repository service (ECR) on AWS to push the container images of the project and we will create a fully automated delivery system to deploy our application to the cloud with the help of ECR, Fargate (ECS) and the RDS infrastructure.
51
+
In this chapter we are going to replace the content API and view related files with external Swift packages, this way we can focus more on our business logic and worry less about building reusable components. It is also a great opportunity to refactor Leaf files and take advantage of the new features, so we don't have to copy & paste template snippets again. We'll also refactor the existing modules by using ViperKit and learn how to quickly bootstrap a new one using templates and a small command line utility tool written in Swift.
52
52
53
-
## Chapter 13: Going full-stack
53
+
## Chapter 13: A modular iOS client
54
54
55
-
In this chapter we are going to split up some of our code into a separate library. This will allow us to use the library in other applications as well. You will learn how to create a new Swift Package from scratch and use it as a dependency. We will move some of the API layer into the newly created package and reconnect it as a dependency. We are also going to talk about Data Transfer Objects and the differences between microservices and a monolithic application. In the very last part I'll show you how to perform a HTTP request on the server side using the built-in async HTTP client.
55
+
This time we are going to build a small iOS application in a modular fashion using Xcode. First, we will build a communication service layer using the previously created MyProjectApi package and the brand new Combine framework as a dependency. We will also learn how to generate VIPER modules using the Swift template tool. We will display a basic list of posts using the UIKit framework with the help of a table view. We are going to programmatically create all of the user interface, including auto layout constraints and custom views.
56
56
57
-
## Chapter 14: A basic iOS client
57
+
## Chapter 14: Sign in with Apple
58
58
59
-
This time we are going to build a small iOS application in a modular fashion using Xcode. First, we will build a communication service layer using the previously created MyProjectApi package and the brand new Combine framework as a dependency. We will also learn how to generate VIPER modules using the Swift template tool. We will display a basic list of posts using the UIKit framework with the help of a table view. We are going to programmatically create all of the user interface, including auto layout constraints and custom views.
59
+
This chapter is about integrating the Sign in with Apple service into the website and the iOS client application. You'll learn about how to set up identifiers and keys using the Apple developer portal. We are going to talk about the fundamental concepts of the sign in flow. We will configure the JWT library to sign and verify JSON Web Tokens as part of the Vapor framework. We are also going to use the public JWKS validation service by Apple and extend our user module.
60
60
61
-
## Chapter 15: Sign in with Apple & JWT
61
+
## Chapter 15: Push notifications
62
62
63
-
This chapter is about integrating the Sign in with Apple service into the website. You'll learn about how to set up identifiers and keys using the Apple developer portal. We are going to talk about the fundamental concepts of the sign in flow. We will configure the JWT library to sign and verify JSON Web Tokens as part of the Vapor framework. We are also going to use the public JWKS validation service by Apple and extend our user module.
63
+
In this chapter we are going to integrate the Apple Push Notification Service (APNs) both on the client and the server side. We are going to learn how to register for remote notifications, send device tokens to the backend and request for authorization using the UserNotifications framework. We are going to create a very basic admin interface for sending push messages using the Vapor APNS package.
64
64
65
-
## Chapter 16: Push Notification service
65
+
## Chapter 16: Infrastructures
66
66
67
-
Implementing APNS both on the client and the server side.
67
+
In this chapter we're going to upgrade our infrastructure. We'll learn how to move away from the file based SQLite database and connect to a PostgreSQL database server. We'll also use a new Liquid driver to store files on AWS S3. Next we will containerize our backend server by using Docker. After that we'll setup GitHub Actions (a continuous integration service) to run automated unit tests. Finally we configure a container repository service (ECR) on AWS to push the container images of the project and we will create a fully automated delivery system to deploy our application to the cloud with the help of ECR, Fargate (ECS) and the RDS infrastructure. As you can see we have a lot to do, so let's get started.
0 commit comments