GenoaCMS splits its responsibilities into services.

Authentication

This service is responsible for checking whether the user is who they claim to be. Additionally, it is responsible for creating and managing user sessions. GenoaCMS uses JWT tokens transported in cookies to manage sessions.

Config type

authentication: {
    providers: AuthenticationProvider[]
    cookieName: string
    JWTSecret: string
}
ts
Ensure cookie name is valid

Some cloud hosting services strip cookies from requests and allow only specific ones. To avoid breaking auth, set the cookie name to a value that is not stripped.

Change JWT secret

To reduce risk of token compromise, set the JWT secret to have unique value.

Authorization

This service is responsible for checking whether the user has permission to access GenoaCMS. In current state of GenoaCMS, it is just a simple check for user role.

Config type

authorization: {
    providers: AuthorizationProvider[]
}
ts

Database

Service responsible for managing data storage. It is possible to define multiple databases and multiple providers.

Config type

database: {
    databases: DatabaseInit[]
    providers: DatabaseProvider[]
  }
ts

In order to manage a database, at least one provider, database and collection must be registered.

DatabaseInit

interface DatabaseInit {
  providerName: string
  collections: CollectionReference[]
  testDocuments?: [Document, Document]
}
ts

This structure is used for registering a database and its collections.

Field testDocuments is only used when developing storage adapter for unit testing.

CollectionReference

interface CollectionReference {
  name: string
  primaryKey: {
    key: string,
    schema: JSONSchemaType<any>
  },
  schema: JSONSchemaType<any>
}
ts

This structure is used for registering a collection in a database. The name should reflect the name of the collection/table in the database. The primaryKey is used to declare which field of the document/row is used for its identification. The schema is used to define the structure of the collection.

The schema is defined using JSON Schema . GenoaCMS additionally defines a few custom types in the @genoacms/cloudabstraction package. Those schemas are:

  • storageResource - used to define a reference to a storage resource
  • nullableStorageResource - used to define a nullable reference to a storage resource
  • reference - used to define a reference to a document in another collection or database
Composed key

Composed keys are currently not supported.

Deployment

Service responsible for deploying GenoaCMS to compute solution. No special configuration is required, just the adapter.

Config type

deployment: {
    adapter: Promise<DeploymentAdapter>
}
ts

Storage

Service responsible for managing file storage. It is possible to define multiple buckets and multiple providers. It is required to define at least one bucket and one provider. GenoaCMS uses it to store its internal data.

Config type

  storage: {
    defaultBucket: string
    buckets: BucketInit[]
    providers: StorageProvider[]
  }
ts

Field defaultBucket is used to designate the bucket where GenoaCMS stores its internal data.

Default bucket should be private

For security reasons, the default bucket should not be publicly accessible. There is a recommendation to have at least two buckets: one for public data and one for private data.

BucketInit

interface BucketInit {
  name: string
  providerName: string
}
ts

Structure for registering a bucket, the name shall match the name of existing bucket.