File Structure

Go-Mojito expects a certain file structure by default for the resources folder. You can change that too of course. Apart from that, the file tree below shows our suggestion for a solid project structure.

  • handlers Handler Code
    • handler.go Handles Home View
  • models DB Models
  • resources Static Files
    • assets CSS, Images, Scripts
      • style.css Website Styling
    • templates Mojito Templates
      • Layout
        • Default.mojito Default Layout
      • Home.Mojito Home View
  • services Data Providers
  • go.mod
  • go.sum
  • main.go Starting Point

For your Go Code there is no specific structure Go-Mojito expects. The Resources folder is the only exception, as it contains static files that need to be accessed at runtime. You can change the path of the resources directory, as well as the subpaths for both assets and templates. We recommend you leave it as is though.