Vue + Node setup

I'm currently in the process of building a new project, this project contains of a backend + web app + single page app.

I've already set up the backend with Node (Typescript), using Hapi and Postgres. Now I'm a bit confused about how to proceed, I'm looking to first build a single page app in Vue, which obviously requires Webpack. My actual web app will be build in Vue as well, and I'm looking to share components between the two applications.

Now I could build this as a separate project, but at least for the single page app I want to use SSR. So my question now is, does anyone have a recommended setup for this.

My current structure looks like this:

- src

|- Server.ts

|- models

|- User.ts

|- ...

- package.json

- tsconfig.json

- ...

Would I simply do; or is there a better way to tackle this?

- server

| - src

|- Server.ts

|- models

|- User.ts

|- ...

| - client

|- components

- package.json

- tsconfig.json

- webpack.config.js

- ...

Posted Aug 4, 2018, 10:22 AM UTC

55
sv-2•
2
PessimisticCoderOP•

That's what I was after, kinda confirms what I was thinking too. Thanks!

1
randomNext•

Maybe you should consider just building one universal app instead of a webapp + a single page app?

It sounds like duplicate work to maintain 2 client apps.

Have a look at nuxtjs, it comes with batteries included SSR and a simple folder convention for routing.

1
PessimisticCoderOP•

The two client apps aren't the real problem tho. My only concern is how I effectively maintain my client app and server and what the best structure is.

Also from what I understand, nuxtjs is mostly focussed on rendering your Vue app from the server. So getting data still needs to come from somewhere else. This isn't what I'm after.

1
FURyannnn•

There's a Nuxt template that bundles with Express so you could serve data at the same time. Definitely worth a look.

1