Example configs
Three complete configs, one per way of running GenoaCMS. They are files in GenoaCMS's own repository,
beside the configs core runs with, and CI type-checks each one and loads it through the config
loader, so what this page shows is what the current release accepts. Read them on GitHub in packages/core/genoa.config/ .
Each imports the modules genoa init writes beside it: collections, authorization, security and languages. Replace the placeholder names — my-project, my-company, the bucket names — with
your own resources: GenoaCMS works on buckets and databases that already exist.
Google Cloud
Users sign in through Firebase Authentication or Identity Platform; content lives in Cloud Storage and Firestore; GenoaCMS runs as a Cloud Run function. Every provider authenticates as the function's service account, so the config holds no credential.
import {
defineConfig, storageProvider, databaseProvider, authenticationProvider,
secretsProvider, deploymentTarget
} from '@genoacms/config'
import type {} from '@genoacms/adapter-gcp/authentication/identity-platform'
import type {} from '@genoacms/adapter-gcp/storage'
import type {} from '@genoacms/adapter-gcp/database'
import type {} from '@genoacms/adapter-gcp/secrets'
import type {} from '@genoacms/adapter-gcp/deployment'
import { collections } from './collections.js'
import { authorization } from './authorization.js'
import { security } from './security.js'
import { languages } from './languages.js'
/**
* Example: production on Google Cloud. Users sign in through Firebase Authentication, and every
* provider authenticates as the function's service account, so no credential is written here.
*
* genoa deploy gcp --config genoa.config/gcp.ts
*/
export default defineConfig({
authentication: {
cookieName: '__session',
providers: {
firebase: authenticationProvider('@genoacms/adapter-gcp/authentication/identity-platform', { projectId: 'my-project' })
}
},
secrets: {
providers: { 'secret-manager': secretsProvider('@genoacms/adapter-gcp/secrets', { projectId: 'my-project' }) }
},
storage: {
providers: {
gcs: storageProvider('@genoacms/adapter-gcp/storage', { projectId: 'my-project' })
},
buckets: { 'my-project-cms': { provider: 'gcs' }, 'my-project-public': { provider: 'gcs' } },
defaultBucket: 'my-project-cms'
},
database: {
providers: {
firestore: databaseProvider('@genoacms/adapter-gcp/database', { projectId: 'my-project', databaseId: '(default)' })
},
databases: { content: { provider: 'firestore', collections } }
},
languages,
deployment: {
targets: {
gcp: deploymentTarget('@genoacms/adapter-gcp/deployment', {
projectId: 'my-project',
region: 'europe-west3',
memory: '1Gi',
serviceAccount: 'genoacms@my-project.iam.gserviceaccount.com'
})
}
},
authorization,
security
}) Before the first deploy:
- Authentication. Enable Firebase Authentication (or Identity Platform) with email and password sign-in in
my-project, and create the users there. The first administrator'sauthorization.assignmentskey is that user's UID. - Runtime service account (
serviceAccountabove):roles/storage.objectAdminon each bucket,roles/datastore.user,roles/secretmanager.adminor a narrower custom role,roles/iam.serviceAccountTokenCreatoron itself (for signed URLs), androles/firebaseauth.viewer. - You, deploying:
roles/cloudfunctions.developer, androles/iam.serviceAccountUseron the runtime service account.genoa deployuses your Application Default Credentials (gcloud auth application-default login), since the target sets nocredentials.
genoa deploy gcp --config genoa.config/gcp.ts AWS
Content lives in S3 and DynamoDB, secrets in Secrets Manager, and GenoaCMS runs as a Lambda function. Every provider takes the SDK's default credentials, which in Lambda are the function's execution role. AWS has no authentication adapter yet, so administrators sign in from a list kept in Secrets Manager.
import {
defineConfig, storageProvider, databaseProvider, authenticationProvider,
secretsProvider, deploymentTarget, secret
} from '@genoacms/config'
import type {} from '@genoacms/authentication-adapter-array'
import type {} from '@genoacms/adapter-aws/storage'
import type {} from '@genoacms/adapter-aws/database'
import type {} from '@genoacms/adapter-aws/secrets'
import type {} from '@genoacms/adapter-aws/deployment'
import { collections } from './collections.js'
import { authorization } from './authorization.js'
import { security } from './security.js'
import { languages } from './languages.js'
/**
* Example: production on AWS. Every provider takes the SDK's default credentials, which are the
* Lambda function's execution role once deployed; the administrators' credentials live in
* Secrets Manager.
*
* genoa deploy aws --config genoa.config/aws.ts
*/
export default defineConfig({
authentication: {
cookieName: '__session',
providers: {
admins: authenticationProvider('@genoacms/authentication-adapter-array', { credentials: secret('GENOACMS_ADMIN_CREDENTIALS') })
}
},
secrets: {
providers: { 'secrets-manager': secretsProvider('@genoacms/adapter-aws/secrets', { region: 'eu-central-1' }) }
},
storage: {
providers: {
s3: storageProvider('@genoacms/adapter-aws/storage', { region: 'eu-central-1' })
},
buckets: { 'my-company-cms': { provider: 's3' }, 'my-company-public': { provider: 's3' } },
defaultBucket: 'my-company-cms'
},
database: {
providers: {
dynamodb: databaseProvider('@genoacms/adapter-aws/database', { region: 'eu-central-1' })
},
databases: { content: { provider: 'dynamodb', collections } }
},
languages,
deployment: {
targets: {
aws: deploymentTarget('@genoacms/adapter-aws/deployment', {
region: 'eu-central-1',
role: 'arn:aws:iam::123456789012:role/genoacms',
artifactBucket: 'my-company-deployments'
})
}
},
authorization,
security
}) Before the first deploy:
- Tables. Each collection is a DynamoDB table of the same name, with a string partition key named after its
primaryKey.key. - Administrators. Store
GENOACMS_ADMIN_CREDENTIALSin Secrets Manager as a JSON array of{ "email", "password", "subject" }. The first administrator'sauthorization.assignmentskey is itssubject. - Execution role (
roleabove):s3:GetObject,PutObject,DeleteObjectandListBucketon each bucket;dynamodb:GetItem,PutItem,UpdateItem,DeleteItemandScanon each table;secretsmanager:GetSecretValue,DescribeSecret,PutSecretValue,CreateSecretandDeleteSecret; andAWSLambdaBasicExecutionRolefor logs. - You, deploying: create, read and update the function and its URL,
iam:PassRoleon the execution role, ands3:PutObjectonartifactBucket.
genoa deploy aws --config genoa.config/aws.ts Self-hosted
Content lives in MinIO and PostgreSQL on machines you run, and Node serves GenoaCMS. No cloud account is involved.
import {
defineConfig, storageProvider, databaseProvider, authenticationProvider,
secretsProvider, deploymentTarget, secret
} from '@genoacms/config'
import type {} from '@genoacms/authentication-adapter-array'
import type {} from '@genoacms/adapter-minio'
import type {} from '@genoacms/adapter-postgres'
import type {} from '@genoacms/adapter-secrets-env'
import type {} from '@genoacms/adapter-node'
import { collections } from './collections.js'
import { authorization } from './authorization.js'
import { security } from './security.js'
import { languages } from './languages.js'
/**
* Example: MinIO and PostgreSQL on your own machines, served by Node. Every secret lives in
* .genoacms/secrets.env. That store is for development only, so this config is a development one:
*
* genoa dev --config genoa.config/self-hosted.ts
*/
export default defineConfig({
authentication: {
cookieName: '__session',
providers: {
admins: authenticationProvider('@genoacms/authentication-adapter-array', { credentials: secret('GENOACMS_ADMIN_CREDENTIALS') })
}
},
secrets: {
providers: { local: secretsProvider('@genoacms/adapter-secrets-env', {}) }
},
storage: {
providers: {
minio: storageProvider('@genoacms/adapter-minio', {
endPoint: 'localhost',
port: 9000,
useSSL: false,
accessKey: secret('MINIO_ACCESS_KEY'),
secretKey: secret('MINIO_SECRET_KEY')
})
},
buckets: { cms: { provider: 'minio' }, public: { provider: 'minio' } },
defaultBucket: 'cms'
},
database: {
providers: {
postgres: databaseProvider('@genoacms/adapter-postgres', {
host: 'localhost',
database: 'genoacms',
user: 'genoacms',
password: secret('POSTGRES_PASSWORD')
})
},
databases: { content: { provider: 'postgres', collections } }
},
languages,
deployment: { targets: { node: deploymentTarget('@genoacms/adapter-node', { outDir: 'build' }) } },
authorization,
security
}) Every secret here lives in .genoacms/secrets.env, the development store, and a production build
refuses it. GenoaCMS has no secrets store yet that runs in production without a cloud account. To run
self-hosted in production, keep MinIO, Postgres and Node, and point secrets at a cloud secret
manager.
Before the first start:
- MinIO: the buckets
cmsandpublicexist. - PostgreSQL: the database
genoacms, a usergenoacmsthat can read and write it, and one table per collection. - Secrets:
.genoacms/secrets.envholdsMINIO_ACCESS_KEY,MINIO_SECRET_KEY,POSTGRES_PASSWORDandGENOACMS_ADMIN_CREDENTIALS, the last as one line of JSON.
genoa dev --config genoa.config/self-hosted.ts To serve it without the dev server, genoa deploy node --mode development --config genoa.config/self-hosted.ts builds it and copies the artifact to build/; run npm install --omit=dev there, and start it with node build.