Welcome to my fullstack development diary! This repository tracks my progress as I dive into the world of web development, from React frontends to Node.js backends.
- /basics-practice: A folder for initial study and practice experiments.
- /basics-practice/backend: Node.js & Express server.
- /basics-practice/react-practice: Frontend React application (State, Material UI).
- /practice/mongoose-practice: Deep dive into Mongoose relationships and data modeling.
- /basics-practice/frontend: Vanilla JavaScript and CSS practice.
- /projects: A dedicated workspace for building fullstack, production-ready applications. 🚀
- /projects/my-app (Wanderlust): A fullstack AirBnB-like application using Express, EJS, and MongoDB for browsing and managing property listings. Featuring boilerplate layouts with
ejs-mateand full CRUD functionality.
- /projects/my-app (Wanderlust): A fullstack AirBnB-like application using Express, EJS, and MongoDB for browsing and managing property listings. Featuring boilerplate layouts with
To get this project up and running on your local machine, follow these steps:
- Node.js: Ensure you have Node.js installed (LTS version recommended).
- npm: Comes bundled with Node.js.
- MongoDB: Local instance running (default port 27017).
-
Backend:
cd basics-practice/backend npm install npm run init # Seeds the MongoDB database with initial chats npm run mongo # Starts the server in dev mode
-
Frontend (React):
cd basics-practice/react-practice npm install npm run dev
- Advanced Styling: Integrated Tailwind CSS v4 with PostCSS for modern, utility-first styling.
- Form Handling: Mastered controlled components and
event.preventDefault()for custom form submission logic. - Dynamic UI Components: Created responsive product cards and pricing tabs using props-driven data arrays.
- State & Props: Professional use of
useStatewith objects/arrays and the spread operator (...). - Lifting State Up: Architected game logic through shared parent state for the Lottery system.
- Material UI (MUI): Combined with Tailwind for a comprehensive component library experience.
- Express Server: Configured routes, ports, and middleware foundations.
- Core Server Methods: Mastered the distinction between
app.get()(specific routes),app.use()(global middleware/filters), andapp.listen()(the "start button" for the server). - HTTP Methods Deep Dive: Understanding specific use cases for
GET(fetching data) vsPOST(submitting/creating data). - Dynamic Routing: Implemented Path Parameters (e.g.,
/:username/:id) to handle dynamic URLs and extract data usingreq.params. - Query Strings: Utilized
req.queryto extract data from search parameters (e.g.,/search?q=apple) and implemented basic validation for search queries. - Templating with EJS: Integrated the EJS (Embedded JavaScript) template engine to generate dynamic HTML responses.
- Configured via
app.set("view engine", "ejs"). - Organized templates in a dedicated
/viewsdirectory. - Modular Architecture (Partials): Implemented EJS partials (using
<%- include(...) %>) to create reusable UI components like a global<head>with shared CSS. - Data Injection: Mastered passing dynamic data from Express routes to EJS views using the
res.render("template", { key: value })syntax. - In-Template Logic: Utilizing
<%= ... %>for values,<% ... %>for control flow (loops, conditionals), and<%- ... %>for raw HTML/partials. - Nested Views: Implemented organized view management by serving templates from sub-directories (e.g.,
res.render("routes_acc/home.ejs")).
- Configured via
- CommonJS (CJS) vs ES Modules (ESM):
- Refactoring Strategy: Transitioned the backend architecture from ESM (
import) back to CommonJS (require) to align with industry-standard Express tutorials and simplify the use of global variables like__dirname. - Status: Backend is now successfully running on CJS.
- Module Selection: Mastered the distinction between the two systems, opting for CJS for backend simplicity while maintaining ESM knowledge for React frontend development.
- Refactoring Strategy: Transitioned the backend architecture from ESM (
- Dynamic Data with Faker.js:
- Automated Mocking: Integrated
@faker-js/fakerto generate large volumes of realistic user data (usernames, emails, UUIDs, and passwords) for testing and prototyping. - API Adaptation: Navigated version-specific API changes (e.g., transitioning from
userName()tousername()andinternet.uuid()tostring.uuid()).
- Automated Mocking: Integrated
- Database Integration (SQL):
- MySQL Connectivity: Established connections to local MySQL servers using the
mysql2driver. - Server Management: Configured and managed a standalone MySQL Server using MySQL Workbench for database administration.
- Service Configuration: Learned to manage background services and troubleshoot connectivity between Node.js and the MySQL database engine.
- Secure Parameterized Queries: Implemented
?placeholders in SQL queries to prevent SQL Injection and handle potentially dangerous characters. - Full Database CRUD: Successfully transitioned the user management system from in-memory arrays to a persistent MySQL database.
- MySQL Connectivity: Established connections to local MySQL servers using the
- Database Integration (NoSQL):
- Mongoose Connectivity: Established connections to local MongoDB instances using the
mongooseObject Data Modeling (ODM) library. - Schema & Model Design: Mastered the "blueprint-to-engine" workflow: defining data shapes with Schemas and compiling them into Models.
- Advanced Validation (Guardrails): Implemented professional schema constraints (
min,max,minLength,maxLength) with descriptive custom error messages. - Update Integrity: Leveraged the
runValidators: trueflag in Mongoose update methods to ensure data consistency during mutations. - Asynchronous Database Operations: Practiced clean
async/awaitpatterns for database connection and data mutation. - Lazy Creation Logic: Understanding that MongoDB automatically creates databases and collections (pluralized/lowercase) only when the first document is saved.
- Unified CRUD: Translated complex SQL logic (INSERT, SELECT, UPDATE, DELETE) into intuitive Mongoose methods like
save(),find(),findByIdAndUpdate(), andfindByIdAndDelete().
- Mongoose Connectivity: Established connections to local MongoDB instances using the
- Mongoose: Chat Model: Developed a structured chat object model with fields for sender (
from), receiver (to), message (msgwithmaxLength), and timestamps (created_at). - Initial Data Seeding: Mastered database initialization using
Model.insertMany()through a dedicatedinit.jsscript for automated environment setup. - Asynchronous Flow: Leveraged
async/awaitand.then()/.catch()patterns for clean, non-blocking database operations. - Modular Data Architecture: Developed a dynamic profile system that fetches structured data from organized JSON sources.
- Dynamic Routing & params: Implemented complex path parameters (e.g.,
/ig/:username) to build an Instagram-style profile viewer. - Asset Management: Integrated external CDNs (like Unsplash) for high-quality, dynamic image rendering in backend templates.
- Middleware Mastery: Implemented global middleware to handle requests and provide custom HTML responses.
- Fullstack Flow & POST Handling:
- CORS (Cross-Origin Resource Sharing): Learned how to use the
corspackage to allow a frontend (on port 5173) to talk to a backend (on port 8080). - Body Parsing: Implemented
express.urlencodedandexpress.jsonmiddleware to "catch" data sent from HTML forms. - Registration System: Built a complete flow where a form in the frontend sends data to a
/registerPOST route in the backend.
- CORS (Cross-Origin Resource Sharing): Learned how to use the
- RESTful API Development (CRUD Implementation):
- REST Design Patterns: Adopting the standard REST naming conventions for resources (e.g.,
GET /posts,POST /posts,PATCH /posts/:id). - CRUD Operations: Implemented a complete Create, Read, Update, and Delete flow for a "Quora Post" simulation.
- Method Override: Integrated the
method-overridepackage to supportPATCHandDELETErequests from standard HTML forms using query string tagging (?_method=PATCHor?_method=DELETE). - UUID Integration: Utilized the
uuidpackage to generate globally unique identifiers for database-less data persistence. - Advanced Redirection: Mastered
res.redirect("/posts")to provide a seamless user experience after data mutations.
- REST Design Patterns: Adopting the standard REST naming conventions for resources (e.g.,
- Modern JavaScript (OOP & Classes):
- Constructor Functions: Understanding the traditional
function Personandprototypeway of creating objects. - ES6 Classes: Mastered the
classsyntax for cleaner, more modern object-oriented code. - Inheritance & super():
- Used
extendsto share logic between classes (e.g.,Student extends Person). - Learned to use
super()to call the parent constructor and avoid "unexpected keyword" syntax errors.
- Used
- Execution vs Reference: Understanding the difference between
obj.talk(the function itself) andobj.talk()(executing the function). - Debugging: Solving common issues like case-sensitivity (
Stdvsstd) and absolute paths inres.sendFile.
- Constructor Functions: Understanding the traditional
- Professional Error Handling:
- Implemented a custom ExpressError class to handle HTTP status codes and descriptive messages systematically.
- Developed a wrapAsync utility function to catch asynchronous errors in route handlers, eliminating the need for repetitive
try/catchblocks. - Integrated global error-handling middleware that renders a specialized
error.ejsview for a polished user experience.
- Stateless Authentication (JWT):
- Token-Based Security: Transitioned from session-based (cookies) to stateless JSON Web Tokens (JWT) for more scalable authentication.
- Backend Verification: Developed manual
isLoggedInmiddleware to verify tokens from theAuthorizationheader on the server. - Frontend Persistence: Implemented Axios Interceptors to automatically attach the JWT from
localStorageto all outgoing API requests. - Global Auth State: Integrated a global middleware in
app.jsto parse tokens on every request, populatingres.locals.currUserfor reactive UI updates across the SPA.
- Full Authentication (Passport.js):
- Integrated Passport and LocalStrategy for secure user registration and login flows.
- Leveraged passport-local-mongoose for automated username/password hashing and salting via Mongoose plugins.
- Implemented Automatic Login after signup and Logout functionality with specialized session clearing.
- Developed Conditional UI Rendering: Utilized
res.locals.currUserto dynamically show/hide navbar links based on the user's authentication state.
- Scalable Architecture (Express Router):
- Refactored the monolithic
app.jsinto modular, resource-based routers (listings,reviews,users) usingExpress.Router(). - Implemented Nested Routing for reviews, enabling logical paths like
/listings/:id/reviews.
- Refactored the monolithic
- Session Management:
- Configured express-session with secure options:
httpOnlycookies, expiration (maxAge), and a secret key. - Leveraged
res.localsto expose session data globally across all EJS templates.
- Configured express-session with secure options:
- Flash Messaging (UX Feedback):
- Integrated connect-flash with
express-sessionto display one-time success and error notifications. - Built a reusable
flash.ejsEJS partial (Tailwind-styled, dismissible alerts) included in the global boilerplate.
- Integrated connect-flash with
- State Management & Cookies:
- Integrated cookie-parser for client-side data persistence.
- Mastered Signed Cookies for security, preventing client-side tampering via secret keys.
- Advanced Data Modeling (Mongoose Relationships):
- One-to-Many: Implemented a robust "Listing-to-Review" relationship using ObjectIDs and
.populate().
- One-to-Many: Implemented a robust "Listing-to-Review" relationship using ObjectIDs and
- Authorization & Ownership Logic:
- Listing Ownership: Implemented logic to associate each listing with an owner, ensuring only the creator can edit or delete their property.
- Review Authorship: Automated the association of reviews with the logged-in user, allowing only authors to remove their own feedback.
- Secure Authorization Middleware: Developed
isOwnerandisReviewAuthorbackend guards to prevent unauthorized data mutations. - Conditional UI Rendering: Dynamically show/hide "Edit" and "Delete" buttons based on user permissions for both listings and reviews.
- Development Workflow: Implementation of
nodemonandpackage.jsonscripts for efficient coding cycles.
A professional-grade backend for managing user records directly in a persistent MySQL database:
- Create: A secure
/users/newroute that inserts new account records using parameterizedINSERTqueries. - Read: An efficient
indexroute (/users) displaying all registered records in a responsive HTML table. - Update: A verification-first
/users/:idPATCH route that validates the current password before authorizing an update to the username. - Delete: A multi-step
/users/:id/deleteflow that requires the user to submit their credentials (username, email, and password) for a matching record check before the record is permanently deleted. - Security Check: Integrated
.trim()logic to ignore accidental leading/trailing spaces in form submissions.
A modern, schema-based user management system leveraging the flexibility of NoSQL:
- Professional Validation: Implemented strict data typing and advanced property constraints (e.g., minimum age of 18) with user-friendly error responses.
- Persistent Updates: Ensured that schema "guardrails" remain active during updates by configuring
runValidatorsexplicitly. - Connection Reliability: Optimized connection strings using
127.0.0.1for faster local resolution on Windows. - Integrated CRUD: Full implementation of data persistence, from initial connection to retrieving and updating records.
A real-time styled backend project integrating Express with NoSQL persistence:
- Express-Mongo Bridge: Configured a dedicated Express server that communicates with a
whatsappdatabase in MongoDB. - Model-View-Controller (MVC) Prep: Organized data structures into separate
/modelsfor cleaner architecture and scalability. - Full CRUD Operations:
- Index (
GET /chats): Displays all chats with formatted sender/receiver detail. - New (
GET /chats/new): Interactive form for starting new message threads. - Create (
POST /chats): Persistently saves new chat documents to MongoDB. - Edit (
GET /chats/:id/edit): Pre-populated edit interface for modifying messages. - Update (
PUT /chats/:id): Usesmethod-overrideandfindByIdAndUpdatefor seamless message editing. - Delete (
DELETE /chats/:id/delete): Permanent removal of chat records from the database.
- Index (
- Data Persistence: Successfully implemented chat document validation and persistent storage with custom styling.
A fully functional "social media" post manager demonstrating backend state management:
- Create: A dedicated
/posts/newform that generates unique IDs viauuid. - Read: An index page (
/posts) and individual post views (/posts/:id) with 404 error handling. - Update: An edit interface (
/posts/:id/edit) utilizingmethod-overrideto performPATCHupdates on the server. - Delete: A restful deletion system (
/posts/:id) that filters the global state and redirects the user.
A modern, animated product listing UI built with Tailwind CSS:
ProductTab: A flexible flex-grid layout that renders multiple product offerings.Products: Individual card components with hover animations (transform/translate) and shadow effects.Price: A specialized component handling currency display and interactive "Buy Now" triggers.
A feature-rich weather dashboard using Material UI:
SearchBox: Real-time input handling for API queries.InfoBox: Dynamic rendering of weather conditions and thermal statistics.
A sleek, Tailwind-styled registration form demonstrating:
- Custom focus rings and transition animations.
- Prevented default reload behavior for smooth SPA interaction.
- Lottery: A logic-heavy system demonstrating state-driven win conditions and UI reactivity.
- Roll Dice: A backend-driven mini-game where Express generates a random value (1-6) and renders it dynamically using a modular EJS template.
A dynamic backend project demonstrating real-world data rendering:
- Dynamic Routing: Automatically serves different profiles based on URL sub-paths (e.g.,
/ig/cats). - Data Integration: Loads user statistics and post data from structured JSON objects.
- CDN Images: Uses professional Unsplash photography to populate a realistic "grid" view.
- Interactive UI: Shared layout structure using EJS partials for a consistent professional feel.
A professional property listing platform with full user lifecycle management, secure authentication, robust authorization, and rich interactive features:
- Secure Authentication & Authorization:
- Stateless JWT Auth: Migration from session-based cookies to stateless JSON Web Token (JWT) authentication for improved scalability and security.
- User Accounts: Powered by
Passport.jswith local strategy for secure signup, login, and logout. - Authorization Layers: Implemented ownership logic ensuring users can only manage their own listings and reviews.
- Encrypted Storage: Automatic password hashing and salting using
passport-local-mongoose. - Dynamic UI: Intuitive interface that adapts to user state (Guest vs. Owner vs. Authenticated User).
- Architecture & Extensibility:
- Modular Routing: Powered by
Express.Routerfor a clean, professional MVC-like structure. - Review System: Specialized nested routes and models for managing user feedback with author attribution.
- Security & Error Resilience: Powered by
wrapAsync, customExpressError, and Signed Cookies for secure state management.
- Modular Routing: Powered by
- User Experience (Session & Flash):
- Session-Backed State:
express-sessionensures persistent, secure user sessions across requests. - Dynamic Flash Notifications: Dismissible success/error toasts with customized messaging based on user actions and permissions.
- Reusable UI Partials: Extracted
navbar.ejs,footer.ejs, andflash.ejsinto a dedicated/views/includes/folder for DRY layout management.
- Session-Backed State:
- Category Filtering: Added category tags (Trending, Rooms, Mountains, Castles, etc.) to listings with a horizontal filter bar on the index page for one-click browsing.
- Tax Toggle (UX): Implemented a "Display total after taxes" toggle switch on the listings index that dynamically shows/hides a +18% GST indicator per card using vanilla JS.
- Like / Unlike System:
- Persistent
likesarray stored on theListingMongoDB model. - Heart button on the show page toggles a like via a
POST /listings/:id/likefetch call — no page reload. - Live like count badge updates instantly in the UI; redirects unauthenticated users to login.
- Persistent
- Validation Logic: Dual-layer resilience using Joi for schema enforcement and Tailwind Peer classes for a responsive, interactive client-side experience.
- Static Assets: Organized serving of CSS and JS from a dedicated
/publicdirectory.
- Image Uploads: Integrating Cloudinary for professional image hosting and management.
- Maps Integration: Adding interactive maps with Mapbox for property locations.
- Deployment: Taking the application live on a production cloud platform.
Keep coding, keep learning!