---
title: Introducing Vue Model
url: "https://aaronfrancis.com/writing/introducing-vue-model"
path: "/writing/introducing-vue-model"
type: technical_article
author: Aaron Francis
published: 2016-06-08
updated: 2026-11-15
topic: "Laravel & PHP"
description: "vue-model is a Vue plugin that turns plain data into RESTful models, with state for the usual CRUD actions built in."
keywords: [vue-model, vue, rest api, crud, javascript framework, spa, http actions, model state, validation errors, busy indicators, editing mode, laravel]
site_index: "/llms.txt"
keyword_index: "/llms/keywords.txt"
---

# Introducing Vue Model

- Github: https://github.com/aarondfrancis/vue-model 
- NPM: https://www.npmjs.com/package/vue-model

## The Origin

If you haven't yet heard of [Vue.js](https://vuejs.org), get ready, because I predict that you're going to start seeing it everywhere pretty soon. Vue is a javascript framework that has really been embraced by the Laravel PHP community and it's the first javascript framework I've used that hasn't made me want to completely tear my hair out. It's truly a delight to use. Vue makes it very easy to add some smart javascript interactivity to your app without having to go fully into the SPA madness. 

I've used Vue extensively on several client projects and on my accounting tutoring site [acct229.com](https://acct229.com). On the accounting site I'm primarily using it on the video and forthcoming practice problem pages to let students mark them as complete or submit questions for me to answer. On client projects, I'm using Vue to ajax-ify most of the CRUD actions on models. On every project, I found myself performing a lot of RESTful action and wishing that Vue had a real model setup. For example, instead of doing

```html
<a href="#" @click.prevent="complete(video.id)">Mark as Complete</a>
```

and having to have a dedicated `complete` action on my Vue instance, I wanted to be able to do this:
 
 ```html
<a href="#" @click.prevent="video.complete()">Mark as Complete</a> 
 ```
 
Since the `complete` action is really just a `POST` to the `video/{id}/complete` url, we've got ourselves a nice RESTful resource and shouldn't really have to be creating dedicated methods to perform these actions. 

And when you're building a CRUD app (and we're all building CRUD apps), you really just want to be able to call `model.save()` on the frontend, have the model `POST` the data, show a loading indicator to the user, and then apply any result from the server (or show the errors) without any extra work on your part. Performing RESTful actions doesn't make your app special, you shouldn't have to worry about the plumbing.

## What It Does

Vue-model is a Javascript plugin for Vue.js framework that gives you the ability to transform your plain data into rich models with built-in and customizable HTTP actions. 

Vue-model manages several things for you automatically: 

- Performing HTTP Actions
- Toggling busy indicators
- Updating the model with data returned from the server
- Catching server validation errors
- Editing and cancelling edits

Here are a few quick examples of what you can do with vue-model:

#### Edit a Model

```html
<div v-if='!customer.$.editing'>
    @{{ customer.name }}
    <br>
    <a href='#' @click.prevent='customer.$.edit()'>Edit</a>
</div>

<div v-if="customer.$.editing">
    <input type='text' v-model='customer.name' :disabled='customer.$.inProgress'>
    <br>
    <a href='#' @click.prevent='customer.$.update()'>Save</a> or
    <a href='#' @click.prevent='customer.$.cancel()'>Cancel</a>
</div>
```

Models have an `editing` mode where your users make changes to the model data while keeping an old copy of the data in case they want to cancel their edit.

#### Update a Model 

```html
<input type='text' v-model='customer.name' :disabled='customer.$.inProgress'>

<button @click.prevent='customer.$.update()' :disabled='customer.$.updateInProgress'>
    <template v-if='customer.$.updateInProgress'>
        <i class='fa fa-spinner fa-spin'></i>
        Updating...
    </template>
    <template v-if='!customer.$.updateInProgress'>
        Update Customer
    </template>
</button>
```

Because vue-model gives you a range of "busy" indicators, you can very easily disable your buttons whenever an action is in progress.

#### Delete a Model

