We may earn an affiliate commission when you visit our partners.
Course image
Udemy logo

Building Web Applications with Go - Intermediate Level

Trevor Sawler

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).

Read more

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.

Enroll now

What's inside

Learning objectives

  • 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

Syllabus

An overview of what we are going to cover in this course.

What we are going to cover in this course

My background. I've worked in both academia and the private sector, at the same time, for quite a long time.

Read more

I make mistakes all the time, and I'm not going to hide that from you

How to ask for help
Installing and configuring the necessary software.

We going to need Go, so let's install it

You may already have a Go IDE installed, but if not, here's one that will do the job.

You're going to need a Stripe account, but it's free, so go get one.

This is entirely optional, but Make will make your life easier, so let's install it.

We'll use MariaDB, a drop in replacement for MySQL. Let's install it.

There are many choices for a MySQL compatible database client. Let's install one.

How to make a one-time credit card charge from a web page.

Let's build a virtual credit card terminal.

The Go version of hello, world for the web.

We'll need some routes, handlers, and a render function. Let's build them.

Let's build a single page.

Let's make our IDE a bit easier to work with.

We'll need a form to process credit card transactions, so let's build one.

We'll need to connect to Stripe, so let's get the necessary changes in place.

Never assume information is valid in a form. Let's set up Bootstrap's client side validation.

Stripe's paymentIntent is how we'll charge a credit card. Let's get started.

We'll get our paymentIntent from our server, so let's get started.

Let's continue on our back end, and figure out how to use Make to build and run our code.

Let's finish up our back end code to get a paymentIntent from Stripe.

Let's work on our front end a bit more.

Finally, let's charge a credit card using Stripe.

It's helpful to generate a receipt, so let's make one.

Just a bit of housekeeping.

Let's review some of the things we've covered.

Let's figure out how to charge a credit card for a one-time sale.

Let's take a look at what we are going to build in this section.

We'll need a database, so let's create one.

Let's connect our Go code to MariaDB.

We'll need a product page to sell our widget, so let's create one.

Our product page needs a form for e-commerce, so let's create it.

Let's try to avoid code duplication.

Let's improve our handler a bit.

Let's pass some information to our template.

Most users think in dollars and cents, and not just in cents. Let's make our price human readable.

Let's give this a try and see how it works.

Let's improve our database structure.

Database migrations keep your code and your database in sync. Let's use them.

We need some means of representing what's in the database and our Go code. Models are the way to go.

Let's write some functions to interact with the database.

Let's figure out how to save a transaction to the database.

Let's figure out how to save an order to the database.

Stripe sends us a lot of information. Let's figure out what we need.

We need a means of keeping track of who bought what.

Let's save customer information to the database.

Let's write some more database functions.

Let's continue with our database functions.

Let's see if this thing works.

Just some more work on the database functionality.

It's good practice to redirect the user after a POST request. Let's do that.

Let's make our code a bit cleaner.

Our changes mean that we have to update our Virtual Terminal a bit.

Everyone makes mistakes. I made one. Let's fix it.

Set up a recurring charge to a credit card.

Let's let users purchase a Stripe Plan.

Let's create a Stripe Plan.

Let's get started with our code.

We'll need another form, so let's build one.

The JavaScript to subscribe to a Stripe Plan is a bit different. Let's get started.

Just some more work with the JavaScript to buy a Stripe Plan.

We need to do some work after the subscription succeeds. Let's get started.

We'll need some new functions, so let's write them.

Let's put the finishing touches on our handler.

Let's continue working on the front end.

We need to save customer and transaction information, so let's do that.

Once again, we need a receipt. Let's build it.

Let's authenticate our end users as securely as we can.

Authentication has to be both safe, secure, and easy to use. Let's pick and approach and get started.

Users need a place to log in, so let's build a page for them.

Let's start with our JavaScript to authenticate users.

Authentication requires both a route and a handler, so let's set some up.

We're going to write a lot of JSON. Let's make our lives easier.

Let's get started with user authentication.

Sometimes you have to give a user bad news, like when their password is incorrect.

How do we make sure that a supplied password is valid?

Let's run a basic sanity check to make sure that things are wired up correctly.

