Membership Prices Increasing in January.

Top 9 Golang Practice Projects: From Beginner To Advanced

Jayson Lennon
Jayson Lennon
hero image

One of the best ways to improve your skills and upgrade your portfolio to get hired, is to work on practice projects.

  • You get experience
  • Your project is full of awesomeness
  • And your interviewer is blown away
impressive portfolio

It's a win:win idea, but let's be honest - time is a resource we all struggle with.

And so the question becomes "Which practice projects are actually worth working on?"

It can be so confusing! There are so many guides out there listing 10, 20, or even 30 projects or more and honestly, who has the time for that?

Even worse, the projects they share will often repeat the same content and so you never learn anything new! It seriously sucks, and so to help you out, I've put together this list of my top 9 Golang practice projects for beginners and beyond.

Better still? These projects start easy and gradually get harder, so you’ll pick up new elements in each new project.

I've broken this list down into 2 paths:

Pretty handy right?

Oh and if you're stuck for time, I recommend you focus on the top 3 projects first to get the most impact for your efforts.

With all that being said, let's dive in...

⭐ Project #1. Create a web scraper

create a web scraper with golang

This is the first of our “can’t miss” projects, and it's perfect for beginners.

Why?

A web scraper is a great project for getting started with Go because it has a small number of steps. Even better still, Go has packages available to help you with these steps!

This web scraper is a terminal (command line) application. It must connect to a web resource, download specified data, and output it to the terminal.

You can grab the package for this here.

web scraper golang project package

Then, once you’ve built the scraper and got it working, feel free to level up your skills by implementing more features.

Level up even further!

Scrape more data:

  • Generating paginated URLs based on the input URL, such as example.com/blog/1, example.com/blog/2, etc
  • Following links

Add CLI arguments and flags to allow the user to customize the application:

  • Specify the URLs to scrape
  • Use custom CSS selectors
  • Enable auto-pagination based on an input pattern
  • Enable link following using a CSS selector

Implement rate limiting per domain so the user doesn't get blocked if they make lots of requests

Cache pages so subsequent runs don't need to download the same page again:

  • Download a fresh copy if the cached page is over 1 day old
  • Add a CLI flag to clear the cache
  • Add a CLI flag to ignore the cache and download the page anyway
  • Save the new page in the cache

⭐ Project #2. Create a credit card validator

create a credit card validator in golang

The 2nd of our ‘can’t miss projects’ to complete.

Credit cards will often use the Luhn algorithm to confirm the validity of a credit card number. First, implement the algorithm as a microservice and then expose the functionality with a JSON API.

This project is a web-enabled micro service. It accepts a credit card number in an HTTP request before returning a response. The response indicates whether the number is valid according to the Luhn algorithm.

Implementing this project requires a series of steps that looks something like this:

  1. Implement the Luhn algorithm
  2. Create an HTTP server
  3. Configure the server to respond to GET requests having a JSON payload
  4. Accept valid JSON requests and proceed to step 5, whilst rejecting invalid requests using an HTTP 400 status code
  5. Extract the credit card number from the JSON payload
  6. Run the Luhn algorithm on the number
  7. Wrap the result into a JSON response payload
  8. Return the payload back to the user through the HTTP server

You can grab both of the packages for this project below:

Level up even further!

You can also add functions to identify credit card numbers used by global payment networks such as Visa, MasterCard, and American Express:

  • Report the identified card network (if any) in your JSON response
  • Identify credit card numbers used by primary payment networks that operate in your regions, such as RuPay, UnionPay, JCB, Discover, EPI, or others

⭐ Project #3. Create a pixel art editor

create a pixel art editor in golang

The 3rd and final of our ‘can’t miss’ projects, and it’s a big one!

This is actually the main project inside of my own Go Programming (Golang): The Complete Developer's Guide course.

learn golang from scratch

This desktop GUI project will show you how to use Go’s standard library and structure a large project across multiple packages. You’ll then create a pixel art editor featuring multiple dialogs, pixel painting, color selection, and pan/zoom.

As well as developing your skills and gaining real-world experience, you’ll end up with a project that’ll look great on your portfolio. It truly is a win-win all round, and it’s actually a ton of fun.

You can check out the course and project here.

The course is designed to walk through absolute beginners with no coding experience to the point of having the skills and confidence to get hired.

This means it's a fantastic project for all skill levels, and zero barrier to entry - that’s why I created the project!

Sidenote: These are the top 3 practice projects that I recommend to help you get a broad understanding with Golang.

If you work on just those projects alone, you should have some impressive portfolio work that you can share with prospective employers. But remember, other people are seeing this post too so the more customized you make these projects, the more you'll stand out from other candidates.

