vue-starter-template

Nuxt 3 Tailwind Starter Template

A clean, minimal starter template for Nuxt 3 applications with Tailwind CSS.

Features

Architecture

This template implements a clean service layer architecture:

  1. Service Layer - API communication with a factory pattern
  2. Composables - Reusable Vue composition functions
  3. Components - Modular UI components
  4. Pages - Route-based Vue components

Getting Started

# Clone the repository
git clone https://github.com/efesozen/vue-starter-template.git

# Navigate to the project
cd vue-starter-template

# Install dependencies
npm install

# Start development server
npm run dev

Directory Structure

β”œβ”€β”€ assets/            # Static assets
β”œβ”€β”€ components/        # Vue components 
β”‚   β”œβ”€β”€ Common/        # Reusable UI components
β”‚   └── Filter/        # Filter components
β”œβ”€β”€ composables/       # Vue composables
β”œβ”€β”€ layouts/           # Page layouts
β”œβ”€β”€ middleware/        # Route middleware
β”œβ”€β”€ pages/             # Application pages
β”‚   └── examples/      # Example implementations
β”œβ”€β”€ plugins/           # Nuxt plugins
β”‚   └── mock/          # Mock services for demo mode
β”œβ”€β”€ public/            # Public static assets
β”œβ”€β”€ schemas/           # Validation schemas
β”œβ”€β”€ services/          # API services
└── stores/            # Pinia stores

Example Data Model

The template includes an example β€œPost” data model to demonstrate:

Mock API for Development

This template includes a built-in mock API for development and demo purposes.

Features

Usage

Mock API is enabled by default for easier getting started. To use:

  1. Login with demo credentials:
    • Email: john@example.com
    • Password: any value will work
  2. Use the Posts example to see CRUD operations in action

Switching Between Mock and Real API

You can toggle between mock and real API in nuxt.config.ts:

runtimeConfig: {
  public: {
    useMockApi: true, // Set to false to use real API
  }
}

Or using environment variables:

USE_MOCK_API=false npm run dev

Documentation

For detailed documentation, see the /docs directory:

Deployment

This template is configured for GitHub Pages deployment. When you push to the main branch, GitHub Actions will automatically build and deploy the site to GitHub Pages.

To enable GitHub Pages in your repository:

  1. Go to your repository settings
  2. Navigate to the β€œPages” section
  3. Under β€œBuild and deployment”, select β€œGitHub Actions” as the source

The site will be available at https://[username].github.io/vue-starter-template/

License

MIT