Before we can send a token, we have to make one. Let's write the code to do so.

Let's build a safe, secure token, and send it to the user.

After we create a token, we'll need to get access to it later on. Let's save it to the database.

We need to put the token we get somewhere. Local storage seems like a good place.

We can vary content based on a user's status. Let's do that.

Let's get started checking for authentication.

Just a bit of clean up.

Let's get things wired up correctly so we can get started.

Our auth token comes as part of the header. Let's get it out of there so that we can work with it.

Let's make sure that the token passed to the back end is valid, and not expired.

Let's make sure everything works as expected.

Check your skills

How I solved the challenge.

Let's add some code to protect routes on the API

Let's make sure our protection works as expected.

Let's use the back end instead.

We have a nice back end. Let's use it.

It's always good to take a second (or third, or fourth) look at your code.

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Teaches fundamentals and strengthens foundations for beginners interested in web development
Applies practical hands-on experience through Go coding
Fits audience with intermediate Go experience
Builds a strong foundation for working with the Stripe API
Content includes building a front end, back end, and microservice using a single code base
May require learners to have some prior experience with Go, even if not stated explicitly

Save this course

Save Building Web Applications with Go - Intermediate Level to your list so you can find it easily later:
Save

Activities

Coming soon We're preparing activities for Building Web Applications with Go - Intermediate Level. These are activities you can do either before, during, or after a course.

Career center

