Building Modules
Overview
Open Game Backend is built from the ground up to enable as many game developers as possible to write backend code & modify existing modules.
Components
Modules have access to the following core components:
- Scripts Scripts are used to write TypeScript code that runs on the backend. Request & response types are automatically validated.
- Database Modules provide tooling to write database schemas, query data from scripts with type safety, and automatically create + migrate databases.
- User Config Modules can allow projects to pass configuration options to the module.
- Errors Modules specify the types of errors that can occur in their scripts.
File structure
module.yaml
Module configuration file. Documentationconfig.ts
(optional) If provided, defines the user configuration schema. Documentationscripts/
Holds all scripts.*.ts
Script to be exposed. Documentation
db/
(optional) If provided, holds all database related files. Documentationschema.prisma
Database schema.migrations/
Database migrations auto-generated fromschema.prisma
. This directory should not be manually modified unless you know what you are doing.*/*.sql
Individual database migration. These are executed in order of the directory names.