Server-Side Render Vue Apps with Nuxt.js (Server-side Rendering with JavaScript Frameworks)

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024
  • Server Side Rendering Vue apps with Nuxt is super awesome. It takes a bit of configuration, but after the initial setup you have an excellent SSR build pipeline. Add in Firebase Hosting's CDN and now you have a low-latency SSR Vue app!
    Firebase Hosting Docs: goo.gl/TfcGv1
    package.json: goo.gl/utQDL7
    Nuxtjs: nuxtjs.org/
    Watch more Server-side Rendering with Javascript Frameworks: goo.gl/yaYkHX
    Subscribe to the Firebase Channel to never miss a Server-side Rendering episode: goo.gl/9giPHG

Комментарии • 138

  • @AdarshMadrecha
    @AdarshMadrecha 4 года назад +24

    Time to create update tutorial for this.

  • @BrosZim
    @BrosZim 6 лет назад +59

    Good stuff, but you fly right through everything and don't explain hardly a thing. It's hard to learn when we're just being given steps instead of being told how or why.

    • @lucaban4146
      @lucaban4146 6 лет назад +1

      I think so too, can anyone else explain?

    • @jOUZZAA
      @jOUZZAA 6 лет назад +8

      it sure is hard to answer all your 0 questions here 😀

  • @BohdanKokotko
    @BohdanKokotko 5 лет назад +6

    Outdated - this is for nuxt 1.x (wasted a few hours to make it work on my own for nuxt 2.x - no luck, still thanks for this vid)
    Switched onto "Google App Engine" (instead of firebase hosting, it took around 10 minutes, twice less the length of the vid):
    nuxtjs.org/faq/appengine-deployment
    It really works like a charm - more than that - you will have a lot of control over the service and the load(aka how many requests goes to route per hour and which routes produces errors and so much more, not sure if it might work the same for firebase hosting if properly migrated)
    At this point in time I don't get why anyone should bother themselves with hosting the files on firebase hosting over Google App engine(at least non static ones that must be rendered using the server)
    Hope it helps someone!

    • @steamydreamsuk
      @steamydreamsuk 5 лет назад

      Great shout, thanks I didn't realise how easy deployment using Google App Engine was!

    • @NithinKVarrier
      @NithinKVarrier 4 года назад +1

      Thank you. it is super easy :) . Is there any drawbacks on using Google App engine for hosting? My database, storage, functions everything is in firebase. Can I use Google App engine only for hosting?

  • @mullla1ya
    @mullla1ya 2 года назад +1

    Wow I didn’t even know firebase has their RUclips channel. Awesome. Thanks for nice tutorial. I didn’t really get it, but I think I got the idea.

  • @aaronalquiza9680
    @aaronalquiza9680 6 лет назад +10

    for v-for, you can do something like this if you don't want to use a property:

  • @JFkingW
    @JFkingW 6 лет назад +5

    Why does all this SSR gotta be so complicated? D:

  • @luisvelasquez4239
    @luisvelasquez4239 6 лет назад

    At 9:39 he says "I have a little gist". He's talking about Github Gist. Just in case you've been reading the subs and wondering.

  • @slidenerd
    @slidenerd 5 лет назад +2

    nuxt adds a whole lot of boilerplate on top of vue-server-renderer, any performance benchmarks of nuxt vs vue-server-renderer?

  • @atafonmail9043
    @atafonmail9043 6 лет назад +4

    How to deal or to do the same way with firestore SSR.. please help how to NUXT firestore Rest API..

  • @matthewbeardsley7004
    @matthewbeardsley7004 4 года назад +2

    Super excited to build my first nuxt app, really want it to be on Firebase, even I could tell that things have changed. Does anyone have a tutorial on how to do deploy to functions and hosting nowadays

  • @banazakgonzalez3670
    @banazakgonzalez3670 5 лет назад +10

    On Nuxt 2 there is two folders (client and server) publicated on "dist/", is it changes the process in anyway?

    • @romainr5650
      @romainr5650 5 лет назад +7

      when will be a tutorial publish for nuxt 2.0 .....?

    • @hendrapratama9258
      @hendrapratama9258 5 лет назад

      nothing has changed, copy together with the folder

    • @marcoraven
      @marcoraven 4 года назад

      @@hendrapratama9258 Copy together with what folder?

    • @hendrapratama9258
      @hendrapratama9258 4 года назад +1

      @@marcoraven
      with dist folder, copy the dist folder with the server and client folders inside the dist

    • @marcoraven
      @marcoraven 4 года назад

      @@hendrapratama9258 Thanks!

  • @gootrizotti
    @gootrizotti 5 лет назад +3

    On 8:35 David says: "Build without a problem". But I'm having this message on the console ERROR in ./.nuxt/client.js
    Module build failed (from ./node_modules/babel-loader/lib/index.js):
    Error: Plugin/Preset files are not allowed to export objects, only functions. What can I do?

    • @wendusyaputra
      @wendusyaputra 5 лет назад

      This video was made with v6 babel. Not sure about that, if you change the version of babel it'll works fine

  • @tyren51
    @tyren51 6 лет назад +11

    Great video - but can't escape the feeling that it takes planning and resources like an aircraft carrier, with the potential of a rowboat?

    • @lucaban4146
      @lucaban4146 6 лет назад +1

      What do you mean? Is there a better / other way to use Nuxt with Firebase?

  • @harbilito4910
    @harbilito4910 4 года назад +5

    I understand 0% of this. But i have been using vue for years

  • @JFkingW
    @JFkingW 6 лет назад +5

    Why shouldn't I just do npm run generate and then upload the dist folder to firebase hosting? It works for my...

    • @themaster86d
      @themaster86d 6 лет назад +1

      did you have a response to that question? i'm wondering also why ?

    • @rafaelbsanto
      @rafaelbsanto 6 лет назад +2

      Code that run on server would not run with static hosting.

    • @hendrapratama9258
      @hendrapratama9258 5 лет назад +1

      then you just upload static HTML not SSR, cmiiw

    • @tropicalverktaki
      @tropicalverktaki 5 лет назад

      I was using that approach until I couldn't generate nuxt-child components...

  • @PureAlbania
    @PureAlbania 6 лет назад +12

    Finally!!!

  • @alexisenp
    @alexisenp 6 лет назад +1

    Is this solution stiill working ?? I want to deploy a nuxt app in firebase hosting, but i dont know how to do it, im trying this video, but dont work for me. Is there a easiest way to do it?

  • @lxsedov
    @lxsedov 6 лет назад +1

    if i use firebase to host Nuxt project, how would i get billed? There is a charge for hosting GB transferred and cloud functions outbound networking. Does this mean an SSR project will cost at least twice more expensive that static only on network egress + actual functions runtime cost?

  • @KimcheeOnATaco
    @KimcheeOnATaco 6 лет назад

    Great! Love Vue.js & Nuxt. Thanks

  • @nayirchami3690
    @nayirchami3690 6 лет назад

    David is using nuxt v1.0.0-rc11, working with node v6

  • @MrAverageViewer
    @MrAverageViewer 5 лет назад +1

    Not too sold on this yet. There's a herd-like mentality to blindly follow Hipster trends, without considering the real-world benefits, relative to the cost of resources & time. It's best to ask first: what SPECIFIC USE-CASES is it best to use, or NOT to use Nuxt? Under what use-cases are the benefits, worth the effort?

    • @VagnerGon
      @VagnerGon 5 лет назад

      I think this question should be made before. If the awnser is to use Nuxt, you watch this video

  • @perfect.stealth
    @perfect.stealth 2 года назад

    The only thing I don't really understand is the need for a src and a functions folder.
    Anyone care to explain?

  • @eduardocamillo2698
    @eduardocamillo2698 6 лет назад

    It would be great to have this for plain vue.js , without Nuxt. Nuxt development is pretty different from plain vue.js SPA.

  • @12XFactor
    @12XFactor 6 лет назад

    Your videos are awesome ! Thanks man, thanks Google.

  • @Tiara48z
    @Tiara48z 6 лет назад +1

    Where can one get all those wonderful t-shirts you guys have???? They’re probably exclusive😭😭😭😭

  • @leajiaure
    @leajiaure 5 лет назад +9

    This video is out of date

  • @rankifymedia6225
    @rankifymedia6225 5 лет назад +2

    Firestore cloud hosting is not yet ready for primetime. We need better documentation, a more straight forward deploy process, and a tutorial that is up to date. For now this is the best I can find: github.com/davidroyer/nuxt2-ssr-firebase for information, but good luck. I spent 35 hours on this before moving to easier hosting solutions.

  • @_taishi
    @_taishi 6 лет назад

    This is just awesome 🤝!! I should try this!

  • @GrumpyPapaJim
    @GrumpyPapaJim 5 лет назад

    Got this working. Except for sub routes. if I load a sub route directly (not through main path). Produces an error.

  • @MrAsulta
    @MrAsulta 6 лет назад +2

    Looks like I can't import nuxt 1.x.x on firebase functions since cloud functions are still running on node 6.

    • @paulrenshaw3776
      @paulrenshaw3776 6 лет назад +1

      Yeah, starter-template was updated to use nuxt 1.0.0 (replacing 1.0.0-rc11) before this was even published. Looking around it seems there's also no timeline for updating google cloud functions to node 8... useless.#frameworkproblems

    • @oleglego8673
      @oleglego8673 6 лет назад

      Try with "nuxt": "1.0.0-rc11" in package.json of functions.

    • @lucaban4146
      @lucaban4146 6 лет назад

      You can keep nuxt at @latest in the main directory?? Only change the one in functions/ ?

  • @mikekaranja63
    @mikekaranja63 6 лет назад

    Finally!!!! Waited for soo long!

  • @DaHeatShow
    @DaHeatShow 4 года назад +1

    can somebody please lead me to updated example or just put some light on

  • @absolutehype
    @absolutehype 6 лет назад

    I'm a little confused by this tutorial, it's been incredibly useful... but i'm unsure how Firebase handles images and other assets in my NUXT static directory. Are these all routed through my Firebase function and handled by NUXT? Surely I want these served from the Firebase CDN?

    • @absolutehype
      @absolutehype 6 лет назад

      I've since watched over this video again and read more on the cache control headers firebase.google.com/docs/hosting/functions#manage_cache_behavior

  • @lucaban4146
    @lucaban4146 6 лет назад +1

    After trying to follow this tutorial, encountering many errors, it seems this tutorial uses: "nuxt 1.0.0-rc11" instead of "1.0.0". However, the current latest starter-template is using "1.0.0". Will firebase come with a slightly altered tutorial or blog post explaining how to do this with v "1.0.0" ?

    • @lucaban4146
      @lucaban4146 6 лет назад

      Some other issues on firebase deploy:
      ⚠ functions: package.json indicates an outdated version of firebase-functions.
      Please upgrade using npm install --save firebase-functions@latest in your functions directory.
      ⚠ functions: Please note that there will be breaking changes when you upgrade.
      Go to firebase.google.com/docs/functions/beta-v1-diff to learn more.

    • @lucaban4146
      @lucaban4146 6 лет назад

      is it possible Firebase cannot use Nuxt@latest because it uses Node v8, and Firebase cloud functions can only support Node v6?

  • @tylerbrubaker8867
    @tylerbrubaker8867 4 года назад

    Also for some reason the functions/nuxt/dist does not exist for me.

  • @tomcatbuzz
    @tomcatbuzz 6 лет назад

    Where do you have the file stored that you are Fetching? Do we add our own path for that. You didn't really explain the set up our Console end. Any help would be appreciated.

  • @ramstein74
    @ramstein74 6 лет назад

    I did all of that but after sucessfully deployed i get 504 Gateway Time-out. My app does not call external services and i´m on the free tier.
    Any help?

  • @yoanmarchal-dev
    @yoanmarchal-dev 6 лет назад +3

    is there any github repo ? i try to follow the steps but i got some issues

    • @NayirChami
      @NayirChami 6 лет назад

      hey yoan, what kind of issues ?

    • @transglukator
      @transglukator 6 лет назад +1

      you can check this repo out github.com/davidroyer/nuxt-ssr-firebase. I believe this guy created his project based on this tutorial with some cool improvements

  • @doit4941
    @doit4941 6 лет назад

    i have an error :* help please . "Unknown plugin "transform-runtime" specified in "base" at 0, attempted"

  • @Seanitzel
    @Seanitzel 5 лет назад +3

    I just spend a whole day trying to configure nuxt 2 + firebase deployment and im on the edge ;(
    i tried all the ready templates from github and nothing is working....
    does anyone have any tips?

    • @sergioantoniotrujillodelva2332
      @sergioantoniotrujillodelva2332 5 лет назад

      Look at this post, medium.com/likecoin/quick-nuxt-js-ssr-prototyping-with-firebase-cloud-functions-5277553610a8, I'm inspired to make my template, github.com/strujillodv/nuxt2-ssr-firebase-hosting

  • @pedrovinuela
    @pedrovinuela 6 лет назад

    Hi, I'm getting an error: ReferenceError: Unknown plugin "transform-runtime" specified in "base" at 0, attempted to resolve relative to "F:\\NUXT\
    uxt-ssr\\functions\
    uxt" It occurs when I try to build after creating the package.json in /functions folder. Any hint????

  • @GrumpyPapaJim
    @GrumpyPapaJim 5 лет назад +1

    Does firebase hosting work with Universal mode or just static/SPA?

    • @oleksii-bryl
      @oleksii-bryl 5 лет назад +1

      Have you found an answer on your question?

    • @GrumpyPapaJim
      @GrumpyPapaJim 5 лет назад

      @@oleksii-bryl Yep. You have to host as a function for SSR, spa or static can be hosted directly.

  • @marcelmueller1982
    @marcelmueller1982 5 лет назад

    Using linters instead of comment them out can save teams.

  • @jean-marckleger9014
    @jean-marckleger9014 6 лет назад

    @10:00 missing written command: yarn or npm i in functions directory

  • @spencerneilan5040
    @spencerneilan5040 5 лет назад +1

    Can anyone help me? I got to 15:00 and instead of seeing the output like he's seeing on localhost:5004, I'm seeing just a { } on my browser window. I posted my github link of the work if someone wants to recreate it. github.com/spencerbug/nuxt-ssr-test/tree/master/functions
    Did anyone else get that?

    •  4 года назад

      My project too... i put a console.log(e) in the catch and i saw this error:
      Error: inject('content', value) has no value provided
      > at inject (functions/nuxt/index.js:150:0)
      > at plugin_server (functions/nuxt/content/plugin.server.js:9:0)
      > at createApp (functions/nuxt/index.js:222:0)
      > at processTicksAndRejections (internal/process/task_queues.js:97:5)
      > at async module.exports.__webpack_exports__.default (functions/nuxt/server.js:81:0)
      I have no idea how solve it.

  • @ワンアピシットナッタサン

    Hmm?!, why I googled and only found hosting on Firebase Functions not Hosting?

    • @joaquimley
      @joaquimley 5 лет назад

      To have SSR you need to use cloud functions.

  • @EcoPureLivingTV
    @EcoPureLivingTV 6 лет назад

    Hi, I would like to ask questions regarding the process where can I?

  • @cprlp
    @cprlp 6 лет назад

    Чертовы гении :)) Спасибо

  • @katkitay
    @katkitay 6 лет назад

    Hi guys - followed your tutorial to the line and deployed on Firebase but basic routing of additional .vue pages is not working - they all route back to index.vue. Can you help?

    • @kimellefsen4185
      @kimellefsen4185 6 лет назад +1

      I had the same issue. Found this example, and it solved it for me: github.com/davidroyer/nuxt-ssr-firebase/blob/master/prod/server/index.js#L15-L24

  • @jaehyukkim590
    @jaehyukkim590 6 лет назад

    It really is a really good video to me.

  • @rafaelsiloli
    @rafaelsiloli 5 лет назад

    Very, very, very nice man !!

  • @betomegarcia
    @betomegarcia 6 лет назад +4

    Wow Nuxt! Vue rules!

  • @jamesblock8384
    @jamesblock8384 4 года назад

    Quick question. @nuxt/vuetify is installed as a devdependency in the src package.json by default when running npx create-nuxt-app. Because it's a devdependency I didn't think I would need to list it as a dependency in my express server app that gets deployed to firebase. However, after deploying I get an error that says vuetify is not setup properly. The styling appears to be working but triggering click events seems to not be working. Obviously this will vary from project to project but what dependencies exactly do you need to include for the express server?

    • @jamesblock8384
      @jamesblock8384 4 года назад

      I also kind of feel like @nuxt/vuetify shouldn't be a devdependency. I figured maybe it was because thats where it gets placed when you use npx create-nuxt-app and I just assumed everything it needed would be exported into the builds css files.

  • @Dr.Raksmey
    @Dr.Raksmey 5 лет назад

    so after the final run build and copy function/nuxt/dist to /public directory then we can delete /dist from function/nuxt?

    • @hendrapratama9258
      @hendrapratama9258 5 лет назад

      I think firebase function still uses it for render request

  • @JustBCWi
    @JustBCWi 6 лет назад

    Ran into a problem with this when the babel configuration was added to the nuxt config. The solution was to put the config into .babelrc.

  • @PrakashBharti786
    @PrakashBharti786 6 лет назад

    David is great...

  • @mshbtw
    @mshbtw 6 лет назад

    package.json link is broken

  • @jonastorfs
    @jonastorfs 6 лет назад

    Did anyone actually get this to work? I always keep getting a 504 timeout error after my function is triggered. : stackoverflow.com/questions/52347444/nuxt-ssr-firebase-functions-returns-504-timeout

  • @tak68tak
    @tak68tak 5 лет назад

    i really luv it!

  • @ВладимирБекович
    @ВладимирБекович 6 лет назад

    What is your terminal ?

    • @KimcheeOnATaco
      @KimcheeOnATaco 6 лет назад +1

      Looks like VS Code with Zsh setup locally with a theme and configuration via .zshrc It pulls the styles, shortcuts, and all into the terminal in Code. In his case Bash I guess, but that's how I have mine setup.

  • @roytheey
    @roytheey 6 лет назад

    Could someone get a working copy of his code and upload it on github or something? I tried typing exactly the same as him but it doesn't work for me.

    • @oleglego8673
      @oleglego8673 6 лет назад

      functions/package.json
      {
      "name": "functions",
      "description": "Cloud Functions for Firebase",
      "scripts": {
      "serve": "firebase serve --only functions",
      "shell": "firebase functions:shell",
      "start": "npm run shell",
      "deploy": "firebase deploy --only functions",
      "logs": "firebase functions:log"
      },
      "dependencies": {
      "babel-plugin-transform-runtime": "^6.23.0",
      "babel-preset-stage-0": "^6.24.1",
      "babel-runtime": "^6.26.0",
      "clone": "^1.0.4",
      "debug": "^3.1.0",
      "es6-promise": "^4.2.4",
      "express": "^4.16.3",
      "firebase-admin": "~5.12.0",
      "firebase-functions": "^1.0.1",
      "lodash": "^4.17.5",
      "nuxt": "1.0.0-rc11",
      "vue": "^2.5.16",
      "vue-meta": "^1.5.0",
      "vue-router": "^3.0.1",
      "vuex": "^3.0.1"
      },
      "private": true
      }

    • @oleglego8673
      @oleglego8673 6 лет назад

      check nuxt version

  • @detautama9899
    @detautama9899 6 лет назад

    Thanks 😀

  • @mornir
    @mornir 6 лет назад

    Yes!

  • @TheYannsonnboys
    @TheYannsonnboys 6 лет назад

    Amazing

  • @Alex-xw5bc
    @Alex-xw5bc 3 года назад

    Please update video

  • @da404lewzer
    @da404lewzer 4 года назад

    Got 3/4 of the way in and realized he's using firebase... bleh NUXT i mean.. NEXT

  • @AlexanderEnocRodriguez
    @AlexanderEnocRodriguez 5 лет назад

    Gracias!!!

  • @chanlito4896
    @chanlito4896 6 лет назад

    Too bad it doesn't work with the latest version of Nuxt.

    • @RobMcCormack
      @RobMcCormack 6 лет назад

      It's working for me with v1.2.1. I needed to run `yarn generate` instead of `yarn build` though.

    • @chanlito4896
      @chanlito4896 6 лет назад

      Rob McCormack yarn generate isn't the same

    • @RobMcCormack
      @RobMcCormack 6 лет назад +1

      Ah! eek! Total lapse on my behalf. I'm assuming this is because cloud functions are still on Node 6, huh?

    • @chanlito4896
      @chanlito4896 6 лет назад

      Rob McCormack yes

    • @paulrenshaw3776
      @paulrenshaw3776 6 лет назад

      Yeah, what's funny is that the starter-template was updated to nuxt 1.0.0 before this was even published.

  • @hojdog
    @hojdog 5 лет назад

    A much better idea is this: don't.
    Just deploy on the google app engine as per the nuxt docs and you barely have to do any setup, but your billing is still lumped in with firebase. nuxtjs.org/faq/appengine-deployment

  • @SureshKumarMajhi
    @SureshKumarMajhi 3 года назад

    This video needs an update.

  • @MayClaude
    @MayClaude 6 лет назад

    thx

  • @ChristianBehrends
    @ChristianBehrends 6 лет назад

    This is way too delicate for real life development. Or I'm just too brutish, maybe.

    • @lucaban4146
      @lucaban4146 6 лет назад

      Why is it too delicate? I would appreciate your elaboration!

    • @ChristianBehrends
      @ChristianBehrends 6 лет назад

      Because it broke on me frequently. Switched to SPA, all fine.

    • @AndersonSilvaMMA
      @AndersonSilvaMMA 6 лет назад

      Christian Behrends SPA?

    • @ChristianBehrends
      @ChristianBehrends 6 лет назад

      Single Page Application. You can run Nuxt as SSR or SPA, which is *without* Server Side Rendering.

  • @JosepMonjo
    @JosepMonjo 6 лет назад

    It would be nice to have the full source code here github.com/firebase/functions-samples

  • @semuthitam2211
    @semuthitam2211 5 лет назад

    i need github files

    • @CagatayCal
      @CagatayCal 5 лет назад

      Here's GitHub github.com/davideast/nuxt-firebase/

  • @RenatoFontes
    @RenatoFontes 4 года назад +1

    this is pretty outdated :/

  • @TuanNguyen-zn9og
    @TuanNguyen-zn9og 4 года назад

    Seem like it is outdate!

  • @TheJaviercrafter
    @TheJaviercrafter 3 года назад

    :) i hate that. Point for Heroku...

  • @heyyy4987
    @heyyy4987 5 лет назад

    Nice. Not soo simple.

  • @DiegoJaraPalomino
    @DiegoJaraPalomino 6 лет назад

    was time about

  • @Seankim-vj1fl
    @Seankim-vj1fl 6 лет назад

    6:25

  • @hendrapratama9258
    @hendrapratama9258 5 лет назад

    maybe you can use this for the latest nuxt github.com/HendraPB/nuxt2-ssr-firebase