pickstack

Nuxt + Pinia

The official Vue store, using setup-store syntax. This page shows exactly what pickstack adds to a Nuxt project for Pinia: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.

$ npm create pickstack@latest my-app -- --framework nuxt --modules pinia --yes
Customize in the configurator

Packages it adds

PackageVersionType
@pinia/nuxt^1.0.3runtime
@vue/devtools-api^8.2.1runtime
pinia^4.1.0runtime

New files

app/stores/counter.ts
import { defineStore } from "pinia";
import { ref } from "vue";

export const useCounterStore = defineStore("counter", () => {
  const count = ref(0);

  function increment() {
    count.value++;
  }

  function decrement() {
    count.value--;
  }

  return { count, increment, decrement };
});

Changes to existing files

app/components/CounterCard.vue (changed)
 <script setup lang="ts">+import { useCounterStore } from "~/stores/counter";−import { ref } from "vue";  +const counter = useCounterStore();−const count = ref(0); </script>   <template>   <div class="card">+    <p class="count">{{ counter.count }}</p>−    <p class="count">{{ count }}</p>     <div class="row">+      <button type="button" class="btn" @click="counter.decrement()">-1</button>+      <button type="button" class="btn" @click="counter.increment()">+1</button>−      <button type="button" class="btn" @click="count--">-1</button>−      <button type="button" class="btn" @click="count++">+1</button>     </div>   </div> </template>⋯ 1 unchanged lines
app/pages/about.vue (changed)
 <template>   <section class="page">     <h1 class="title">About</h1>+    <p class="text">Built with Nuxt 4, Vue 3, TypeScript, Pinia.</p>−    <p class="text">Built with Nuxt 4, Vue 3, TypeScript.</p>   </section> </template>  
nuxt.config.ts (changed)
⋯ 1 unchanged lines export default defineNuxtConfig({   compatibilityDate: "2025-07-15",   devtools: { enabled: true },+  modules: ["@pinia/nuxt"],   css: ["~/assets/css/main.css"], });  

Project files

Related templates