How iamakashyadav/note-taking-web-app works
Project Type and Purpose
• This is a small full-stack note-taking web application built on a classic LAMP-style architecture.
• Front-end: plain HTML, CSS, JavaScript
• Back-end: PHP
• Database: MySQL
• Purpose: allow users to register, log in, and perform CRUD operations (create, read, update, delete) on notes.
File Structure Analysis
• Top-level PHP entrypoints:
• index.php (landing/home page)
• register.php (user sign-up)
• login.php (authentication)
• logout.php (end session)
• notes.php (notes dashboard and CRUD endpoints)
• config/db_connect.php: central database connection logic
• css/: stylesheets (auth.css, index.css, notes.css)
• js/notes.js: front-end logic for note creation/editing
• img/: static assets
• No external frameworks—everything served by a single PHP application
Key Architectural Components
a. Client (Browser)
• Fetches HTML/CSS/JS from the server
• Renders pages, invokes AJAX (if used) or form submissions
b. Web Server & PHP Runtime
• Apache (or similar) with PHP interpreter
• Routes requests to the appropriate PHP script (index, login, notes, etc.)
• Uses config/db_connect.php to open a MySQL connection
c. MySQL Database
• Two tables: user (user_id, email, password, name, created_at) and notes (note_id, user_id, title, note, created_at, last_updated_at)
d. Static File Server
• Serves CSS, JS, and image files
Interactions and Data Flow
1. User navigates to index.php → server returns HTML/CSS
2. User submits register.php/login.php form → PHP script validates input, writes or reads from MySQL, sets a session cookie
3. Upon successful auth, user is redirected to notes.php → PHP queries the notes table for the logged-in user
4. notes.php serves the notes page and includes notes.js to handle client-side note operations (edit/delete via form submits or AJAX)
5. Any create/edit/delete triggers another HTTP request to notes.php → PHP updates MySQL → returns updated HTML fragment or JSON
6. logout.php destroys the session and redirects
Architectural Patterns & Principles
• Separation of concerns:
• Static assets (css/, js/, img/) vs. dynamic endpoints (.php)
• Centralized DB connection (config/db_connect.php)
• CRUD pattern for notes
• Session-based authentication
• Simplest MVC-style (though not a formal framework):
• “View” = HTML/CSS, “Controller” = PHP scripts, “Model” = MySQL tables