> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Community

> Create a community with SDK-backed privacy, moderation, story, category, metadata, and member settings.

Use the create-community API for your platform to set up a community with a display name, description, privacy mode, category IDs, post moderation setting, story settings, metadata, and optional initial members.

<Info>
  Public/private visibility, discoverability, and join approval are separate settings in the SDK. Configure the combination that matches your product flow, then rely on backend permission enforcement for actual access control.
</Info>

## Parameters

TypeScript exposes `CommunityRepository.createCommunity()`. iOS uses `AmityCommunityCreateOptions` with `createCommunity(with:)`. Android and Flutter start from `AmitySocialClient.newCommunityRepository().createCommunity(...)`.

| Setting                          | Platforms                          | Description                                                  |
| -------------------------------- | ---------------------------------- | ------------------------------------------------------------ |
| `displayName`                    | TypeScript, iOS, Android, Flutter  | Required community display name                              |
| `description`                    | TypeScript, iOS, Android, Flutter  | Optional community description                               |
| `isPublic`                       | TypeScript, iOS, Android, Flutter  | Public/private visibility flag                               |
| `avatarFileId` / `avatar`        | TypeScript / iOS, Android, Flutter | Avatar file ID or uploaded SDK image object                  |
| `categoryIds`                    | TypeScript, iOS, Android, Flutter  | Category IDs linked to the community                         |
| `postSetting` / `postSettings`   | TypeScript, iOS, Android, Flutter  | Post creation and review setting                             |
| `storySetting` / `storySettings` | TypeScript, iOS, Android, Flutter  | Story comment setting                                        |
| `metadata`                       | TypeScript, iOS, Android, Flutter  | Custom metadata object                                       |
| `userIds`                        | TypeScript, iOS, Android, Flutter  | Initial members to add during creation                       |
| `tags`                           | TypeScript, Android, Flutter       | Search/filter tags                                           |
| `isDiscoverable`                 | TypeScript, iOS, Android           | Whether a private community can appear in discovery surfaces |
| `requiresJoinApproval`           | TypeScript, iOS, Android           | Whether join requests require approval                       |

## Privacy Settings

| Setting                | Description                                                 |
| ---------------------- | ----------------------------------------------------------- |
| `isPublic`             | Controls whether the community is public or private         |
| `isDiscoverable`       | Lets supported SDKs create discoverable private communities |
| `requiresJoinApproval` | Lets supported SDKs request approval before users join      |

## Post Moderation Options

| Concept               | TypeScript                   | iOS                        | Android / Flutter            |
| --------------------- | ---------------------------- | -------------------------- | ---------------------------- |
| Anyone can post       | `ANYONE_CAN_POST`            | `.anyoneCanPost`           | `ANYONE_CAN_POST`            |
| Admin review required | `ADMIN_REVIEW_POST_REQUIRED` | `.adminReviewPostRequired` | `ADMIN_REVIEW_POST_REQUIRED` |
| Admins only           | `ONLY_ADMIN_CAN_POST`        | `.onlyAdminCanPost`        | `ADMIN_CAN_POST_ONLY`        |

## Story Settings

Communities can be configured with story comment settings:

| Platform          | Shape                                                                                                  |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| TypeScript        | `storySetting: { enableComment: true }`                                                                |
| iOS               | `setStorySettings(allowComment: true)`                                                                 |
| Android / Flutter | `AmityCommunityStorySettings(allowComment = true)` / `AmityCommunityStorySettings(allowComment: true)` |

## Create a Community

Use this method after your app has collected the required display name and any optional privacy, moderation, category, member, tag, or metadata settings.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { CommunityPostSettings, CommunityRepository } from '@amityco/ts-sdk';

  async function createCommunity(): Promise<Amity.Community> {
    const { data: community } = await CommunityRepository.createCommunity({
      displayName: 'My Community',
      description: 'Community description',
      isPublic: true,
      isDiscoverable: true,
      requiresJoinApproval: false,
      postSetting: CommunityPostSettings.ANYONE_CAN_POST,
      storySetting: { enableComment: true },
      categoryIds: ['categoryId'],
      tags: ['product'],
      metadata: { topic: 'product' },
      userIds: ['userId1', 'userId2'],
    });

    return community;
  }
  ```

  ```swift iOS theme={null}
  let options = AmityCommunityCreateOptions()
  options.setDisplayName("My Community")
  options.setCommunityDescription("Community description")
  options.setIsPublic(true)
  options.setCategoryIds(["categoryId"])
  options.setUserIds(["userId1", "userId2"])
  options.setPostSettings(.anyoneCanPost)
  options.setStorySettings(allowComment: true)
  options.setIsDiscoverable(true)
  options.setRequiresJoinApproval(false)
  options.setMetadata(["topic": "product"])

  let community = try await communityRepository.createCommunity(with: options)
  ```

  ```kotlin Android theme={null}
  fun createCommunity() {
      val metadata = JsonObject().apply {
          addProperty("topic", "product")
      }

      AmitySocialClient.newCommunityRepository()
          .createCommunity(
              displayName = "My Community",
              isDiscoverable = true,
              requiresJoinApproval = false
          )
          .description("Community description")
          .isPublic(true)
          .categoryIds(listOf("categoryId"))
          .userIds(listOf("userId1", "userId2"))
          .tags(listOf("product"))
          .metadata(metadata)
          .postSettings(AmityCommunityPostSettings.ANYONE_CAN_POST)
          .storySettings(AmityCommunityStorySettings(allowComment = true))
          .build()
          .create()
          .doOnSuccess { community: AmityCommunity ->
              // Community created.
          }
          .doOnError { error ->
              // Handle error.
          }
          .subscribe()
  }
  ```

  ```dart Flutter theme={null}
  void createCommunity() {
    AmitySocialClient.newCommunityRepository()
        .createCommunity('My Community')
        .description('Community description')
        .categoryIds(['categoryId'])
        .userIds(['userId1', 'userId2'])
        .tags(['product'])
        .isPublic(true)
        .metadata({'topic': 'product'})
        .postSetting(AmityCommunityPostSettings.ANYONE_CAN_POST)
        .storySettings(AmityCommunityStorySettings(allowComment: true))
        .create()
        .then((AmityCommunity community) {
          // Community created.
        })
        .onError((error, stackTrace) {
          // Handle error.
        });
  }
  ```
</CodeGroup>

<Note>
  Community tags are shown for TypeScript, Android, and Flutter. The current iOS create/update options do not expose a public community tag setter.
</Note>

## Best Practices

<Tip>
  Start with basic settings and allow community owners to customize moderation and features after creation to avoid overwhelming the initial creation flow.
</Tip>

### Creation Flow Guidelines

1. Show essential settings first, advanced options later.
2. Use sensible defaults to reduce decision fatigue.
3. Allow users to preview community settings before creation.
4. Guide new community creators through setup.

### Performance Optimization

1. Compress avatar images before upload.
2. Validate metadata structure client-side.
3. Handle creation asynchronously with loading states.
4. Provide clear error messages and retry options.

## Related Topics

<CardGroup cols={2}>
  <Card title="Update Community" href="./update-community" icon="pencil">
    Modify community settings and properties after creation
  </Card>

  <Card title="Community Categories" href="../organization/community-categories" icon="folder">
    Organize communities with category management
  </Card>

  <Card title="Community Membership" href="../organization/join-leave-community" icon="users">
    Handle membership and moderation after community creation
  </Card>

  <Card title="Community Discovery" href="../discovery/query-communities" icon="magnifying-glass">
    Make your created communities discoverable to users
  </Card>
</CardGroup>
