A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API. Take it for a spin in our playground!
For a complete guide and working demo refer to the doumentation
<script src="https://cdn.CoCreateJS.com/organizations/latest/CoCreate-organizations.min.js"></script><script src="https://cdn.CoCreateJS.com/organizations/latest/CoCreate-organizations.min.css"></script>$ npm i @cocreate/organizations$ yarn install @cocreate/organizationsAll updates to this library are documented in our CHANGELOG and releases. You may also subscribe to email for releases and breaking changes.
If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We would love to hear your feedback.
CoCreate-organizations is guided and supported by the CoCreate Developer Experience Team.
Please Email the Developer Experience Team here in case of any queries.
CoCreate-organizations is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.
We encourage contribution to our libraries (you might even score some nifty swag), please see our CONTRIBUTING guide for details.
We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create issues and pull requests or merely upvote or comment on existing issues or pull requests.
We appreciate your continued support, thank you!
Run signUp and signIn successfully before createOrganization. The client
sends the organizations form record without submitting a user profile,
password, keys, or switching its current connection. Separate sections of a
single form may supply signup and organization details.
The server requires an authenticated socket and uses its source organization
and user ID to resolve a single keys credential (type: "user"). The
credential's array and key identify the profile to copy; the collection name
is not hardcoded. The profile keeps its ID, with password and CRUD metadata
excluded. A new tenant credential preserves existing authentication fields
server-side and receives the new tenant's admin role. Client-supplied user and
key records are ignored. The local generateDB bootstrap remains separate.
The submitted organization fields, including host and storage, are preserved;
server-generated IDs replace supplied IDs, and internal $ metadata and
bootstrapStorage are excluded. Regular CRUD calls register the organization
first, then create its tenant organization record, user, and keys. Storage
routing uses the platform organization ID for all creation requests. The first
write targets the platform database; subsequent writes explicitly target the
new organization ID as their database. Ownership handoff is separate. Creation stops on the first
failed operation. These writes are not transactional: a failed provision can
leave a registered organization with incomplete tenant data. The hostname availability lookup is not an atomic
reservation; concurrent creation of the same hostname needs a database-level
uniqueness constraint before public onboarding.
Responses remain in the source session scope and return the new organization's
ID, name, host, and the profile ID/collection. Credentials and storage
connection settings are not returned. After publishing succeeds, the creation
action sets the returned organization URL on its button. Both creation actions
use action.end(response) only on success, otherwise action.abort(), with
shared notification rendering.
Initialize the Node module explicitly after the shared server is ready:
const Organizations = await import("@cocreate/organizations");
await Organizations.init(server);Initialization attaches server.organizations. Its provision(data) method
clones the public site template into the isolated local workspace, attempts the
managed repository backup, and then runs coc upload. Organization signup
awaits that full sequence after all required database writes succeed. The
successful response provides the organization URL, which the browser assigns
to the action button's href; the action runner follows it only after the
button's remaining actions finish. Missing GitHub credentials or a remote
outage set git.backup.status to failed without blocking the upload, while an
upload failure marks provisioning failed and prevents the redirect. Other
services, including Server AI, call the same provisioning method when an
organization checkout is needed; they do not implement GitHub or cloning logic
themselves.
Provisioning configuration is loaded from the organizations configuration
namespace and servers_config records with type: "organizations". GitHub
credentials come from the provider-native token field in the configured
platform API record and are passed to Git
through process-local headers, never repository URLs or saved Git config.
