# Introducing B3Forge - Candid UI: Seamlessly Integrate and Customize Your dApp Interfaces

**URL:** <https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821>\
**Category:** Showcase\
**Tags:** candid, Discussing, Frontend\
**Created:** [May 15, 2024, 5:53pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821 "2024-05-15T17:53:34Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![Gekctek](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gekctek/32/6863_2.png) [@Gekctek](https://forum.dfinity.org/u/Gekctek)\
**Post date:** [June 25, 2024, 8:00pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/21 "2024-06-25T20:00:25Z")

</div>

Im not sure if I understand, dont you just put in the canister id and it fetches the candid?

Here is a gif of my experience  
 ![Error](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/f/d/fd1ae0b2786fd9ea509bf77bcd4930c85fb03fbf.gif)

---

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [June 25, 2024, 8:06pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/22 "2024-06-25T20:06:24Z")

</div>

Yeah, you should enter the candid code manually for now, but good point it should fetch the candid code automatically.  
I’ll add it later, thanks for that.

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [June 25, 2024, 9:17pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/23 "2024-06-25T21:17:22Z")

</div>

Great! Updated the Candid README page 🙂

For the type selector feature in Candid UI, I don’t have a concrete design yet. A first step can be to brainstorm the properties we need to specify.

---

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [June 26, 2024, 10:42am UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/24 "2024-06-26T10:42:54Z")

</div>

Thanks to @Gekctek, for pointing that out. Entering the canister ID should fetch the Candid code automatically and place it into the form. This small update should make it even easier to use.

![new-playground-update](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/c/b/cb2a59353cd97d73fb9a3b5d8b0a8b36f9e7bd4c.gif)

Additionally, I have fixed a route problem that was showing a “Body does not pass verification” error on some routes, Thank you, @peterparker, for bringing this to my attention.

I appreciate your feedback and the opportunity to improve B3Forge. Please give it a try and let me know if it works for you now.

---

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [June 26, 2024, 11:03am UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/25 "2024-06-26T11:03:27Z")

</div>

Great! Thank you for updating the Candid README page. I’m excited for more developers to discover and use B3Forge!

Regarding the type selector feature in Candid UI, I have a few suggestions for properties that could be useful. I’ve also implemented a similar approach in B3Forge, where the input type is guessed based on the name. Here are some ideas to enhance this feature:

1. **blob.type** :

2. **number.format** :

3. **date.format** :

4. **string.format** :

5. **array.layout** :

6. **auto-detection based on keywords** :

This approach can help developers customize the UI more effectively and provide a better user experience. I’m happy to brainstorm more ideas or provide further assistance as needed.

If there’s anything I can do to help make this happen or any contributions needed, I’m ready to assist in any way possible.

Thank you for considering my suggestions!

---

<div class="post-metadata">

**Author:** ![evieharpr](https://avatars.discourse-cdn.com/v4/letter/e/13edae/32.png) [@evieharpr](https://forum.dfinity.org/u/evieharpr)\
**Post date:** [June 26, 2024, 11:37am UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/26 "2024-06-26T11:37:36Z")

</div>

It’s great! we are looking upon the feedback while having the high hopes about project’s success.

---

<div class="post-metadata">

**Author:** ![sea-snake](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/sea-snake/32/7243_2.png) [@sea-snake](https://forum.dfinity.org/u/sea-snake)\
**Post date:** [June 26, 2024, 12:04pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/27 "2024-06-26T12:04:58Z")

</div>

> **blob.type**

I would suggest to use MIME types here.

---

<div class="post-metadata">

**Author:** ![reccasolan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/reccasolan/32/19642_2.png) [@reccasolan](https://forum.dfinity.org/u/reccasolan)\
**Post date:** [June 26, 2024, 12:38pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/28 "2024-06-26T12:38:07Z")

</div>

This looks really great! 😊 A good idea

---

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [June 26, 2024, 2:33pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/29 "2024-06-26T14:33:03Z")

</div>

Thank you for the suggestion! Using MIME types for `blob.type` is a great idea. Here’s an example of how this could be implemented:

1. **blob.type** :
  - `"application/pdf"`: Allows users to upload PDF files.
  - `"image/png"`: Displays a PNG image from a blob value.
  - `"text/plain"`: Displays plain text from a blob value.
  - `"video/mp4"`: Displays an MP4 video from a blob value.

By using MIME types, we can provide a more standardized and flexible way to handle various data types. This approach would enhance the customization options for developers and ensure better compatibility.

Thanks again for the valuable input!

---

<div class="post-metadata">

**Author:** ![sea-snake](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/sea-snake/32/7243_2.png) [@sea-snake](https://forum.dfinity.org/u/sea-snake)\
**Post date:** [June 26, 2024, 2:38pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/30 "2024-06-26T14:38:02Z")

</div>

Similarly metadata regarding strings/numbers could follow HTML text input type standards for example.

Overall I would split the candid metadata into various (ICRC?) standards for different purposes, some might be data related (e.g. MIME), some UI related (e.g. input), some might be used for other purposes.

Overall having standardized metadata around candid at some point seems like a very cool concept.

---

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [June 26, 2024, 2:45pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/31 "2024-06-26T14:45:40Z")

</div>

I agree that following HTML text input type standards for strings and numbers would be beneficial. Splitting the Candid metadata into various standards for different purposes makes a lot of sense. For example:

1. **Data Related (e.g., MIME Types)**:

2. **UI Related (e.g., HTML Input Types)**:

3. **Other Purposes (Potential Standards)**:

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [June 26, 2024, 2:47pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/32 "2024-06-26T14:47:02Z")

</div>

One issue is how to handle chunked files. Not sure if we can standardize that some how or not.

Maybe type a tulple? (blob,?nat) : chunksfile(mimetype )

---

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [June 26, 2024, 3:55pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/33 "2024-06-26T15:55:08Z")

</div>

To handle chunked files, we can use a standardized approach with specific functions for uploading and verifying files. Here’s an example:

```candid
type ICRC1000 = record {
  load_chunk: func (blob) -> ();
  size: func () -> (nat);
  hash: func () -> (text);
}

service: {
  upload_profile_pic : () -> (ICRC1000);
}

```

- **`load_chunk(blob)`**: Loads a chunk of the file.
- **`size()`**: Returns the total size of the file after all chunks have been uploaded.
- **`hash()`**: Verifies the file’s integrity by returning the hash of the uploaded file.

### Example Usage in JavaScript

Here’s how you can use these functions in JavaScript to manage chunked file uploads:

```javascript
async function uploadFile(canister, file) {
  const chunkSize = 1024 * 1024; // 1MB chunks
  const totalChunks = Math.ceil(file.size / chunkSize);
  const uploadProfilePic = await canister.upload_profile_pic();

  for (let i = 0; i < totalChunks; i++) {
    const chunk = file.slice(i * chunkSize, (i + 1) * chunkSize);
    await uploadProfilePic.load_chunk(chunk);
  }

  const fileSize = await uploadProfilePic.size();
  if (fileSize === file.size) {
    const fileHash = await uploadProfilePic.hash();
    console.log('File uploaded successfully with hash:', fileHash);
  } else {
    console.error('Failed to upload all chunks.');
  }
}

```

In this approach, the main function (`upload_profile_pic`) returns the functions needed (`load_chunk`, `size`, and `hash`) to upload and verify the file. This allows the frontend to manage chunked file uploads effectively by calling these standardized functions.

---

<div class="post-metadata">

**Author:** ![CryptoDexia](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/cryptodexia/32/18593_2.png) [@CryptoDexia](https://forum.dfinity.org/u/CryptoDexia)\
**Post date:** [June 26, 2024, 4:56pm UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/34 "2024-06-26T16:56:18Z")

</div>

Hey, that B3Forge seems super practical! The customizable interfaces and smooth integration are definitely going to help us a lot. I appreciate the focus on security and managing user identities too. Looking forward to seeing more features being added 👏 Great work!

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [June 27, 2024, 12:18am UTC](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821/35 "2024-06-27T00:18:00Z")

</div>

Thank you all! These are all useful suggestions!

Given a type, there are two dimensions to consider: input/output, textual/UI. UI input corresponds to Candid UI input; Textual input corresponds to the Candid assist feature; UI output corresponds to Candid UI rendering; textual output corresponds to dfx pretty printer. Some of the properties make sense for all these dimensions, while some only make sense for a particular dimension. So we need a bit more design here.

> [@sea-snake](#):
>
> Overall I would split the candid metadata into various (ICRC?) standards for different purposes, some might be data related (e.g. MIME), some UI related (e.g. input), some might be used for other purposes.

Yep, we are doing this already. See the last section of this PR: [spec: candid type selector by chenyan-dfinity · Pull Request #555 · dfinity/candid · GitHub](https://github.com/dfinity/candid/pull/555)

[Previous page](https://forum.dfinity.org/t/introducing-b3forge-candid-ui-seamlessly-integrate-and-customize-your-dapp-interfaces/30821.md?page=1)
