Course Overview
This course is the followup to Building Modern Web Applications in Go. In this course, we go further than we did the first time around. We will build a sample E-Commerce application that consists of multiple, separate applications: a front end (which services content to the end user as web pages); a back end API (which is called by the front end as necessary), and a microservice that performs only one task, but performs it extremely well (dynamically building PDF invoices and sending them to customers as an email attachment).
The application will sell individual items, as well as allow users to purchase a monthly subscription. All credit card transactions will be processed through Stripe, which is arguably one of the most popular payment processing systems available today, and for good reason: developers love it. Stripe offers a rich API (application programming interface), and it is available in more than 35 countries around the world, and works with more than 135 currencies. Literally millions of organizations and businesses use Stripe’s software and APIs to accept payments, send payouts, and manage their businesses online with the Stripe dashboard. However, in many cases, developers want to be able to build a more customized solution, and not require end users to log in to both a web application and the Stripe dashboard. That is precisely the kind of thing that we will be covering in this course.
We will start with a simple Virtual Terminal, which can be used to process so-called "card not present" transactions. This will be a fully functional web application, built from the ground up on Go (sometimes referred to as Golang). The front end will be rendered using Go's rich html/template package, and authenticated users will be able to process credit card payments from a secure form, integrated with the Stripe API. In this section of the course, we will cover the following:
How to build a secure, production ready web application in Go
How to capture the necessary information for a secure online credit card transaction
How to call the Stripe API from a Go back end to create a paymentIntent (Stripe's object for authorizing and making a transaction)
Once we have that out of the way, we'll build a second web application in the next section of the course, consisting of a simple web site that allows users to purchase a product, or purchase a monthly subscription. Again, this will be a web application built from the ground up in Go. In this section of the course, we'll cover the following:
How to allow users to purchase a single product
How to allow users to purchase a recurring monthly subscription (a Stripe Plan)
How to handle cancellations and refunds
How to save all transaction information to a database (for refunds, reporting, etc).
How to refund a transaction
How to cancel a subscription
How to secure access to the front end (via session authentication)
How to secure access to the back end API (using stateful tokens)
How to manage users (add/edit/delete)
How to allow users to reset their passwords safely and securely
How to log a user out and cancel their account instantly, over websockets
Once this is complete, we'll start work on the microservice. A microservice is a particular approach to software development that has the basic premise of building very small applications that do one thing, but do it very well. A microservice does not care in the slightest about what application calls it; it is completely separate, and completely agnostic. We'll build a microserivce that does the following:
Accepts a JSON payload describing an individual purchase
Produces a PDF invoice with information from the JSON payload
Creates an email to the customer, and attaches the PDF to it
Sends the email
All of these components (front end, back end, and microservice) will be built using a single code base that produces multiple binaries, using Gnu Make.
FAQ
FAQ area empty
Course curriculum
Chương 1 Introduction 4 bài · 8 phút
Chương 2 Setting up our environment 6 bài · 10 phút
Chương 3 Building a virtual credit card terminal 17 bài · 2 giờ 47 phút
- What we're going to build Học thử 2:16
- Setting up a (trivial) web application Học thử 14:56
- Setting up routes and building a render function Xem trước 20:39
- Displaying one page Xem trước 8:56
- A better extension for Go templates and VS Code Xem trước 3:10
- Creating the form Xem trước 11:32
- Connecting our form to stripe.js Xem trước 10:43
- Client side validation Xem trước 7:48
- Getting the paymentIntent - setting up the back end package Xem trước 15:45
- Getting the paymentIntent - starting work on the back end api Xem trước 9:32
- Getting the paymentIntent - setting up a route and handler, and using make Xem trước 10:50
- Getting the paymentIntent - finishing up our handler Xem trước 8:47
- Updating the front end JavaScript to call our paymentIntent handler Xem trước 9:01
- Getting the payment intent, and completing the transaction Xem trước 17:34
- Generating a receipt Xem trước 11:50
- Cleaning up the API url and Stripe Publishable Key on our form Xem trước 4:07
-
Test your knowledge
Chương 4 Selling a product online 28 bài · 3 giờ 11 phút
- What are we going to build? Xem trước 1:35
- Create the database Xem trước 1:33
- Connecting to the database Xem trước 8:18
- Creating a product page Xem trước 5:56
- Creating the product form Xem trước 4:19
- Moving JavaScript to a reusable file Xem trước 4:28
- Modifying the handler to take a struct Xem trước 9:24
- Update the Widget page to use data passed to the template Xem trước 4:55
- Creating a formatCurrency template function Xem trước 3:26
- Testing the transaction functionality Xem trước 4:12
- Creating a database table for items for sale Xem trước 10:42
- Running database migrations Xem trước 2:55
- Creating database models Xem trước 10:20
- Working on database functions Xem trước 5:51
- Inserting a new transaction Xem trước 3:58
- Inserting a new order Xem trước 2:20
- An aside: fixing a problem with calculating the amount Xem trước 5:20
- Getting more information about a transaction Xem trước 13:47
- Customers Xem trước 10:19
- Getting started saving customer and transaction information Xem trước 10:09
- Create the save customer database method Xem trước 2:18
- Saving the customer, transaction, and order from the handler Xem trước 16:27
- Running a test transaction Xem trước 6:34
- Fixing a database error, and saving more details Xem trước 8:21
- Redirecting after post Xem trước 6:35
- Simplifying our PaymentSucceeded handler Xem trước 15:58
- Revising our Virtual Terminal Xem trước 9:37
- Fixing a mistake in the formatCurrency template function Xem trước 1:39
Chương 5 Setting up and charging a recurring payment using Stripe Plans 12 bài · 1 giờ 24 phút
- What are we going to build in this section? Xem trước 2:01
- Creating a Plan on the Stripe Dashboard Xem trước 3:05
- Creating stubs for the front end page and handler Xem trước 4:39
- Setting up the form Xem trước 9:19
- Working on the JavaScript for plans Xem trước 7:03
- Continuing with the Javascript for subscribing to a plan Xem trước 4:49
- Create a handler for the POST request after a user is subscribed Xem trước 6:28
- Create methods to create a Stripe customer and subscribe to a plan Xem trước 8:51
- Updating our handler to complete a subscription Xem trước 6:11
- Saving transaction & customer information to the database Xem trước 9:59
- Saving transaction & customer information II Xem trước 14:29
- Displaying a receipt page for the Bronze Plan Xem trước 7:16
Chương 6 Authentication 27 bài · 2 giờ 38 phút
- Introduction Xem trước 3:45
- Creating a login page Xem trước 7:03
- Writing the stub javascript to authenticate against the back end Xem trước 3:24
- Create a route and handler for authentication Xem trước 13:37
- Create a writeJSON helper function Xem trước 4:13
- Starting the authentication process Xem trước 5:56
- Creating an invalidCredentials helper function Xem trước 3:07
- Creating a passwordMatches helper function Xem trước 6:19
- Making sure that everything works Xem trước 1:45
- Create a function to generate a token Xem trước 7:25
- Generating and sending back a token Xem trước 3:55
- Saving the token to the database Xem trước 7:31
- Saving the token to local storage Xem trước 8:04
- Changing the login link based on authentication status Xem trước 9:23
- Checking authentication on the back end Xem trước 11:21
- A bit of housekeeping Xem trước 0:46
- Creating stub functions to validate a token Xem trước 4:49
- Extracting the token from the authorization header Xem trước 4:28
- Validating the token on the back end Xem trước 6:16
- Testing out our token validation Xem trước 5:22
- Challenge: Checking for expiry Xem trước 1:16
- Solution to challenge Xem trước 6:19
- Implementing middleware to protect specfic routes Xem trước 3:34
- Trying out a protected route Xem trước 2:26
- Converting the Virtual Terminal post to use the back end Xem trước 10:16
- Changing the virtual terminal page to use fetch Xem trước 13:08
- Verifying the saved transaction Xem trước 2:39
Chương 7 Protecting routes on the Front End and improving authentication 4 bài · 25 phút
Chương 8 Mail and Password Resets 13 bài · 1 giờ 49 phút
- Password resets Xem trước 9:48
- Sending mail Part I Xem trước 14:15
- Mailtrap.io Xem trước 1:48
- Sending mail Part II Xem trước 10:44
- Creating our mail templates and sending a test email Xem trước 10:12
- Implementing signed links for our email message Xem trước 12:44
- Using our urlsigner package Xem trước 6:33
- Creating the reset password route and handler Xem trước 6:19
- Setting up the reset password page Xem trước 6:45
- Creating a back end route to handle password resets Xem trước 9:12
- Setting an expiry for password reset emails Xem trước 3:21
- Adding an encryption package Xem trước 12:19
- Using our encryption package to lock down password resets Xem trước 5:27
Chương 9 Building Admin pages to manage purchases 14 bài · 1 giờ 12 phút
- Improving our front end and setting up an Admin menu Xem trước 7:30
- Setting up stub pages for sales and subscriptions Xem trước 6:22
- Updating migrations and resetting the database Xem trước 3:31
- Listing all sales: database query Xem trước 4:57
- Listing all sales: database function Xem trước 5:58
- Listing all sales: writing the API handler and route Xem trước 2:02
- Listing all sales: front end javascript Xem trước 6:26
- Displaying our results in a table Xem trước 5:25
- Making our table prettier, and adding some checks in JavaScript Xem trước 4:52
- Challenge Xem trước 1:40
- Solution to challenge Xem trước 2:08
- Displaying a sale: part 1 Xem trước 11:24
- Displaying a sale: part 2 Xem trước 5:00
- Displaying a subscription Xem trước 4:44
Chương 10 Refunds 7 bài · 42 phút
- Refunds from the Stripe Dashboard Xem trước 1:01
- Adding a refund function to our cards package Xem trước 3:22
- Creating an API handler to process refunds Xem trước 6:55
- Update the front end for refunds Xem trước 14:10
- Improving the front end Xem trước 3:19
- Adding UI components to the sales page Xem trước 9:05
- Updating status to refunded in the database Xem trước 4:00
Chương 11 Cancelling Subscriptions 5 bài · 22 phút
Chương 12 Paginating Data 7 bài · 36 phút
- Creating a database method to paginate all orders Xem trước 6:46
- Modifying the AllSales handler to use paginated data Xem trước 4:01
- Updating the all-sales.page.gohtml template Xem trước 5:37
- Improving pagination on the front end Xem trước 9:32
- Adding listeners to page navigation buttons Xem trước 4:19
- Taking user to correct page of data on click Xem trước 3:17
- How I implemented pagination on the all subscriptions page Xem trước 2:14
Chương 13 Managing Users 17 bài · 1 giờ 47 phút
- Setting up templates to manage users Xem trước 5:59
- Adding routes and handlers on the front end Xem trước 2:29
- Writing the database functions to manage users Xem trước 10:28
- Creating a handler and route for all users on the back end Xem trước 1:58
- Updating the front end to call AllUsers Xem trước 2:31
- Displaying the list of users Xem trước 4:02
- Creating a user add/edit form Xem trước 7:03
- Call the api back end to get one user Xem trước 5:52
- Populating the user form, and a challenge Xem trước 6:43
- Solution to challenge Xem trước 2:55
- Saving an edited user - part one Xem trước 5:44
- Saving an edited user - part two Xem trước 8:42
- Deleting a user Xem trước 7:42
- Removing the deleted users token from the database Xem trước 3:28
- Setting up websockets Xem trước 18:49
- Connecting to WebSockets from the browser Xem trước 6:24
- Logging the deleted user out over websockets Xem trước 5:59
Chương 14 Microservices 9 bài · 1 giờ 10 phút
- What are microservices? Xem trước 1:36
- Setting up a simple microservice Xem trước 14:07
- Receiving data with our micrsoservice Xem trước 6:43
- Generating an invoice as a PDF Xem trước 20:21
- Testing our PDF Xem trước 5:29
- Mailing the invoice Xem trước 8:14
- Call the microservice when a Widget is sold Xem trước 9:40
- Challenge Xem trước 1:34
- Solution Xem trước 2:35
Chương 15 Validation 3 bài · 20 phút
Chương 16 Where to go next 1 bài · 2 phút
Requirment
-
A basic understanding of the Go programming language
-
A basic understanding of HTML, CSS, and JavaScript
-
A basic understanding of SQL syntax
Outcomes
-
How to build a front end website using Go
-
How to build a back end API using Go
-
How to build multiple applications from a single code base
-
How to build microservices in Go
-
User authentication in Go
-
API authentication using stateful tokens
-
How to allow users to reset a password in a safe, secure manner
-
How to integrate Stripe credit card processing with a Go back end
-
Make one time or recurring payments with Stripe
-
Best practices for making secure credit card transactions
1 Student
1 Course
0 review