DEV Community

Cover image for Build a Notes App in JavaScript with Local Storage ๐Ÿ–Š๐Ÿ“’
Dom (dcode)
Dom (dcode)

Posted on

8 1

Build a Notes App in JavaScript with Local Storage ๐Ÿ–Š๐Ÿ“’

A notes app is a great project for anyone learning HTML, CSS and JavaScript as it allows you to explore 3 key layers of a front-end application:

  • interacting with API
  • business logic
  • UI (view)

Tutorial

I'd usually go into detail of the code in these posts, but this project is a little too big. Instead, I'll give an overview and if you want more detail, you can check it out on my YouTube channel, dcode:

View the Source Code

Source code is available on GitHub:

GitHub logo dcode-youtube / notes-app-javascript-localstorage

A Notes App built with vanilla JavaScript and Local Storage.

Local Storage API

We'll have a NotesAPI.js file which contains 3 static methods for a basic CRUD operations:

  • getAllNotes() - retrieve all notes from Local Storage
  • saveNote() - saves a single note (insert OR update)
  • deleteNote() - deletes a note

UI (View)

Another file, NotesView.js will contain a class which we instantiate, and will take in the root #app element as well as a few event-based functions:

  • onNoteSelect - when the user clicks on a note in the side bar
  • onNoteAdd - when the user clicks on the "Add Note" button
  • onNoteEdit - when the user makes a change to the note title or body
  • onNoteDelete - when the user wants to delete a note

We then have various methods in the view that will update parts of the UI:

  • updateNoteList() - updates all the notes in the side bar
  • updateActiveNote() - sets a note as active

Tying It All Together

In an App.js file, we tie the API layer and the UI layer together by hooking onto the handlers to perform our CRUD actions. This can also be thought of as a "controller".

All done ๐Ÿš€

Quadratic AI

Quadratic AI โ€“ The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo ๐Ÿ“Šโœจ

Top comments (0)

Image of PulumiUP 2025

From Cloud to Platforms: What Top Engineers Are Doing Differently

Hear insights from industry leaders about the current state and future of cloud and IaC, platform engineering, and security.

Save Your Spot

๐Ÿ‘‹ Kindness is contagious

Dive into this insightful write-up, celebrated within the collaborative DEV Community. Developers at any stage are invited to contribute and elevate our shared skills.

A simple "thank you" can boost someoneโ€™s spiritsโ€”leave your kudos in the comments!

On DEV, exchanging ideas fuels progress and deepens our connections. If this post helped you, a brief note of thanks goes a long way.

Okay