Organization
Represent an organization that owns and manage healthcare facilities.
Schema
| Property Name | Type | Required |
|---|---|---|
| name | string | YES |
| slug | string | YES |
| logo | string | NO |
| status | CodedConcept | YES |
| metadata.description | string | NO |
| settings_id | string | YES |
Auto-generated by better-auth
| Property Name | Type | Native Type (PostgreSQL) |
|---|---|---|
| id | string | text |
| created_at | string | timestampz |
Example
JSON
{
"id": "123",
"name": "Medika Jaya Grup",
"slug": "medika-jaya-grup",
"logo": "https://image.url.com",
"status": {
"system": "crn:status:system",
"value": "active",
"display": "Active"
},
"metadata": {
"description": "Grup pemberi layanan kesehatan nomor satu."
},
"settings_id": "123",
"created_at": "2026-10-02 21:27:00+07"
}
Important Notes
Additional Field
Better Auth Organization plugin core schema only consist of id, name, slug, logo, metadata, createdAt. The other property defined above are additional field you must add in your better auth configuration like below
const auth = betterAuth({
plugins: [
organization({
schema: {
organization: {
additionalFields: {
status: {
type: "string",
required: true,
defaultValue: JSON.stringify({
system: "crn:status:system",
value: "active",
display: "Active",
}),
input: true,
},
settings_id: {
type: "string",
required: true,
input: false,
},
},
},
},
}),
],
});
Read here to learn more on how to extend better auth core schema.
Case Style
Better Auth uses camelCase by default. To keep your database schema consistent in snake_case, add the following configuration:
const auth = betterAuth({
plugins: [
organization({
schema: {
organization: {
fields: {
createdAt: "created_at",
},
},
},
}),
],
});
Info
Type inference in your code will still use the original field names (e.g., organization.createdAt, not organization.created_at).