Skip to content

hunglv-fs/structure-vue3-project

Repository files navigation

Vue 3 Project Structure

This document outlines the structure of a Vue 3 project, providing an organized and scalable foundation for development.

Project Structure

│── src/                          # Main source code directory
│   │── api/                      # API request handlers
│   │   ├── axiosInstance.js      # Axios configuration
│   │   ├── user.js               # User-related API calls
│   │   ├── auth.js               # Authentication API calls
│   │   ├── product.js            # Product-related API calls
│   │   ├── order.js              # Order-related API calls
│   │
│   │── assets/                   # Static assets (images, icons, fonts)
│   │   ├── images/               # Image files
│   │   │   ├── logo.png          # Logo image
│   │   │   ├── banner.jpg        # Banner image
│   │   ├── icons/                # Icon files
│   │   │   ├── search.svg        # Search icon
│   │   │   ├── cart.svg          # Cart icon
│   │   ├── fonts/                # Font files
│   │   │   ├── Roboto.ttf        # Roboto font
│   │
│   │── components/               # Reusable Vue components
│   │   ├── ui/                   # UI components
│   │   │   ├── Button.vue        # Button component
│   │   │   ├── Modal.vue         # Modal component
│   │   ├── layout/               # Layout components (header, footer, etc.)
│   │   │   ├── Header.vue        # Header layout
│   │   │   ├── Footer.vue        # Footer layout
│   │
│   │── composables/              # Custom hooks using Vue 3 Composition API
│   │   ├── useAuth.js            # Authentication logic
│   │   ├── useTheme.js           # Theme management
│   │   ├── useCart.js            # Shopping cart logic
│   │
│   │── directives/               # Custom Vue directives
│   │   ├── clickOutside.js       # v-click-outside directive
│   │   ├── focus.js              # v-focus directive
│   │
│   │── layouts/                  # Application layouts
│   │   ├── DefaultLayout.vue     # Default layout
│   │   ├── AdminLayout.vue       # Admin layout
│   │   ├── AuthLayout.vue        # Authentication layout
│   │
│   │── router/                   # Vue Router configuration
│   │   ├── index.js              # Main router configuration
│   │   ├── routes.js             # Route definitions
│   │   ├── guards.js             # Navigation guards
│   │
│   │── store/                    # State management (Vuex/Pinia)
│   │   ├── index.js              # Main store configuration
│   │   ├── auth.js               # Auth module
│   │   ├── user.js               # User module
│   │   ├── cart.js               # Cart module
│   │
│   │── styles/                   # Global styles
│   │   ├── main.css              # Main CSS file
│   │   ├── variables.scss        # SCSS variables
│   │   ├── mixins.scss           # SCSS mixins
│   │   ├── tailwind.css          # TailwindCSS (if used)
│   │
│   │── views/                    # Main application pages
│   │   ├── Home.vue              # Home page
│   │   ├── Login.vue             # Login page
│   │   ├── Dashboard.vue         # Dashboard page
│   │   ├── Profile.vue           # Profile page
│   │   ├── Product.vue           # Product page
│   │
│   │── App.vue                   # Root Vue component
│   │── main.js                   # Vue application entry point
│   │── i18n.js                   # Internationalization (if using Vue I18n)
│   │── permission.js             # Access control middleware
│
│── public/                       # Static public files
│   ├── index.html                # Main HTML template
│   ├── favicon.ico               # Favicon
│
│── tests/                        # Testing files
│   ├── unit/                     # Unit tests
│   │   ├── example.spec.js       # Example unit test
│   ├── e2e/                      # End-to-end tests
│   │   ├── login.spec.js         # Login E2E test
│
│── .vscode/                      # VSCode configuration
│── index.html                    # HTML
│── .gitignore                    # Git ignore rules
│── .editorconfig                 # Code formatting rules
│── package.json                  # Project dependencies
│── vite.config.js                # Vite configuration
│── tailwind.config.js            # TailwindCSS configuration (if used)
│── tsconfig.json                 # TypeScript configuration (if used)
│── README.md                     # Project documentation

Getting Started

  1. Clone the repository.
  2. Install dependencies using npm install or yarn install.
  3. Start the development server with npm run dev or yarn dev.

Features

  • Modular and scalable folder structure.
  • Vue 3 Composition API for reusable logic.
  • State management with Vuex or Pinia.
  • Custom directives and hooks.
  • TailwindCSS integration (optional).
  • Unit and E2E testing setup.

License

This project is licensed under the MIT License.

About

structure-vue3-project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published