
Understand the course structure and the application we’ll build.
Install Go, check the installation, and prepare your editor.
Create a Go module, understand package main, and run a program.
Declare variables and constants, choose types, and understand default values.
Store collections of data, access their values, and iterate with range.
Write reusable functions, return multiple values, and handle errors.
Define custom types that group related information into named fields.
Use pointers to access and change values, and attach methods to types.
Decode JSON into Go structs, validate input, and return JSON responses with appropriate status codes.
Create a hosted PostgreSQL database and obtain its connection URL.
Define users, sessions, and posts tables using primary keys, relationships, constraints, and defaults.
Use database/sql and the pgx driver to open and verify a database connection.
Load a local .env file and keep database credentials outside your source code.
Check database connectivity and return an HTTP response that reports the application’s health.
Understand the registration, login, session, and logout flow we’ll implement.
Create helpers for reading JSON, returning responses, and validating email addresses.
Model user data with Go structs and keep password hashes out of API responses.
Validate registration data, hash passwords with bcrypt, and save users in PostgreSQL.
Generate session tokens, store their hashes, and set HttpOnly cookies.
Verify credentials, compare password hashes, and create a session after a successful login.
Validate session cookies, identify the logged-in user, and protect the current-user endpoint.
Delete the stored session and clear the authentication cookie.
Understand the endpoints we’ll build and how posts belong to authenticated users.
Model posts, validate titles and content, and read post IDs from request paths.
Save new posts as drafts in PostgreSQL and associate them with the logged-in author.
Query published posts and return them as a JSON collection.
Return an author’s own posts, including unpublished drafts.
Look up a post by ID and apply visibility rules for published posts and private drafts.
Update a post’s title and body while allowing only its author to make changes.
Change a post’s publication status while enforcing author ownership.
Delete a post only when it belongs to the authenticated user.
Understand what an origin is and why browsers require CORS when a frontend calls an API on a different origin.
Configure the allowed frontend origin, enable credentials, set response headers, and handle OPTIONS preflight requests.
Understand how the frontend, Go API, and session authentication work together.
Create the frontend project and configure the tools used to build its interface.
Model users, posts, and action responses to match the data returned by Go.
Create apiFetch and reusable server functions for communicating with the Go API.
Implement server-side login and logout requests and manage the session cookie in Next.js.
Create the navigation, page container, and footer with Tailwind CSS and shadcn/ui.
Fetch posts in a Server Component and render them as linked article cards.
Load a post using its route ID and handle posts that cannot be found.
Connect the login form to a Server Action and display pending states and validation errors.
Connect the logout button, clear the session, and show navigation based on login status.
Require authentication, submit new posts through a Server Action, and display success or error feedback.
Learn Go by building an application step by step—from your first program to an authenticated REST API connected to a Next.js frontend.
This course starts with the fundamentals and introduces new concepts as we need them. You’ll write the code, understand what it does, and test the application as it grows.
We begin by installing Go and preparing your development environment. You’ll learn variables, constants, types, conditions, loops, arrays, slices, maps, functions, and error handling. We’ll then explore structs, pointers, and methods so you can organize data and understand the code behind our API.
Next, you’ll build an HTTP server using Go’s standard library. You’ll register routes, handle incoming requests, decode JSON, validate input, and return responses with appropriate HTTP status codes.
You’ll connect the application to PostgreSQL using Neon and pgx, create related database tables, and keep configuration outside your source code using environment variables.
Authentication comes next. Together, we’ll implement registration, password hashing with bcrypt, login, session storage, HttpOnly cookies, protected routes, and logout. You’ll see how the application identifies a logged-in user and controls access to their data.
With authentication in place, you’ll build a blog REST API with post creation, listing, updates, deletion, drafts, and publishing. Ownership checks will ensure that users can modify only their own posts.
Finally, you’ll implement CORS middleware and build a focused Next.js frontend using TypeScript, Tailwind CSS, and shadcn/ui. Server Components and Server Actions will connect the interface to your Go backend, including login, logout, and protected post creation.
By the end, you’ll have practical experience building a Go backend, working with PostgreSQL, implementing session authentication, and connecting an API to a frontend.
Basic programming knowledge is helpful. No prior Go experience is required, and basic React knowledge is recommended for the Next.js section