A visual, interactive tool for building Verifiable Credential (VC) schemas in both JSON Schema and JSON-LD formats. This Next.js application provides an intuitive interface to define credential schemas with nested attributes, preview the output in real-time, and save them to a MongoDB database.
- Visual Schema Builder: Create credential schemas through an intuitive two-step wizard interface
- Tree-Based Attribute Editor: Define nested attributes with a hierarchical tree structure
- Dual Format Support: Generate schemas in both JSON Schema and JSON-LD formats
- Real-Time Preview: See your schema output as you build it
- Database Integration: Save and retrieve schemas from MongoDB
- Export Options: Copy to clipboard or download schemas as JSON files
- Type Support: Define attributes with types: string, number, boolean, object, and integer
- Required Field Management: Mark attributes as required or optional
- Credential Type Selection: Choose between Merklized and Non-merklized credential types
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components:
- Radix UI (Accordion, Checkbox, Label, Radio Group, Select)
- Ant Design (Tree component)
- Custom shadcn/ui components
- Form Management: React Hook Form with Zod validation
- Database: MongoDB
- Icons: Lucide React, Ant Design Icons
- Notifications: React Hot Toast
- Node.js 18+ and npm/yarn/pnpm
- MongoDB database (local or cloud instance)
- Environment variables configured (see Environment Variables)
- Clone the repository:
git clone https://github.com/impactility/schema-builder
cd schema-builder- Install dependencies:
npm install
# or
yarn install
# or
pnpm install- Set up environment variables:
Create a
.env.localfile in the root directory:
MONGODB_URI=your_mongodb_connection_string
HOST_URL=http://localhost:5006- Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev- Open http://localhost:5006 in your browser.
schema-builder/
├── app/
│ ├── (builder)/
│ │ ├── components/
│ │ │ ├── helper.ts # JSON/JSON-LD conversion logic
│ │ │ ├── preview.tsx # Schema preview component
│ │ │ ├── renderer.tsx # Main renderer with step management
│ │ │ ├── step1.tsx # Step 1: Schema metadata form
│ │ │ └── step2.tsx # Step 2: Attribute tree editor
│ │ └── page.tsx # Main builder page
│ ├── api/
│ │ └── schemas/
│ │ ├── route.ts # GET/POST all schemas
│ │ ├── json/[id]/
│ │ │ └── route.ts # GET JSON schema by ID
│ │ └── jsonLd/[id]/
│ │ └── route.ts # GET JSON-LD schema by ID
│ ├── layout.tsx # Root layout
│ └── globals.css # Global styles
├── components/
│ └── ui/ # Reusable UI components
├── lib/
│ ├── mongodb.ts # MongoDB connection utility
│ └── utils.ts # Utility functions
├── assets/
│ └── Energy ID.png # Logo
└── public/ # Static assets
- Enter the Title of your schema
- Specify the Schema Type (no spaces allowed)
- Set the Version number
- Provide a Description
- (Optional) Expand "Advanced options" to select Credential Type:
- Merklized
- Non-merklized
- Click "Define attributes" to proceed
- Use the tree view to navigate and select attributes
- Click on an attribute to edit its properties:
- Name: Attribute identifier (used in the schema)
- Title: Human-readable title
- Data Type: string, number, boolean, object, or integer
- Description: Attribute description
- Required: Toggle to mark as required
- Click "Add" to add a child attribute (only for object types)
- Click "Remove" to delete an attribute (cannot remove "id" or "credentialSubject")
- Click "Save" to update the attribute
- Use "Back" to return to Step 1
- Format Toggle: Switch between JSON and JSON-LD preview
- Copy: Copy the schema to clipboard
- Download: Download the schema as a JSON file
- Save: Save the schema to MongoDB
Retrieve all saved schemas.
Response:
{
"message": "Data fetched successfully",
"data": [...]
}Create a new schema.
Request Body:
{
"name": "Schema Name",
"schemaId": "unique-schema-id",
"json": {...},
"jsonLd": {...},
"orgId": "organization-id"
}Response:
{
"message": "Schema created successfully",
"result": {...}
}Retrieve a JSON schema by ID.
Response:
{
// JSON schema object
}Retrieve a JSON-LD schema by ID.
Response:
{
// JSON-LD schema object
}| Variable | Description | Required |
|---|---|---|
MONGODB_URI |
MongoDB connection string | Yes |
HOST_URL |
Base URL for the application (used in JSON-LD context URLs) | Yes |
Schemas are stored in MongoDB in the requests database, vc-schemas collection with the following structure:
{
name: string;
schemaId: string;
json: object; // JSON Schema format
jsonLd: object; // JSON-LD format
orgId: string;
title?: string;
schemaType?: string;
version?: string;
description?: string;
credentialType?: "Merklized" | "Non-merklized";
}npm run build
npm startThe production server will run on port 5006.
The development server runs on port 5006 by default. You can modify this in package.json:
{
"scripts": {
"dev": "next dev -p 5006",
"start": "next start -p 5006"
}
}This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025 Impactility
