{"accept-ranges":"bytes","body":"\n\n \n \n \n \n \n \n Create Vue Starter Kit | Permaweb Cookbook\n \n \n \n \n
Language

Documentation

Contributors: Dylan Shade, longviewoor
Last Updated:

# Create Vue Starter Kit

This guide will provide step-by-step instructions to configure your development environment and build a permaweb Vue application.

# Prerequisites

# Development Dependencies

  • TypeScript (Optional)
  • NPM or Yarn Package Manager

# Steps

# Create Project

The following command installs and launches create-vue, the official scaffolding tool for Vue projects.

npm init vue@latest\n
yarn create vue\n

During the process, you'll be prompted to select optional features such as TypeScript and testing support. I recommend selecting the Vue Router with yes, the rest can be selected as per your preference.

✔ Project name: … <your-project-name>\n✔ Add TypeScript? … No / Yes\n✔ Add JSX Support? … No / Yes\n✔ Add Vue Router for Single Page Application development? … No / *Yes*\n✔ Add Pinia for state management? … No / Yes\n✔ Add Vitest for Unit testing? … No / Yes\n✔ Add Cypress for both Unit and End-to-End testing? … No / Yes\n✔ Add ESLint for code quality? … No / Yes\n✔ Add Prettier for code formatting? … No / Yes\n

# Change into the Project Directory

cd <your-project-name>\n

# Install Dependencies

npm install\n
yarn\n

# Setup Router

Vue Router is the official router for Vue.js and seamlessly integrates with Vue. To make it work with Permaweb, switch from a browser history router to a hash router as the URL cannot be sent to the server. Change createWebHistory to createWebHashHistory in your src/router/index.ts or src/router/index.js file.

import { createRouter, createWebHashHistory } from "vue-router";\nimport HomeView from "../views/HomeView.vue";\n\nconst router = createRouter({\n\thistory: createWebHashHistory(import.meta.env.BASE_URL),\n\troutes: [\n\t\t{\n\t\t\tpath: "/",\n\t\t\tname: "home",\n\t\t\tcomponent: HomeView,\n\t\t},\n\t\t{\n\t\t\tpath: "/about",\n\t\t\tname: "about",\n\t\t\tcomponent: () => import("../views/AboutView.vue"),\n\t\t},\n\t],\n});\n\nexport default router;\n

# Setup Build

Configure the build process in the vite.config.ts or vite.config.js file. To serve Permaweb apps from a sub-path (https://[gateway]/[TX_ID]), update the base property to ./ in the config file.

export default defineConfig({\n  base: './',\n  ...\n})\n

# Run the App

Before moving forward, it is crucial to verify that everything is working correctly. Run a check to ensure smooth progress.

npm run dev\n
yarn dev\n
it will start a new development server locally on your machine by default it uses `PORT 5173`. If this PORT is already in use it may increase the PORT number by 1 (`PORT 5174`) and try again.

# Deploy Permanently

# Generate Wallet

We need the arweave package to generate a wallet

npm install --save arweave\n
yarn add arweave -D\n

then run this command in the terminal

node -e "require('arweave').init({}).wallets.generate().then(JSON.stringify).then(console.log.bind(console))" > wallet.json\n

# Fund Wallet

You will need to fund your wallet with ArDrive Turbo credits. To do this, enter ArDriveopen in new window and import your wallet. Then, you can purchase turbo credits for your wallet.

# Setup Permaweb-Deploy

npm install --global permaweb-deploy\n
yarn global add permaweb-deploy\n

# Fund Your Wallet

Turbo uses Turbo Credits to upload data to Arweave. You can purchase Turbo Credits with a variety of fiat currencies or crypto tokens. Below is an example for funding your wallet with 10 USD. It will open a browser window to complete the purchase using Stripe.

npm install @ardrive/turbo-sdk\nturbo top-up --wallet-file wallet.json --currency USD --value 10\n

Be sure to replace wallet.json with the path to your Arweave wallet.

# Update package.json

{\n  ...\n  "scripts": {\n    ...\n    "deploy": "DEPLOY_KEY=$(base64 -i wallet.json) permaweb-deploy --ant-process << ANT-PROCESS >> --deploy-folder build"\n  }\n  ...\n}\n

Replace << ANT-PROCESS >> with your ANT process id.

# Run build

Now it is time to generate a build, run

npm run build\n
yarn build\n

# Run deploy

Finally we are good to deploy our first Permaweb Application

npm run deploy\n
yarn deploy\n

ERROR

If you receive an error Insufficient funds, make sure you remembered to fund your deployment wallet with ArDrive Turbo credits.

# Response

You should see a response similar to the following:

Deployed TxId [<<tx-id>>] to ANT [<<ant-process>>] using undername [<<undername>>]\n

Your Vue app can be found at https://arweave.net/<< tx-id >>.

SUCCESS

You should now have a Vue Application on the Permaweb! Great Job!

# Summary

This guide provides a simple step-by-step method to publish a Vue.js app on the Permaweb using Create Vue. If you need additional features Tailwind, consider exploring alternative starter kits listed in the guide to find a suitable solution for your requirements.

Built with ❤️ by the Arweave community. Learn more at Arweave.org

\n \n \n\n","commitments":{"NyoY8p3Pu6-mNpvG_6bZyQ3W6e-uboJCFILdobpC-SI":{"commitment-device":"httpsig@1.0","committed":["hashpath"],"committer":"uri-did-ar-7j5pytu4encln08xazro1rnrn0fpm8tkofboa7qsbvg95y1ukw7k","keyid":"uri-did-ar-7j5pytu4encln08xazro1rnrn0fpm8tkofboa7qsbvg95y1ukw7k","public-key":"tiju5rCqL86zWrlgGz4yOjmoid0-2kVTGwBB4FwTtYlMShBxfQZ0-np6GQjmTy-uUvapXcO8sGZuRr3KKd5Hf5jEfBUIxeSfWfUDPxPHrJHzk-dj3nn-FCTQ00a2NxnmCoE6LblHaA-bSc8N1ZGCaGBbKLDXxnLaec6GBcRGE6f2GG6exyR6h8Lkjm5G2CN4FizSMWL1JKakUxJQhQs42ZZb22lYkYxqhuplcxF8u0qSDs-9_EB3a48J9oPmKU3leDjWxHKw40hjbp-k1-Gq-pZyzmoSXsxuCbRQrdGjg7clL7UlTczY5dyU-J23woIi4FnWdkSkjiCGxtn52JtG5URBlCalSujrn5JligtElAAzxXNmsQJYpA8HCeV5jdD036AWp-srAZr_ZfzDEI4P2HX80tbZ3WZeST12WLdRNnhIR2k-qteYO-xnDOK9NQ0lw2qsSSN3tr52yjbIONtT9CWSVmTnyb_y3oZ0cT6ay1sp5XxVRfam0ZaqIW2MI_Q1OjmeauPCwNrSK_qUqUOiwu5fKb5NCKIRNE21ahXun1A7mWI0z0w4BoMW-dUmP_oxVADN_yLXb9KHxPDULqv0orbrfehFr8h5P4pGFJ40frk6WFGpjOOhu_U2gtl5mURaNWvciZCV1faksltye9zEJuYs_zT-4b438_b1o4m32QM","signature":"NL1Fm6Rhhg6O_sCeDJ8VBG_w7i8uv4eDu5EGn8XeQEZW0iPFSH6i99FrsdpGypm4FfCErz3ZdU272CQnulcbFIbu0hV_-SYSd9pBSLHCgd28WBAUdeaiHPlHq7te4hsIoqp13pApIMTqUZ6h7i8GemiR9Ow-fvCJh03wfBeB1k3exO1V70oJi_qKnGPc9krSvbsbVnQj0ojjWCWT8M5SdUh12s2rjE4bqrW4BGIXFK5NejwI_lGo96o3x9KNrxNA2QKSf_LSmlhG-j9KDj4Zt7jrQewwuXdDaGfEJPhu9_c9OQMczwPZtGvNadF68sSjVTvcYbV35bA2VaVtjeD6DdPprhriJIYiHEbwBLz-2pSyuL5iq6p7ivgQSv2MvbVrNzz68BW_X_5jnWTBG_TqIUBZximuLeIAvjwdkVnHNvqe_2ZvJhDNd-6ANT9I9SOeOW5k0O1rtQtPtiu0wcfcrG8JgRbD0bxjICRygWxpr6MTnW8X9ciRnxqq1dtUgSQfJmtORa-cZpBj09vsbmT-KL7zxp4UbSRr9i6rlg1GXGW7knqwItk50OzT2UV3j0RqMGaCM6U9ccP9jQW7tOo9j00s-4ZX7e68lJXWVNfPFPctpUqzAbaL54rtgnzCFmUqkS9j0CDEtNmq_XvL8oUy-pzV_twiCdYmR-df407lviY","type":"rsa-pss-sha512"},"O-L8UEVlS9qZlMF1zGRtdPku8amd220ursC8fAj3uxg":{"commitment-device":"httpsig@1.0","committed":["accept-ranges","ao-types","body","content-type","data-length","data-offset","header-length","offset","raw-id"],"keyid":"hmac:constant:ao","signature":"O-L8UEVlS9qZlMF1zGRtdPku8amd220ursC8fAj3uxg","type":"hmac-sha256"}},"content-type":"text/html","data-length":120260,"data-offset":377756196179865,"hashpath":"ao:Wj6ia7djF85_SqnpWSOc-A_15NpDtJF8S5EX7enzsFo/ao:HSwX_X8-RN7pvZURiNAxgA8R9Tjksme0WDZClPpGndA.O-L8UEVlS9qZlMF1zGRtdPku8amd220ursC8fAj3uxg","header-length":1126,"offset":377756196178739,"raw-id":"XBuakFcNJezv9e2zsfEdTHI7_Tc4myOC5GRy0m1coog"}