Organizations: Ability to add custom additional fields #1137

Closed
opened 2026-03-13 08:24:28 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Sillyvan on GitHub (Apr 30, 2025).

Is this suited for github?

  • Yes, this is suited for github

Currently, the organization plugin provides a basic structure for organizations but feels quite minimal. It doesn't offer a built-in way to extend the organization entity with custom fields (e.g., address, phone number, industry type, VAT ID).

In my case the user that signs up will own his own org and that all from 1 sign up form.

Currently this would require:

  • Manually changing the org table schema
  • Create a custom api endpoint that takes in both, user and org data required.
  • Create User and Org with better-auths functionality
  • Insert the additional org data manually with your ORM

The database after hooks dont do the job here because it only allows me to access the user/session data and i dont want to store org infos in both just to pass it down to the hook and then manually insert stuff in my org table

Describe the solution you'd like

Add an additionalField field in the plugin just like with user or session that is also typed in the create function

Describe alternatives you've considered

Maybe a single function that allows coupling both these processes. Main issue is that 1 request should contain the data for both steps, user and org.

Additional context

No response

Originally created by @Sillyvan on GitHub (Apr 30, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Currently, the organization plugin provides a basic structure for organizations but feels quite minimal. It doesn't offer a built-in way to extend the organization entity with custom fields (e.g., address, phone number, industry type, VAT ID). In my case the user that signs up will own his own org and that all from 1 sign up form. Currently this would require: - Manually changing the org table schema - Create a custom api endpoint that takes in both, user and org data required. - Create User and Org with better-auths functionality - Insert the additional org data manually with your ORM The database after hooks dont do the job here because it only allows me to access the user/session data and i dont want to store org infos in both just to pass it down to the hook and then manually insert stuff in my org table ### Describe the solution you'd like Add an additionalField field in the plugin just like with user or session that is also typed in the create function ### Describe alternatives you've considered Maybe a single function that allows coupling both these processes. Main issue is that 1 request should contain the data for both steps, user and org. ### Additional context _No response_
Author
Owner

@kdcokenny commented on GitHub (May 1, 2025):

https://github.com/better-auth/better-auth/issues/2036

@kdcokenny commented on GitHub (May 1, 2025): https://github.com/better-auth/better-auth/issues/2036
Author
Owner

@axelrtgs commented on GitHub (May 28, 2025):

I semi worked around this by using a database hook to deserialize the metadata into a new column. It works great on creation of org but the org plugin only supports hooks on create/delete and not update so I'm not able to keep it updated when changes are made to the metadata.

Since this might be a complicated task to support the additional fields natively perhaps in the interim we can add the ability to use hooks on update so we can implement this manually for now.

@axelrtgs commented on GitHub (May 28, 2025): I semi worked around this by using a database hook to deserialize the metadata into a new column. It works great on creation of org but the org plugin only supports hooks on create/delete and not update so I'm not able to keep it updated when changes are made to the metadata. Since this might be a complicated task to support the additional fields natively perhaps in the interim we can add the ability to use hooks on update so we can implement this manually for now.
Author
Owner

@felipemotarocha commented on GitHub (May 30, 2025):

This would be very helpful.

@felipemotarocha commented on GitHub (May 30, 2025): This would be very helpful.
Author
Owner

@Kinfe123 commented on GitHub (Aug 10, 2025):

This should be fixed by now. check this

@Kinfe123 commented on GitHub (Aug 10, 2025): This should be fixed by now. check [this](https://www.better-auth.com/docs/plugins/organization#customizing-the-schema)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1137