Building a To-Do List Application using Nuxt.js
Tags: nuxt, webdev, tailwindcss, mysql
Published: 2024-04-26 14:11:07

How do you develop a To-Do List application using [Nuxt.js](nuxt.com), employing [Tailwind CSS](tailwindcss.com) for styling and [MySQL ](mysql.com)as the database? To learn how we did it, read this article. This [Nuxt js](nuxt.com) tutorial will walk you through a To-Do List application built using Nuxt.js([Nuxt 3](https://nuxt.com/blog/v3) being their latest release), Tailwind CSS, and MySQL as our database. 

### What is Nuxt.js?

Nuxt.js is a [Vue.js](vuejs.org)-based framework used to build full-stack web applications. It can build client-side rendering applications(which are built right inside your browser) and static-generated applications(which are compiled and rendered at the build time itself). Nuxt.js adds structure to your Vue.js project(it builds the app on top of Vue.js) as it comes with enterprise-ready frontend architecture. Nuxt.js features are already structured according to industry standards to create enterprise-level applications. It abstracts away most of the configuration involved in managing data, middleware, and routing.

 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jl3o1xhqv7m8u7yihgow.jpeg)

### Benefits of Nuxt.js as a Framework

Many contemporary JavaScript frameworks, such as Vue, aim to create **Single Page Applications** (SPAs). A SPA is far superior to a standard website in many ways. For instance, you may develop UIs that update quickly and are incredibly snappy. However, because there is initially no information on the website for Google to crawl for SEO purposes, SPAs also have drawbacks, such as lengthy load times. JavaScript is used to generate all of the content after the fact.

“**Universal Application**" refers to retrieving client-side data from the server via a server-side rendering technique, followed by the complete rendering of the page on the client browser.
In Vue.js, server-side rendering (SSR) is known to cause problems due to the laborious setups required to get it correctly.

Nuxt.js resolves the SSR issue in Vue.js, which is advantageous for search engine optimization (SEO). Nuxt.js can even extend universal applications to support a complete monolithic application—where the frontend and backend share a single codebase.

### Tailwind CSS

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oila4757uf9kk0xt9qwi.png)

Tailwind CSS is a low-level, highly configurable CSS framework that emphasizes utility-first design. It offers an extensive library of low-level utility classes that have already been built, making web creation quick and simple.

It offers an extensive collection of utility classes that you may use to directly combine styles in your HTML file and Javascript frameworks, like Vue and ReactJs.

Simple and Beginner-friendly: It is ideal for beginners because it was created with simplicity. Utilizing the utility-first design strategy, you can employ brief utility classes straight in your HTML code in place of creating lengthy, intricate CSS code. You can still build attractive designs without writing a lot of custom CSS.

### Introduction to the To-Do List Application

This to-do list app offers a minimalist approach to task management, focusing on core functionalities that allow users to add, remove, and mark tasks as done. Designed with simplicity and ease of use, it provides a clutter-free environment to help users concentrate on their tasks without unnecessary features. Whether for daily chores, work assignments, or personal goals, the app facilitates a straightforward way to keep track of tasks, ensuring users can effectively manage their to-dos and stay organized.

### Features of Our Application

1.**Add Todo**: Users can easily add tasks to their list, providing a simple way to keep track of new responsibilities or ideas.
2. **Delete Todo**: Allows for the deletion of tasks, ensuring users can keep their list clean and focused on current priorities.
3. **Mark Done**: Users can mark tasks as completed, providing a satisfying way to track progress and maintain motivation by visually acknowledging accomplishments.

### High Level Design

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dypz6693jtpm44a1rda1.png)

The Todo-List-Nuxt-App delivers a streamlined task management experience, powered by Nuxt.js for the frontend, and a robust Backend API connected to a MySQL database. Utilizing a clear schema, the app enables users to effortlessly manage their tasks with CRUD operations. Interactions from the frontend trigger API calls, ensuring the UI is consistently synchronized with the backend, thus providing a dynamic and responsive environment for the users to track and update their tasks in real time.

### Prerequisites

Latest LTS version of Node.js should be installed on your device in order to use the create-nuxt-app functionality, make sure you also have npm, though it comes installed with Node. If the Nuxt.js build is showing errors, it is most likely that your Node.js version is not the latest LTS version. 
Make sure you have Docker Daemon installed.

### Running the Application Locally

Make sure your Docker Daemon is running before running the commands.

Clone the repository:
`git clone https://github.com/devzero-inc/to-do-list.git
cd to-do-list
docker compose up`

The application will be visible to you at [localhost:3000](http://localhost:3000/). Feel free to interact with the UI, and manage your day-to-day chores with the To-Do List.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m689igh76os9y2yhcd51.png)

Use the Add button, and add the text as per your tasks. Clicking it will add it to the list. The list will persist as the todos are stored in our MySQL database.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11umo7e978u6lu6hfp6l.PNG)

Clicking the Add button added it to our to-do list.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/izoqcmhd0gnythhih2lv.PNG)

After you’ve completed attending your meeting, you can mark the to-do card as ‘Done’ for the particular task. This adds to a sense of accomplishment and satisfaction that you’ve successfully accomplished your targets. Marking it as Done, will strike it off.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lftskd90f28bnb17fbuc.PNG)

As you call it a day, you can delete all your to-dos and add to-dos for tomorrow as you plan your next day.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/75qorot3mzoau4bea319.PNG)

Since we’ve completed all the tasks, we will click the Delete button so that the to-dos get deleted from the database as well.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfobfp3t6v0ktn5v926y.PNG)

If you have gotten this far into the blog, give yourself a pat on the back because, guess what? You’re awesome. This is just the starting point. Please don’t keep this to yourself. Consider sharing it with fellow developers if you think it can help.

### Who We Are & What We Do?

We([Infrasity](infrasity.com)) are a tech content marketing organization that takes care of your brand and product awareness by crafting compelling technical content around infrastructure engineering, API management, GraphQL, vulnerability & security tools. We at [Infrasity ](infrasity.com)equip you with our content marketing strategies that serve you at every point of your GTM journey, from awareness of the product to quick user onboarding, as we did for a few of the other infrastructure companies by formulating technical writeups and creating recipe libraries, using different tech stacks like NodeJs, BunJS, React, Cockroach DB  that the end users can directly use as boilerplate code without writing code from scratch. This has assisted both our customers with user signups and the end users in increasing their development productivity. 
We’ve built this To-Do List Application and several other apps to help them formulate their Go-to-Market Strategy. 

Contact us at [contact@infrasity.com](contact@infrasity.com) today to help us write content that works for you and your developers.

### Written and Published by

[Pratham Sikka](www.linkedin.com/in/prathamsikka)
Full-Stack Developer @[Infrasity](infrasity.com)