Learners who complete Building Web Applications with Go - Intermediate Level will develop knowledge and skills that may be useful to these careers:
Web Developer
Web Developers use markup languages such as HTML and CSS to design and build websites. They are responsible for ensuring that websites are both visually appealing and functional. This course provides a strong foundation in web development, covering topics such as HTML, CSS, JavaScript, and Go. As a Web Developer, you may also be involved in the development of back-end systems, such as APIs and databases. In this course, you will learn how to build secure, scalable back-end systems using Go. This knowledge will help you to develop robust, reliable web applications.
Front-End Engineer
Front-End Engineers are responsible for the front-end of a web application. They design and build the user interface, and they ensure that the application is visually appealing and easy to use. This course provides a strong foundation in front-end engineering, covering topics such as HTML, CSS, JavaScript, and UI design. You will also learn how to use Go to build secure, scalable back-end systems. This knowledge will help you to develop web applications that are both efficient and reliable.
Software Engineer
Software Engineers design, develop, and maintain software systems. They work on a variety of projects, from small, single-purpose applications to large, complex enterprise systems. This course provides a strong foundation in software engineering, covering topics such as object-oriented programming, data structures, and algorithms. You will also learn how to use Go to build high-performance, scalable software systems. This knowledge will help you to develop software that is both efficient and reliable.
Full Stack Engineer
Full-Stack Engineers are responsible for both the front-end and back-end of a web application. They work on a variety of tasks, from designing the user interface to building the back-end systems that power the application. This course provides a strong foundation in full-stack development, covering topics such as HTML, CSS, JavaScript, Go, and database management. You will also learn how to use Go to build secure, scalable back-end systems. This knowledge will help you to develop web applications that are both efficient and reliable.
Back End Engineer
Back-End Engineers are responsible for the back-end of a web application. They design and build the systems that store and process data, and they ensure that the application is scalable and reliable. This course provides a strong foundation in back-end engineering, covering topics such as Go, database management, and cloud computing. You will also learn how to use Go to build secure, scalable back-end systems. This knowledge will help you to develop web applications that are both efficient and reliable.
DevOps Engineer
DevOps Engineers are responsible for the development and operation of software systems. They work with the team to ensure that the system is deployed and maintained according to the specified requirements. This course provides a strong foundation in DevOps, covering topics such as continuous integration, continuous delivery, and cloud computing. You will also learn how to use Go to build secure, scalable software systems. This knowledge will help you to develop and operate software systems that are both efficient and reliable.
Security Engineer
Security Engineers are responsible for the security of software systems. They work with the team to identify and mitigate security risks. This course provides a strong foundation in security engineering, covering topics such as cryptography, network security, and software security. You will also learn how to use Go to build secure, scalable software systems. This knowledge will help you to develop software systems that are resistant to attack.
Systems Analyst
Systems Analysts are responsible for the analysis and design of software systems. They work with the team to define the requirements of the system, and they ensure that the system is developed according to the specified requirements. This course provides a strong foundation in systems analysis, covering topics such as object-oriented programming, data structures, and algorithms. You will also learn how to use Go to build secure, scalable software systems. This knowledge will help you to develop software systems that are both efficient and reliable.
Software Architect
Software Architects are responsible for the architecture of software systems. They work with the team to define the architecture of the system, and they ensure that the system is developed according to the specified requirements. This course provides a strong foundation in software architecture, covering topics such as object-oriented programming, data structures, and algorithms. You will also learn how to use Go to build secure, scalable software systems. This knowledge will help you to develop software systems that are both efficient and reliable.
Technical Lead
Technical Leads are responsible for leading a team of software engineers. They work with the team to define the architecture of the system, and they ensure that the system is developed according to the specified requirements. This course provides a strong foundation in technical leadership, covering topics such as software architecture, project management, and team leadership. You will also learn how to use Go to build secure, scalable software systems. This knowledge will help you to lead teams that develop high-quality software systems.
Cloud Architect
Cloud Architects are responsible for the design and implementation of cloud-based solutions. They work with the team to ensure that the system is deployed and maintained according to the specified requirements. This course provides a strong foundation in cloud architecture, covering topics such as cloud computing, cloud security, and cloud management. You will also learn how to use Go to build scalable cloud-based solutions. This knowledge will help you to develop cloud-based solutions that are both efficient and reliable.
Business Analyst
Business Analysts are responsible for the analysis and design of business processes. They work with the team to define the requirements of the business process, and they ensure that the process is implemented according to the specified requirements. This course provides a strong foundation in business analysis, covering topics such as business process modeling, data analysis, and project management. You will also learn how to use Go to build secure, scalable software systems. This knowledge will help you to develop business processes that are both efficient and effective.
Data Analyst
Data Analysts are responsible for collecting, analyzing, and interpreting data. They use data to identify trends and patterns, and they develop insights that can help businesses make better decisions. This course provides a strong foundation in data analysis, covering topics such as statistics, data mining, and machine learning. You will also learn how to use Go to build scalable data analysis pipelines. This knowledge will help you to develop data-driven insights that can help businesses improve their performance.
Product Manager
Product Managers are responsible for the product vision and roadmap. They work with the team to define the product requirements, and they ensure that the product is developed according to the specified requirements. This course provides a strong foundation in product management, covering topics such as product strategy, market research, and product design. You will also learn how to use Go to build secure, scalable software systems. This knowledge will help you to develop products that meet the needs of the market.
Data Scientist
Data Scientists are responsible for the collection, analysis, and interpretation of data. They use data to identify trends and patterns, and they develop insights that can help businesses make better decisions. This course provides a strong foundation in data science, covering topics such as statistics, data mining, and machine learning. You will also learn how to use Go to build scalable data analysis pipelines. This knowledge will help you to develop data-driven insights that can help businesses improve their performance.

Reading list

We've selected six books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Building Web Applications with Go - Intermediate Level.
Is the official Go programming language specification. It provides a comprehensive overview of the language, including its syntax, semantics, and standard library.
Practical guide to building web applications with Go. It covers a wide range of topics, including routing, templating, and database integration.
Practical guide to building web applications with Go. It covers a wide range of topics, including routing, templating, and database integration.
Comprehensive guide to building web applications with Go. It covers a wide range of topics, including routing, templating, and database integration.
Gentle introduction to the Go programming language. It covers the basics of the language, including syntax, semantics, and standard library.
Fun and engaging introduction to the Go programming language. It covers the basics of the language, including syntax, semantics, and standard library.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Building Web Applications with Go - Intermediate Level.
Working with Microservices in Go (Golang)
Developing Mobile Applications Protected by Azure Active...
Learn Stripe PHP: Make Checkout Webpages
Securing Your Node.js 5 Web App
Kubernetes Security: Minimizing Microservice...
Microservices with NodeJS, React, Typescript and...
Firebase Authentication: Build Secure Angular Apps
Next.js - Build Full Stack Apps with Next.js & TypeScript
Monolith to Microservices at Scale
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser