Skip to main content

ServerOptions

A server represents a logical DB with some additional configuration options.

Extends: DBInstanceConfig

Extended by: ServerServices

Properties

appName

appName: string

The application name to use in emails and other user-facing content. If not provided, a default name will be used.

buildInfo

buildInfo: [BuildInfo](/docs/api/interfaces/buildinfo)

Info about the build process.

customConfig

customConfig: Record<string, unknown>

Custom configuration to inject into client bundles. Merged with existing GoatDBConfig during static asset serving.

denoJson

denoJson: string

Path to deno.json. Defaults to 'deno.json' inside the current directory.

disableDefaultEndpoints

disableDefaultEndpoints: boolean

If true, disables all default endpoints and middlewares (health, auth, static, etc).

domain

domain: [DomainConfig](/docs/api/types/domainconfig)

Configuration for mapping custom domains to organizations and vice versa. This enables multi-tenant deployments where each organization can have its own domain or subdomain. For example:

  • org1.example.com -> maps to organization "org1"
  • org2.example.com -> maps to organization "org2" The mapping is bidirectional - domains can be resolved to org IDs and org IDs can be resolved to their domains.

emailConfig

emailConfig: EmailConfig<>

Configuration for the email service. Can use either SMTP or AWS SES via ://nodemailer.com/|NodeMailer.

Example SMTP configuration (see ://nodemailer.com/smtp/):

{
host: "smtp.gmail.com",
port: 587,
secure: true,
auth: {
user: "user@gmail.com",
pass: "app-specific-password"
},
debugEmails: true, // Enable email sending in development
from: "system@my.domain.com",
}

Example Amazon SES configuration (see ://nodemailer.com/ses/):

import { SendRawEmailCommand, SES } from "npm:@aws-sdk/client-ses";

{
SES: {
ses: new SES({ region: "us-east-1" }),
aws: { SendRawEmailCommand },
},
debugEmails: true, // Enable email sending in development
from: "system@my.domain.com",
}

fetchUserByEmail

fetchUserByEmail: (db: [GoatDB](/docs/api/classes/goatdb)<US>, email: string) => [ManagedItem](/docs/api/classes/manageditem)<US, [Schema](/docs/api/types/schema)> | Promise<[ManagedItem](/docs/api/classes/manageditem)<US, [Schema](/docs/api/types/schema)>>

A hook that's used during email-based authentication flows to look up or create users. This function is called when a user attempts to log in with an email address.

Implementing this hook allows you to:

  • Integrate with external user management systems
  • Implement custom user lookup logic
  • Lazily create users when they first authenticate
  • Apply organization-specific policies for user creation

If not provided, the system won't handle email-based authentication and authorization.

https

https: { cert: string; key: string } | { hostname: string; selfSigned: true }

HTTPS configuration for secure connections. When provided, the server will use HTTPS with the specified certificate. If selfSigned: true, a temporary self-signed certificate will be generated.

logStreams

logStreams: [LogStream](/docs/api/interfaces/logstream)[]

Optional array of log streams. All of the server binary's outputs will be directed to these streams.

path

path: string

The directory under which all server data will be stored. This includes database files, logs, and other persistent data.

port

port: number

The port the server will listen to. Defaults to 8080.

staticAssets

staticAssets: StaticAssets

Compiled static assets the server will serve.

Inherited Members

From DBInstanceConfig

Properties: debug, mode, orgId, peers, registry, trusted

See DBInstanceConfig for detailed documentation