Also, if you want to go a little deeper and get even more practice (and really stand out), here are a few extra projects that you can try.

Project #4. RESTful CRUD API

CRUD api with golang

As you probably already know, databases are a critical part of applications, and it’s what we’ll be working with.

So let me explain:

CRUD is an acronym for "Create, Read, Update, Delete", representing the basic operations available when working with a database.

This project implements CRUD operations on a database and exposes the operations through a JSON RESTful API.

While CRUD may use any interface such as web forms, CLI, GUI, etc, using a JSON API is one of the easier ways to expose the operations to an interactive user-layer.

The information saved in the database can be whatever is interesting to you.

It doesn't matter if its comic book information, movie ratings, sports scores, or weather reports. All that matters is that you write an application that can create, read, update, and delete data from the database whenever JSON messages get received.

To get started, you'll need to:

  1. Design the database tables
  2. Write CRUD queries using raw SQL or with an ORM such as GORM
  3. Create an HTTP server and HTTP handlers for each CRUD operation using the correct status codes and methods for requests and responses

Packages you can use:

Level up even further!

Level up your skills by implementing more features:

  • Add support for API keys
  • Track API usage per key and implement quotas
  • Add a fictional billing system to the API
    • Set a different price for each CRUD operation
    • Generate revenue reports and usage reports
    • Generate invoices with a detailed breakdown of API usage per key

Project #5. Form service

create a form service in golang

Processing user input is an essential task for applications.

This project is a standalone web server that hosts forms for gathering user information. It should be able to generate forms from templates and gather form responses.

Form data gets submitted from a browser or HTTP client, which the server then processes. The definition of "processed by the server" can mean whatever you'd like it to mean. At a minimum, you should save the data in a database using CRUD operations and then inform the user of the status of the operation.

The topic for this project is open-ended, and you should choose a topic you're interested in. Some examples of data you can process include user login information, survey data, event tracking, geolocation data, reviews of businesses, and asynchronous chatting.

To get started, you'll need to:

  1. Design the database tables
  2. Write database queries using raw SQL or with an ORM such as GORM
  3. Create HTML forms in template files
  4. Create an HTTP server and HTTP handlers to handle serving of forms and submission of forms

Packages you can use:

Level up even further!

Level up your skills by implementing more features:

  • Provide users with a submission ID after submitting their form, which they can use to view (not edit!) their submitted form
  • Add sequential multi-step forms (one large form split across multiple pages)
  • Add branching multi-step forms (different steps get displayed based on the submission data in a previous step)
  • Allow users to go back a step in the multi-step forms
  • Save in-progress forms so the user can complete them later (applies to multi-step forms. When loading an in-progress form, give the user an option of continuing or starting over.)
  • Implement dynamic form creation (form and database information handled using data files without recompiling the program)

Project #6. Create a URL shortener

create an URL shortener

URL shortener services offer a way to take long, cryptic URLs and turn them into easy-to-remember ones.

The project will require implementing a web server with custom HTTP responses, database accesses, HTML templating, and background job processing. It also needs to have high performance to handle traffic spikes if one of the URLs starts trending.

To get started, you'll need to:

  1. Design the database tables
  2. Write database queries using raw SQL or with an ORM such as GORM
  3. Create HTML pages in template files
  4. Create an algorithm to generate unique URLs
  5. Implement a cache layer to handle traffic spikes
  6. Create an HTTP server and HTTP handlers to handle serving HTML templates and for redirecting requests

Packages you can use:

Level up even further!

Level up your skills by implementing more features:

  • Add extra URL generating algorithms optimized for:
    • Speech (no characters that sound similar)
    • Writing (no characters that look similar)
    • Memory (easy to remember, like short phrases)
  • Allow users to create custom redirect URLs
  • Automatically delete unused URLs after some time period

Project #7. Create a student management system

student management system in golang

A student management system allows school administrators to manage student enrollments and generate reports. Administrators should be able to perform CRUD operations to work with student enrollment, set grades, schedule classes, and generate reports.

This project is an interactive menu-driven command-line program. The options available for a user should use a numbering system, and users can type the number of the option they wish to access.

For example

Teachers should have an "Enter Grades" menu option, which allows them to enter grades for students enrolled in their classes.

This project has a lot of small parts, so splitting it into multiple layers will help manage the project's complexity:

  • Data layer: handles database queries
  • Business layer (optional): verifies that data going in and out of the database is correct. An example would be verifying if a user has permission to view certain things, or validating information before saving it to the database.
  • View layer: displays information to the user
  • Interaction layer: connects the view layer with the business or data layer. This layer contains all possible actions that your application can perform.

