Skip to main content

Build a Complete Full-Stack Web App with Vue.js, Node.js & MySQL

Full-stack web development means building both the frontend that users interact with and the backend that manages data, APIs, authentication, and database operations. In this guide, you will learn how Vue.js, Node.js, Express, MySQL, and Axios work together to create a complete web application.

Build a Complete Full-Stack Web App with Vue.js, Node.js & MySQL

Full-stack web app with Vue.js Node.js and MySQL concept image
A full-stack web app connects the Vue.js frontend, Node.js backend, Express API, and MySQL database.

Introduction

Are you ready to take your web development skills to the next level? Building a complete full-stack web application is one of the best ways to understand how modern websites and web apps really work.

In this beginner-friendly guide, you will learn how to build a complete full-stack application using:

  • Frontend: Vue.js
  • Backend: Node.js with Express.js
  • Database: MySQL
  • API Communication: Axios
  • Styling: Custom CSS with optional dark mode
Simple definition: A full-stack app includes a frontend interface, backend server, API routes, and database. Users interact with the frontend, the backend processes requests, and the database stores the data.

This tutorial is suitable for students, beginner developers, frontend developers learning backend development, and anyone building a portfolio project with real frontend-backend-database integration.


Watch the Full Video Tutorials

You can also follow the hands-on video tutorials here:

Backend tutorial: Backend Development with Node.js + MySQL


What You Will Learn

  1. How to set up a Vue.js project.
  2. How to use Axios to make API calls from the frontend.
  3. How to create a backend server with Node.js and Express.js.
  4. How to connect backend routes to a MySQL database.
  5. How to structure frontend and backend folders clearly.
  6. How frontend and backend communicate through REST APIs.
  7. How to fetch, insert, update, and delete data.
  8. How to test and run a full-stack web app locally.
  9. How to think about security, deployment, and scalability.

What Is Full-Stack Web Development?

Full-stack web development means working with both the client-side and server-side parts of a web application. A full-stack developer understands how the user interface, backend logic, APIs, and database work together.

Layer What It Does Example Technology
Frontend The part users see and interact with in the browser. Vue.js, HTML, CSS, JavaScript
Backend The server-side logic that receives requests and sends responses. Node.js, Express.js
API The communication layer between frontend and backend. REST API, JSON, Axios
Database Stores application data permanently. MySQL
Deployment Makes the application available online. Firebase Hosting, Vercel, Render, Cloud Run, Railway
Easy way to remember:
Frontend shows data.
Backend processes data.
Database stores data.
API connects everything.

Tech Stack Overview

Layer Technology Purpose
Frontend Vue.js Builds the interactive user interface.
Backend Node.js + Express.js Creates API routes and handles server-side logic.
Database MySQL Stores structured application data in tables.
HTTP Client Axios Sends requests from Vue.js to the backend API.
Styling Custom CSS Creates responsive layouts, colors, spacing, and optional dark mode.
Development Tools npm, Git, VS Code, MySQL Workbench Helps install packages, manage code, and work with the database.

Why Use Vue.js for the Frontend?

Vue.js is a progressive JavaScript framework used to build dynamic and reactive user interfaces. It is beginner-friendly, flexible, and works well for single-page applications.

Vue.js Benefits

  • Easy to learn compared with many frontend frameworks.
  • Component-based structure for reusable UI blocks.
  • Reactive data binding for dynamic interfaces.
  • Works well with Axios for API communication.
  • Good documentation and strong community support.
Frontend role: Vue.js displays the data, handles user interactions, and sends requests to the backend when users create, update, or delete records.

Why Use Node.js and Express for the Backend?

Node.js allows JavaScript to run on the server. Express.js is a lightweight backend framework that helps create API routes, middleware, and server logic.

Node.js + Express Benefits

  • Uses JavaScript on both frontend and backend.
  • Good for REST API development.
  • Simple routing with Express.
  • Works well with MySQL drivers and ORMs.
  • Large npm ecosystem for backend packages.
