Directory structure

Introduction

Buffalo provides you a minimal directory structure to work on your project. This structure keeps the project clean, and allow the generators to work. Don't try to reinvent the wheel, and let Buffalo buy you more time to do the interesting part of your app! :)

Now that you have a minimal new project, let's see its contents.

The root directory

actions

This directory handles the Controller part of the MVC pattern. It contains the handlers for your URLs, plus:

  • the app.go file to setup your app & routes,
  • the render.go file to setup the template engine(s).

assets

This directory is optional. If you don't need to use a frontend setup (API only, for instance), it can be removed.

This directory contains raw assets which will be compiled/compressed & put in the public directory.

grifts

This directory is optional. If you don't need to use tasks, you can remove it.

This directory contains the tasks powered by grift.

locales

This directory is optional. If you use only one language, you can remove it and the i18n module from the app.go file in the actions dir.

This directory is used by the i18n system. It will fetch the translation strings from here.

models

If you use pop/soda with the integrated generator, it will generate the model files here.

This directory is optional. If you don't need to use a database, it can be removed.

This directory handles the Model part of the MVC pattern. It contains the models.go file to initialize the datasource connection, and the model files to refect objects from the datasource.

public

The contents of this directory are auto-generated.

This directory contains the public (compiled/compressed) assets. If you use webpack, it will use this directory to put its assets.

templates

This directory is optional. If you don't need to use a frontend setup (API only, for instance), it can be removed.

This directory handles the View part of the MVC pattern. It contains the project templates, used to render the views.

tmp

The contents of this directory are auto-generated.

This directory is used by the buffalo dev command to rebuild your project on every change. Here are put the temporary files Buffalo works with.

database.yml

This file is optional. If you don't need a database, or if you want to handle the database without pop/soda, you can remove it.

This file contains the database configuration for pop/soda.

main.go

This file bootstraps your app and starts it.

Copyright © 2017 Buffalo. All rights reserved.

Buffalo Gopher designed by Ashley McNamara — Original Gopher designed by Renee French.