How I built a desktop app with vue in minutes

How I built a desktop app with vue in minutes


When it comes to desktop app, electron is a powerful tool. You can build cross-platform applications in one shot.

As I like vue, i've triyed created an application with 'electron-vue' and this is how simple it is !

Let's make a weather app using OpenWeatherMap API

🛠️ Installation

I was using Ubuntu 18.04 and Webstorm IDE. I also like vuetify components so I installed the vuetify/electron repository

Looks like the GitHub repo doesn't exist anymore..

To install the project run

vue init vuetifyjs/electron my-project

cd my-project
npm install
npm run dev

Now you are ready to go !

the boiler plate

Then to display the weather, i will need :

-Highest temperature
-Lowest temperature

So let's change that page into what we need ! I'm using two Card component, one to search the city and the other one will then display the weather

          <p>Welcome to my météo app.</p>
          <p>Search for a city to display the weather</p>
          <v-text-field label="City" box v-model="city"></v-text-field>
          <v-btn primary flat router @click="getWeather">Search</v-btn>
      <v-card v-if="show">
            <v-layout row>
                <v-layout xs6>
                <v-layout xs6>
                        <p><v-icon>fas fa-snowflake</v-icon>Min : {{ tempMin.toFixed(2) }}°C</p>
                        <p><v-icon>fas fa-sun</v-icon>Max : {{ tempMax.toFixed(2) }}°C</p>
                        <p><v-icon>fas fa-tint</v-icon>Humidity : {{ humidity }} %</p>

💻Requesting the API

I now need to code my getWeather function

I'm using axios to make API requests, I then store the data i want into my app

the API endpoint is '/data/2.5/weather'

  import SystemInformation from './WelcomeView/SystemInformation'
  import axios from 'axios'
  axios.defaults.baseURL = ''
  export default {
    name: 'welcome',
    components: { SystemInformation },
    data () {
      return {
        city: '',
        country: '',
        weatherDescription: '',
        temp: null,
        tempMin: null,
        tempMax: null,
        humidity: null,
        show: false,
        key: '863668499362fb4884ebd97229f3b26b',
        url: ''
    methods: {
      open (link) {
      getWeather () {
        axios.get(this.url, {
          params: {
            appid: this.key
        }).then(response => {
          this.temp = - 274
          this.tempMax = - 274
          this.tempMin = - 274
          this.humidity =
          this.weatherDescription =[0].description
 = true
        }).catch(errors => {

🌟 And that's it !

Simple as a classique Vue js application, I just made a simple cross-plateform application.

my-final app in vue

this was my first electron app, and also my first blog post

I really loved it because i'm able to use the same app on Windows, MacOs and Ubuntu (has i work on ubuntu)

feel free to tell me about stuff i made wrong ore i could have done better, and to share some cool stuff to work on !