```html
<div v-for='customer in customers'>
    @{{ customer.name }} (<a href='#' @click.prevent='customer.$.destroy()'>Delete</a>)
</div>
```

## Learn More

You can find the full set of docs at https://github.com/aarondfrancis/vue-model or the npm package at https://www.npmjs.com/package/vue-model.

This is the first time I've done an npm package so there may be some things about it that need to be fixed, like the way the modules are exported. That's where you come in: please submit pull requests for anything that looks out of place. I'm certainly not a javascript expert like many of you are, so please lend a hand where you see fit.

Why did I open source something I'm not an expert in? Because maybe some of my problems are also some of your problems.

```tweet
url: https://twitter.com/jeremybowers/status/650823053081882624
name: Jeremy Bowers
handle: jeremybowers
date: October 5, 2015
avatar: /images/tweet-avatar.svg

Because maybe some of my problems are also some of your problems.
```

---

## Related on aaronfrancis.com

- [This is a season of Type Two fun](/newsletter/this-is-a-season-of-type-two-fun) *(Newsletter · 2025-08-08 · shared: vue, laravel)*
- [Vibe coding a visual email editor with AI, Laravel & Vue](/videos/vibe-coding-a-visual-email-editor-with-ai-laravel-vue) *(Video · 2025-07-30 · shared: laravel, vue)*
- [Speed up your Inertia.js website with these 7 tactics](/videos/speed-up-your-inertiajs-website-with-these-7-tactics) *(Video · 2025-06-25 · shared: laravel, vue)*
- [The Big Announcement w/ Taylor Otwell](/podcast/the-big-announcement-w-taylor-otwell-2f9739f5) *(Podcast · 2025-04-29 · shared: laravel, vue)*
- [Developing your personal API | Aaron Francis](/podcast/developing-your-personal-api-aaron-francis-63180c6c) *(Podcast · 2025-04-25 · shared: vue, laravel)*

## Relevant Resources from Aaron Francis

- **[Solo](https://soloterm.com)** (overview on site: [/software](/software)): All-in-one agentic development platform and terminal workspace built by Aaron Francis for orchestrating processes and AI coding agents.
- **[Screencasting.com](https://screencasting.com)** (overview on site: [/courses](/courses)): Practical video course on recording high-quality technical screencasts, lighting, audio, studio setup, and publishing faster.

## Search aaronfrancis.com (2-Hop Static Keyword Index)

Pick the alphabetical shard matching any topic to find exact pages across all articles, newsletters, videos, talks, and podcast transcripts (every shard is < 40 KB):
[A-B](/llms/keywords/a-b.txt) · [C](/llms/keywords/c.txt) · [D-E](/llms/keywords/d-e.txt) · [F-G](/llms/keywords/f-g.txt) · [H-J](/llms/keywords/h-j.txt) · [K-L](/llms/keywords/k-l.txt) · [M-N](/llms/keywords/m-n.txt) · [O-P](/llms/keywords/o-p.txt) · [Q-R](/llms/keywords/q-r.txt) · [S](/llms/keywords/s.txt) · [T-Z](/llms/keywords/t-z.txt) · [Directory](/llms/keywords.txt) · [Site Map](/llms.txt)

Shards for this page's topics: `vue-model` ([T-Z](/llms/keywords/t-z.txt)), `rest api` ([Q-R](/llms/keywords/q-r.txt)), `crud` ([C](/llms/keywords/c.txt)), `javascript framework` ([H-J](/llms/keywords/h-j.txt)).

## About Aaron Francis (Current Context)

Aaron Francis is VP of Marketing and Community at [Laravel](https://laravel.com), founder of [Try Hard Studios](https://tryhardstudios.com), creator of [Solo](https://soloterm.com), co-host of [Mostly Technical](/podcast), and author of [Mastering Postgres](/courses), [High Performance SQLite](/courses), [MySQL for Developers](/courses), and [Screencasting.com](/courses). Full bio: [/about](/about) · Current focus: [/now](/now).