Example backend route:
A Vue app sends a request to /api/products. Express receives the request, queries MySQL, and sends product data back as JSON.

Why Use MySQL for the Database?

MySQL is a relational database used to store structured data in tables. It is suitable for apps that have clear relationships, such as users, products, orders, medicines, categories, and transactions.

MySQL Benefits

  • Good for structured data and table relationships.
  • Uses SQL queries for creating, reading, updating, and deleting records.
  • Reliable for business, inventory, and reporting applications.
  • Works with tools such as MySQL Workbench and phpMyAdmin.
  • Can be hosted locally or in managed cloud services such as Cloud SQL or Amazon RDS.

How Frontend, Backend, and Database Communicate

In a full-stack app, the frontend and backend communicate using HTTP requests. The backend then communicates with the database and sends the result back to the frontend.

User clicks a button in Vue.js ↓ Vue sends request using Axios ↓ Express API receives the request ↓ Backend runs a MySQL query ↓ MySQL returns data ↓ Express sends JSON response ↓ Vue updates the page

Common API Methods

HTTP Method Purpose Example Endpoint
GET Read data. GET /api/products
POST Create new data. POST /api/products
PUT / PATCH Update existing data. PUT /api/products/:id
DELETE Delete data. DELETE /api/products/:id

Recommended Project Folder Structure

A clear folder structure makes your project easier to maintain. You can keep frontend and backend in separate folders.

fullstack-vue-node-mysql/ ├── frontend/ │ ├── src/ │ │ ├── assets/ │ │ ├── components/ │ │ ├── views/ │ │ ├── router/ │ │ └── App.vue │ └── package.json │ ├── backend/ │ ├── config/ │ ├── controllers/ │ ├── middleware/ │ ├── models/ │ ├── routes/ │ ├── server.js │ └── package.json │ └── README.md

Frontend Folder Explanation

Folder Purpose
components/ Reusable UI parts such as buttons, cards, tables, and forms.
views/ Main page-level components such as Home, Dashboard, ProductList, or Login.
router/ Vue Router configuration for page navigation.
assets/ Images, icons, styles, and static resources.

Backend Folder Explanation

Folder Purpose
routes/ Defines API endpoints such as product routes or user routes.
controllers/ Contains request-handling logic for each route.
models/ Contains database query functions or data access logic.
config/ Stores database connection and environment configuration.
middleware/ Handles validation, authentication, CORS, logging, or error handling.

Example MySQL Table

For a beginner CRUD project, you can start with a simple products table.

CREATE DATABASE fullstack_app; USE fullstack_app; CREATE TABLE products ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, price DECIMAL(10, 2) NOT NULL, description TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );

This table can store product records and can be used for basic create, read, update, and delete operations.


Example Backend Setup Commands

Inside your backend folder, initialize Node.js and install common packages:

mkdir backend cd backend npm init -y npm install express mysql2 cors dotenv npm install --save-dev nodemon

Recommended Backend Scripts

{ "scripts": { "start": "node server.js", "dev": "nodemon server.js" } }
Security note: Store database credentials in a .env file, and never upload real passwords to GitHub.

Example Environment Variables

A backend .env file can store configuration values:

PORT=5000 DB_HOST=localhost DB_USER=root DB_PASSWORD=your_password DB_NAME=fullstack_app

Your backend can read these values using the dotenv package.

Important: Environment variables in the backend can store secrets. Frontend environment variables should not contain private database passwords or secret API keys because browser users can inspect frontend code.

Example API Flow

A typical product list flow looks like this:

GET /api/products ↓ Express route receives request ↓ Controller calls model function ↓ Model runs SELECT query in MySQL ↓ Database returns rows ↓ API returns JSON ↓ Vue displays product table

Example JSON Response

