Bando Documentation

Configuration

Configure the project and register the collections that represent your application's content.

What is the configuration for?

Bando needs to know two important things before running the application:

  1. Where the database that stores the documents is located.
  2. Which collections are part of the project.

This information lives in bando.config.ts.

TS
import { defineConfig } from "bando-cms";
import { posts } from "./collections/posts.js";
export default defineConfig({
database: {
url: process.env.DATABASE_URL,
},
collections: [posts],
});

database.url

database.url tells Bando how to connect to PostgreSQL.

In the example, we use process.env.DATABASE_URL. This means the value comes from an environment variable instead of being written directly in the code.

collections

collections tells Bando which collections have been registered by the application.

A collection is the definition of a content type. For example, a blog can have a collection called posts.

ParâmetroTipoObrigatórioPor omissãoDescrição
database.urlstringnãoPostgreSQL connection URL. If missing, the runtime uses DATABASE_URL and then the predefined local URL.
collectionsarray or recordyesCollections available to the runtime. At least one registered collection is required.
Learn about collections →
Configuration | Bando