Project Structure using DHTMLX:Optimus,Laravel backend


#1

Hello,

I am trying to get my project structure straight.
As single developer I have one repo per main project.
My project is a management system, devided into modules.
I’m thinking about using DHTMLX as frontend with use of the new Optimus framework (Works great btw).
And using Laravel (PHP) as backend.
I already master Laravel and always like to keep this as base project structure.
This is my idea:
*root is my laravel directorty

  • app

  • …other laravel dirs

  • public (!!This is the root of the webproject where users start)[list]
    []dhtmlx (Having all seperate gulp files per mdl for development .gitignored)
    [list][
    ]mdl_x[list][*]mdl_x.js

  • mdl_x.css
    [/:m][]mdl_y* mdl_y.js

  • mdl_y.css
    [/:m][/list:u][/:m]
    []dhtmlx_dist (folder where I build the entire project files app.css and app.js)[/:m]
    []… other assets and laravel start index file[/:m][/list:u][/:m]
    [
    ]resources (this is the resource folder of laravel…)

  • assets

  • dhtmlx (!!DHTMLX start)[list]
    [*]node_modules (!!npm packages - only once for all optimusses)

  • mdl_dashboard
    [list]
    [*]codebase

  • sources


  • [/:m]
    [
    ]mdl_x (!!seperate optimus app)

  • codebase

  • sources


  • [/:m]
    [
    ]mdl_products (!!seperate optimus app)

  • codebase

  • sources


  • [/:m]
    [
    ]mdl_y (!!seperate optimus app)[/:m][/list:u][/:m]
    []lang[/:m]
    []views[/:m][/list:u][/:m]
    [
    ]…other laravel dirs and files[/*:m][/list:u]

These are my questions:
As you cansee, I’m developing the modules as seperate optimus projects (Because this is the idea behind it)
And I will have one main optimus project to combine all and show modules according to client needs/rights.

  • Can I have maybe one optimus project with different modules (seperatly build etc…)
  • Can the node_modules folder (npm packages) be the same for all other optimus projects?)
  • I mainly use ‘npm run watch’ while developing, this generates the packaged files, can’t I just use these for the production server?
  • Any other suggestions ow how to organize this kind of project?

#2

Can I have maybe one optimus project with different modules (seperatly build etc…)
Sure, you can change the output section in the webpack.config.js

var config = { entry: { "modA":'./sources/modA', "modB":'./sources/modB' }, output: { path: path.join(__dirname, 'codebase'), publicPath:"/codebase/", filename: '[name].js' },

Can the node_modules folder (npm packages) be the same for all other optimus projects?)
The files in the node_modules are always the same, so if you have multiple projects you can have something like next

[code]- root project folder

  • node_modules
  • sub_project1
  • sub_project2
  • sub_project3
    [/code]

Here sub_project folder need not have their own node_modules folder, they all will share the node_modules folder in the root project folder

I mainly use ‘npm run watch’ while developing, this generates the packaged files, can’t I just use these for the production server?
Yes, this method doesn’t have significant disadvantages.
You can use npm run codebase which is similar to “watch” mode but builds files only once and suits better for production ( the building process is exactly the same as in case of “watch” command )


#3

Hello,

Thank you for your suggestion!
I tested this, did some extra tweaks to webpack and npm, it works great!

Thanks