[ { "id": 1, "name": "Notebook", "price": 4.99, "description": "A simple notebook" }, { "id": 2, "name": "Pen", "price": 1.50, "description": "Blue ink pen" } ]

Using Axios in Vue.js

Axios is a JavaScript library for sending HTTP requests. In this project, Vue uses Axios to communicate with the Node.js backend.

npm install axios

Example Axios request:

import axios from "axios"; const response = await axios.get("http://localhost:5000/api/products"); console.log(response.data);
Best practice: Store your API base URL in one place so you can easily switch between local development and production deployment.

Running the Full-Stack App Locally

During development, you usually run the frontend and backend in separate terminals.

Terminal 1: Run Backend

cd backend npm run dev

Terminal 2: Run Frontend

cd frontend npm install npm run serve

Depending on your Vue setup, the frontend may run on http://localhost:8080 or http://localhost:5173. The backend may run on http://localhost:5000.


Security Considerations in Full-Stack Apps

Security is important even in beginner projects. A full-stack app handles user input, API requests, database queries, and sometimes authentication.

Security Area Good Practice
Environment variables Store database passwords and secret keys in backend .env files or secret managers.
SQL injection prevention Use prepared statements, parameterized queries, or trusted ORM/query builders.
Input validation Validate user input on both frontend and backend.
CORS Configure CORS carefully instead of allowing every origin in production.
Authentication Use secure login, password hashing, token expiration, and protected routes when needed.
HTTPS Use HTTPS in production to protect data in transit.
Error handling Do not expose database errors or sensitive server details to users.
Database permissions Use database accounts with only the permissions needed by the application.
Important: Never connect a Vue frontend directly to MySQL. The frontend should call the backend API, and the backend should communicate with MySQL securely.

Deployment Tips for Full-Stack Applications

A full-stack app can be deployed in different ways. The frontend, backend, and database may be hosted separately.

Part Deployment Options Notes
Frontend Firebase Hosting, Netlify, Vercel, GitHub Pages Good for static Vue build files.
Backend Render, Railway, Google Cloud Run, Firebase Functions, VPS Hosts your Node.js + Express API.
Database Google Cloud SQL, Amazon RDS, PlanetScale, managed MySQL hosting Use managed services for backups, reliability, and scaling.
Domain Custom domain provider + DNS setup Connect frontend and backend with clear URLs.

Frontend Deployment

  • Run npm run build to generate production files.
  • Deploy the built folder, usually dist.
  • Configure redirects for Vue Router history mode to avoid 404 errors.

Backend Deployment

  • Set production environment variables securely.
  • Use HTTPS and restrict CORS origins.
  • Test API endpoints after deployment.
  • Check logs for errors and performance issues.

Database Hosting

  • Use a managed MySQL database for production when possible.
  • Enable regular backups.
  • Use strong passwords and restricted network access.
  • Monitor storage, connections, and query performance.

Learning Roadmap for Full-Stack Development

Stage What to Learn Practice Project
Stage 1 HTML, CSS, JavaScript fundamentals. Personal portfolio or landing page.
Stage 2 Vue.js basics, components, props, events, router. Task manager or product list app.
Stage 3 Node.js, Express routes, middleware, APIs. Simple REST API.
Stage 4 MySQL, tables, SQL queries, relationships. CRUD database project.
Stage 5 Axios and frontend-backend integration. Vue app connected to Express API.
Stage 6 Validation, authentication, error handling, security. Login-protected CRUD app.
Stage 7 Deployment, environment variables, hosting, monitoring. Deploy full-stack app online.

Common Beginner Mistakes

Mistake Why It Causes Problems Better Practice
Putting database credentials in frontend code Anyone can inspect browser code and see secrets. Keep secrets only in the backend or secret manager.
Skipping API testing Frontend errors may actually come from backend or database issues. Test APIs using Postman, Thunder Client, curl, or browser tools.
No input validation Bad data can break the app or create security risks. Validate data before inserting or updating records.
No error handling Users see blank pages or confusing failures. Add frontend and backend error messages.
Poor folder structure Code becomes hard to maintain as the project grows. Separate routes, controllers, models, config, and middleware.
Deploying without environment variables Production app may fail because database settings are missing. Set environment variables in your hosting platform.
Ignoring mobile design Many users access web apps from phones. Test responsive layout on desktop and mobile.

