# Learning By Doing Golang - ToDo App - 01

Let’s kick off our *Learning by Doing with Golang* series by building a **simple ToDo application**. This app will serve as our first hands-on project to understand the fundamentals of Go by applying them in a real-world context.

## 🧠 Pre-requisites

Before jumping into this project, we expect you to have a **basic understanding of Golang**, including:

* Basic syntax and structure
    
* Variables and data types
    
* Arithmetic and logical operators
    
* Conditional statements (`if`, `switch`)
    
* Loops (`for`)
    
* Functions and how to define/use them
    

If you're just starting out with Go and haven't covered these fundamentals yet, we recommend learning them first. You can find great beginner-friendly [**resources here**](https://go.dev/tour/welcome/1) , and once you're comfortable, come back and join us on this hands-on journey.

> **Note:** We’re intentionally keeping this app **simple** to focus on learning. As we progress, you might notice some **discrepancies or missing best practices**—that’s by design. We’ll note these issues along the way and revisit them after we've developed a deeper understanding of Go. For now, the goal is to get started without getting overwhelmed.

## 📝 What Are We Building?

We’re developing a **basic ToDo list application** that allows users to manage their tasks efficiently. The app will support the standard set of **CRUD operations**—**Create**, **Read**, **Update**, and **Delete** ToDos.

### What is ToDo app ?

A **ToDo app** is a simple task management application that helps users keep track of things they need to do.

> 🔗 **Note:** We are not building a frontend or UI for this app. All interactions will happen through **RESTful APIs**. This will help us focus purely on backend development using Golang, and better understand how to build, structure, and manage APIs effectively

## 🧩 Design and Requirements

Before diving into the implementation, let’s understand the **design requirements** of our ToDo application and the reasoning behind each decision.

## 🔍 What Do We Need?

* A place to store ToDo data
    
* A Way to Access the content Database
    
* A Way for Users to Interact with the App
    

Let’s see how we are planning that

### 🗃️ 1. Data Storage — Using MySQL

The first thing our app needs is a place to store the ToDo items. For this, we’ll use a **database**, as it's the most common and reliable way to store structured data in applications. Specifically, we’ll use a **MySQL database**

#### 💡 Why SQL?

There are two main types of databases:

* **SQL (Structured Query Language)** – stores data in a **tabular format**
    
* **NoSQL (Not only SQL)** – stores data in **document or key-value format**
    

We're choosing **SQL (MySQL)** for the following reasons:

* It’s **faster and more efficient** for structured data.
    
* Our data is **simple and relational** (each ToDo has fields like title, description, status).
    
* We don’t require the flexibility of a document-based (NoSQL) structure for this use case.
    
* It fits the purpose of a basic CRUD app with limited and predictable data.
    

### 🔌 2. Database Access — Using Golang’s Standard Library

To interact with our database and access the stored data, we need a way to **connect to the database** and **execute SQL queries**.

We’ll use one of **Go’s standard libraries** together with a **MySQL driver.** This setup allows us to:

* Open and manage database connections
    
* Execute SQL commands (INSERT, SELECT, UPDATE, DELETE)
    
* Handle errors and manage resources efficiently
    

> We'll explore the exact setup and usage of these libraries in the later section.

### 🌐 3. Application Access — Through HTTP Endpoints

Now, as an end-user, how do we interact with our application?

We’ll expose a set of **HTTP endpoints** that clients (like browsers, Postman, or frontend apps) can call using URLs.

For example:

```sql
GET    https://<your-app>/todos         → Get all ToDos  
POST   https://<your-app>/todos         → Create a new ToDo  
GET    https://<your-app>/todos/{id}    → Get a specific ToDo  
PUT    https://<your-app>/todos/{id}    → Update a ToDo  
DELETE https://<your-app>/todos/{id}    → Delete a ToDo
```

These endpoints will act as **entry points** to different operations within our app. Internally, each endpoint will trigger logic that interacts with the database and returns appropriate responses.

## 🧠 Wrapping Up

Now, we have a **high-level understanding** of what we need to build our ToDo app—and more importantly, **why** we need each component.

Don’t worry if everything doesn’t fully click yet. As we **build more apps** and go deeper into each concept, things will start to make sense. The key is to keep going.

## 🚀 What’s Next?

In the next article, we’ll focus entirely on the **Database Layer** of our application. Here's what we’ll cover:

* How to **set up a MySQL database** locally
    
* How to **connect to the database using Golang**
    
* Different approaches to database interaction in Go—and **why we’re choosing a specific one**
    
* Step-by-step guide to **implement the database layer** in our ToDo app
    

We’ll apply everything we learn directly into our project, laying a strong foundation for how our app stores and retrieves data.
