Getting Started
CLI
Request handling
- Routing
- Action Controller
- Resources
- Context
- Request Binding
- Middleware
- Error Handling
- Sessions
- Cookies
Frontend
Database
- Getting started with Pop
- Soda CLI
- Database Configuration
- Buffalo Integration
- Models
- Generators
- Migrations
- Fizz
- Mutations
- Querying
- Raw Queries
- Callbacks
- Scoping
- Associations and Relationships
- One to one associations
- One to many associations
Guides
- API Applications
- File Uploads
- Background Job Workers
- Mailers
- Tasks
- Local Authentication
- Third Party Authentication
- Events
- Go Modules
- Localization
- Logging
- Template Engines
- Testing
- Videos
Deploy
Getting Started
Directory Structure
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 go through its contents.
The Root Directory
Here is the structure of a Buffalo project:
├── .yarn/
├── actions/
│ ├── app.go
│ └── render.go
├── assets/
├── cmd/
│ └── app/
│ └── main.go
├── config/
├── fixtures/
├── grifts/
├── locales/
├── models/
├── public/
├── templates/
├── .babelrc
├── .buffalo.dev.yml
├── .codeclimate.yml
├── .docketignore
├── .env
├── .gitignore
├── .pnp.loader.mjs
├── .yarnrc.yml
├── database.yml
├── Dockerfile
├── go.mod
├── go.sum
├── inflections.json
├── package.json
├── postcss.config.js
├── README.md
├── webpack.config.js
└── yarn.lock
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 contains raw assets which will be compiled/compressed & put in the public
directory.
cmd
This folder contains the main.go
file which bootstraps your app and starts it.
grifts
This directory contains the tasks powered by grift.
locales
app.go
file in the actions
directory.
This directory is used by the i18n system. It will fetch the translation strings from here.
models
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 reflect objects from the datasource.
public
This directory contains the public (compiled/compressed) assets. If you use webpack, it will put its assets in this directory.
templates
This directory handles the View part of the MVC pattern. It contains the project templates, used to render the views.
tmp
This directory is used by the buffalo dev
command to rebuild your project on every change. The temporary files that Buffalo works with are put here.
database.yml
This file contains the database configuration for pop/soda.
Next Steps
- Configuration - Manage your app configuration.
- Tooling Integration - Work with Buffalo, using existing tools.