Why This Project Is Good for Your Portfolio

A full-stack Vue + Node.js + MySQL project is strong for your portfolio because it shows that you understand more than only frontend design. It proves that you can build an application that stores real data and communicates between multiple layers.

Portfolio Skill How This Project Shows It
Frontend development You build a responsive Vue interface.
Backend development You create Express API routes and server logic.
Database design You create MySQL tables and write SQL queries.
API integration You connect Vue and Node using Axios and JSON.
Problem-solving You debug CORS, routing, database, and deployment issues.
Deployment readiness You understand how frontend, backend, and database can be hosted online.
Portfolio tip: Add a README file with screenshots, setup steps, features, database schema, API endpoints, and deployment links.

Who Should Follow This Guide?

  • Frontend developers who want to learn backend development.
  • Students building capstone or portfolio projects.
  • Beginner developers learning full-stack architecture.
  • Vue.js learners who want to connect apps to a database.
  • Developers who want to practice REST APIs and CRUD operations.
  • Anyone interested in building real-world web applications.

Frequently Asked Questions

Can Vue.js connect directly to MySQL?

Vue.js should not connect directly to MySQL from the browser. The safer architecture is Vue.js → Node.js/Express API → MySQL. The backend protects database credentials and handles queries securely.

Why do we need Node.js between Vue and MySQL?

Node.js acts as the backend layer. It receives API requests, validates data, runs MySQL queries, handles errors, and sends JSON responses back to Vue.js.

What is Axios used for?

Axios is used in Vue.js to send HTTP requests to backend API endpoints. It can send GET, POST, PUT, PATCH, and DELETE requests.

Is MySQL good for beginner full-stack projects?

Yes. MySQL is a good choice for learning relational database design, SQL queries, CRUD operations, and structured data management.

Can I deploy the frontend and backend separately?

Yes. A common deployment pattern is to deploy the Vue frontend to Firebase Hosting, Netlify, or Vercel, and deploy the Node.js backend to Render, Railway, Cloud Run, or another backend hosting platform.

Is this project good for a portfolio?

Yes. A full-stack app with frontend, backend, API, and database integration is a strong portfolio project because it demonstrates real application architecture.


Final Takeaways

Building a full-stack application with Vue.js, Node.js, Express, and MySQL helps you understand how all parts of a real web app work together. You learn how the frontend displays data, how the backend processes requests, and how the database stores information.

This type of project is useful for students, self-taught developers, freelancers, and anyone who wants to move beyond static websites into real application development.

Final summary:
Vue.js builds the user interface.
Axios sends API requests.
Node.js and Express handle backend logic.
MySQL stores the data.
Together, they create a complete full-stack web application.

If you found this guide useful, you can follow Lae's TechBank for more hands-on tutorials about web development, backend APIs, database systems, deployment, and AI-powered development tools.

Keywords: Vue.js full stack app, Vue with Node.js, Vue MySQL integration, Node.js MySQL tutorial, Vue Express MySQL, full-stack web development, Vue backend tutorial, Vue frontend MySQL backend, beginner full stack tutorial, deploy Vue Node app, full-stack portfolio project, Express MySQL API, Axios Vue tutorial

References

  1. Vue.js Documentation: Introduction
  2. Vue CLI Documentation
  3. Node.js Documentation: Learn
  4. Express.js Documentation
  5. MySQL Documentation
  6. Axios GitHub Repository
  7. MDN: HTTP Request Methods
  8. MDN: Express Web Framework
  9. OWASP: SQL Injection
  10. The Twelve-Factor App: Config

Comments