Introduction
In this project, I developed a robust full-stack notes application designed to manage and organize notes efficiently. The application showcases several modern web development practices, including a RESTful API, dynamic UI updates, and state management, ensuring a great user experience.
This project demonstrates how to build a full-stack application with modern technologies and best practices. Itβs a great starting point for anyone looking to build similar CRUD-based applications. You can explore the code and contribute to the project on GitHub.
ScreenShots
Features
Here are the key features of the application:
Add Notes: Users can create new notes with a title and rich text content.
Edit Notes: Existing notes can be updated seamlessly with an intuitive UI.
Delete Notes: Notes can be deleted with a confirmation modal for added safety.
Search Notes: Users can search for notes dynamically with real-time filtering.
Responsive Design: The application is styled with Tailwind CSS for a clean and responsive interface.
Loading Indicators: A loading spinner or skeleton UI is displayed during data fetching to enhance UX.
Toast Notifications: Success and error messages are shown using the react-toastify library for better feedback.
Reusable Components: Components like modals, note cards, and the navbar are modular and reusable.
Backend Overview
The backend is built using Node.js and Express, with SQLite as the database. It exposes a RESTful API for CRUD operations.
Endpoints:
GET /api/notes
: Fetch all notes.GET /api/notes/:id
: Fetch a specific note by ID.POST /api/notes
: Add a new note.PUT /api/notes/:id
: Update a specific note.DELETE /api/notes/:id
: Delete a specific note.
Example Code for Backend:
const express = require('express');
const router = express.Router();
const { addNote, getNotes, getNoteById, updateNote, deleteNote } = require('../controllers/noteController');
router.get('/', getNotes);
router.get('/:id', getNoteById);
router.post('/', addNote);
router.put('/:id', updateNote);
router.delete('/:id', deleteNote);
module.exports = router;
Frontend Overview
The frontend is developed using React and styled with Tailwind CSS. Routing is handled by react-router-dom.
Components:
Navbar: Contains links to different pages like Home, Add Note, and About.
NoteCard: Displays individual notes with options to view, edit, or delete.
Search Bar: Filters notes dynamically based on the user's input.
Add/Edit Note Form: Allows users to create or edit notes with a rich text editor.
Confirmation Modal: Ensures safety when deleting notes.
Context API for State Management
To manage global loading states, I used the Context API:
LoadingContext.js:
import { createContext, useState } from 'react';
export const LoadingContext = createContext();
export const LoadingProvider = ({ children }) => {
const [loading, setLoading] = useState(false);
return (
<LoadingContext.Provider value={{ loading, setLoading }}>
{children}
</LoadingContext.Provider>
);
};
Axios Configuration
To manage API requests more efficiently, I created a centralized Axios config file:
axiosConfig.js:
import axios from 'axios';
const axiosInstance = axios.create({
baseURL: 'http://localhost:5000/api/',
headers: { 'Content-Type': 'application/json' },
});
export default axiosInstance;
Folder Structure
The project is structured to ensure scalability and maintainability:
frontend/
βββ src/
βββ components/
β βββ Navbar.js
β βββ NoteCard.js
β βββ DeleteModal.js
βββ pages/
β βββ Home.js
β βββ AddNote.js
β βββ EditNote.js
βββ config/
β βββ axiosConfig.js
βββ context/
β βββ LoadingContext.js
βββ App.js
backend/
βββ controllers/
βββ models/
βββ routes/
βββ server.js
Challenges Faced
Dynamic Filtering: Ensuring the search function updates the note list in real time.
User Experience: Balancing performance and a polished UI with features like skeleton loading and toast notifications.
Things you can add to improve your skills:
User Authentication: Add login/signup functionality to secure user notes.
Tagging and Categorization: Allow users to organize notes with tags.
Export Notes: Provide an option to export notes as PDFs or text files.
Dark Mode: Enhance UI by adding a dark theme toggle.
Conclusion
This project demonstrates how to build a full-stack application with modern technologies and best practices. Itβs a great starting point for anyone looking to build similar CRUD-based applications. You can explore the code and contribute to the project on GitHub.
I hope you find this project useful and inspiring! Feel free to leave feedback or suggestions. π
Follow Me
Thank you for reading my blog. π You can follow me on GitHub and connect on Twitter
Top comments (0)