To get started, you'll need to:

  1. Design the database tables
  2. Write database queries using raw SQL or with an ORM such as GORM
  3. Design a menu system
  4. Write functions to select a menu option
  5. Create input parsing functions
  6. Output formatted reports

Packages you can use:

Level up even further!

Level up your skills by implementing more features:

  • Log all changes to an audit log in the database
  • Create separate permissions for administrators, instructors, and students
  • Allow or deny access to specified portions of the system based on the user's position (listed above)
  • Add a web interface which is separate from the command line interface. Both should use the same database

Project #8. Concurrent grep

concurrent grep

grep is a command line tool for finding matching patterns of text. It can operate on shell input or file input and is great for highlighting what you are looking for in a large amount of text.

The goal of this project is to re-implement the grep tool using Go.

To get started, you'll need to:

  1. Write functionality to identify patterns in a line of text
  2. Implement a way to handle both input files and shell input
  3. Create a function to display matched lines
  4. Process command line flags and arguments
  5. Use Goroutines to concurrently process data

You can use the following package:

Level up even further!

Level up your skills by implementing more features:

  • Add tree view
  • Add flags to ignore files based on a glob pattern
  • Add a flag to invert matching (show lines that do not match)
  • Highlight the matched pattern with a different color
  • Add a flag to search for matches using a regular expression

Project #9. Replicated memory cache

create a replicated memory cache with golang

A replicated memory cache allows quick access to data using multiple servers.

Data gets saved in memory as a key/value pair to any of the cache servers, and then the data is replicated to other connected servers. This process enables servers in any location to serve and speed up requests to different geographic regions.

This project helps exercise your ability to reason about concurrent and distributed systems. The implementation can use eventual consistency, which means servers don't have to stay in sync simultaneously. As long as they eventually all contain the same data, it's working as intended.

Even better? You can run the application in multiple terminal windows to simulate multiple servers.

To get started, you'll need to:

  • Decide and implement a way to process requests and responses (gRPC, HTTP API, some other method)
  • Create a concurrent map to store the data
  • Write functions to modify & read the concurrent map
  • Maintain a list of peer servers to replicate with
  • Replicate data to the servers on the peer list

I'm not giving you any packages with this one. As part of skilling up, you need to be able to find solutions yourself and adapt.

Here's a few tips though.

A naive implementation to replicate data can follow these steps:

  1. New data comes in to server using a "new data" message
  2. Server saves it into the concurrent map
  3. Server iterates peer list and sends the data to each peer with "sync data" message
  4. Each peer from the list adds the data to the concurrent map. Since the data was a "sync data" message, the peer doesn't replicate it again.

Level up even further!

Level up your skills by implementing more features:

  • Allow immediate deletion of some data
  • Add "minimum replication count" functionality that will block (wait) until the data gets replicated to the indicated number of peers
    • Add a "full replication" metadata flag which will replicate data to all active peers. Block until all peers have the data
  • Add distributed locks. Locks should work per key (use full replication to implement)
  • Add expiration metadata to concurrent map entries
    • Delete expired entries when appropriate
  • Remove peers from the peer list if they stop accepting synchronization data
  • Add keepalive/heartbeat signals between the peers. If a peer stops sending signals, remove it from the peer list.

What are you waiting for? Start practicing and building these Golang projects now!

So there you have it. These are my top 9 beginner to advanced Golang projects for you to work on to sharpen your Golang skills and create a kick ass portfolio.

Remember that if you’re stuck for time or want to focus on getting hired ASAP, I recommend you work on the top 3 first. These can have some of the biggest benefits for your Golang development, while also covering a lot of what you need to know and practice.

And if you want a detailed guide on how to get started with Go and get hired as a Go Developer, check out my complete Go Programming (Golang) course here.

More from Zero To Mastery

Top 5 Reasons Why You Should Learn Golang preview
Top 5 Reasons Why You Should Learn Golang

Golang's high performance characteristics and ease of use are 2 key factors that have made it an in-demand programming language for both new and experienced software developers. What are the other 3?

Top 5 In-Demand Tech Jobs For 2024 (+ How To Land A Job In Each!) preview
Top 5 In-Demand Tech Jobs For 2024 (+ How To Land A Job In Each!)

Want to get hired in a tech job in 2024? Pick one of these 5 if you want: 1) High salary 2) Jobs available now 3) Can learn the skills as a complete beginner.

Beginners Guide to Animations in JavaScript (With Code Examples!) preview
Beginners Guide to Animations in JavaScript (With Code Examples!)

Want to add some life to your web projects? In this tutorial, you'll learn how to code animations using CSS and JavaScript (including anime.js & three.js).