.. and press ENTER to ask a question on web5, how to write code and more.

Skip to main content

Credential Issuance Server Setup

Install Express

This example demonstrates how to use Express to set up the VC issuance service. Follow these instructions to install Express.

Install Credentials Package​

You'll also need to install @web5/credentials to create and issue credentials:

JavaScript
Kotlin
Swift
npm install @web5/credentials@1.0.1

Create a DID​

Additionally, to issue credentials, you need a Decentralized Identifier (DID) which will serve as your Issuer's identity.

If you don't already have one, you'll need to create a DID with an IDV (Identity Verification) service endpoint:

JavaScript
Kotlin
Swift

If you have an existing DID you'll need to update that DID Document with an IDV service endpoint:

JavaScript
Kotlin
Swift

Create API Service​

  1. Ensure you have a file, such as main.js, to act as your API's entry point, which was created during the Express setup.

  2. Within the file, import the following:

import { api } from './api.js';
  1. To start your Express API service, add the following:
const config = {
port: 3000, // this can be any port you want to listen on
};

const server = api.listen(config.port, () => {
log.info(`Server listening on port ${config.port}`);
});
  1. Next, create an api.js file. This file will define the core API routes and logic for issuing credentials:
import express from 'express';
import { VerifiableCredential, Jwt } from '@web5/credentials';

const app = express();
app.use(express.json());

app.get('/example-route', async (req, res) => {
// implement the API route here
});

// Export the app so it can be imported in your <code>main.js</code> file
export { app as api };

Next Steps​

Now that you have your server environment set up, depending on your use case, you can proceed with one of the following guides:

Connect with us on Discord

Submit feedback: Open a GitHub issue

Edit this page: GitHub Repo

Contribute: Contributing Guide