Directory Layout

Organize your Barry app using convention-based folders and simple, logical patterns.

File Structure

Barry uses a file-based routing system where the layout of your directories maps directly to your URL structure. Each route is represented by a directory containing an index.html file, and optionally, an index.server.go file for server-side logic. This predictable, convention-over-configuration approach keeps your project clean and easy to navigate.

Basic Project Layout

Barry uses a simple and intuitive folder structure. Every route is defined inside the routes/ directory, and each folder corresponds to a URL path.

/routes
├── index.html              → /
├── about/
│   ├── index.html          → /about
│   └── index.server.go     → Logic for /about
└── blog/
    ├── index.html          → /blog
    └── index.server.go     → Logic for /blog

This colocates your content and logic, making it easy to reason about each route. To see how Barry uses these server files to inject dynamic data, read more about Server Logic.

Structure Summary

Barry’s structure is influenced by modern frameworks like Next.js, but stripped back to just what you need. You define routes with folders, embed logic using Go, and serve fast HTML with almost zero config.

Once you understand this layout, you're ready to dive into Routing, Server Files, and Templating.