1.0.0 • Published 6 months ago

@artistify/artistify-sdk-express v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Artistify AI SDK Express Server

This Express server provides a RESTful API interface to the Artistify AI SDK, allowing you to easily integrate the Artistify AI platform into your applications.

Features

  • Authentication with Solana wallet-based credentials
  • Image generation API
  • Song generation API
  • User management
  • Agents listing
  • Analytics data
  • Webhook support for event notifications

Installation

  1. Clone this repository
  2. Install dependencies:
npm install
  1. Create a .env file in the root directory with the following variables:
PORT=3000
ARTISTIFY_API_URL=https://your-artistify-instance.com/api

Running the Server

Development mode

npm run dev

Production mode

npm start

API Endpoints

Authentication

  • GET /api/auth/message - Get a message to sign
  • POST /api/auth/authenticate - Authenticate with signed message
  • POST /api/auth/logout - Logout

Images

  • GET /api/images - List images
  • GET /api/images/:id - Get a specific image
  • GET /api/images/:id/status - Check image generation status
  • POST /api/images - Create a new image

Songs

  • GET /api/songs - List songs
  • GET /api/songs/:id - Get a specific song
  • GET /api/songs/:id/status - Check song generation status
  • POST /api/songs - Create a new song
  • POST /api/songs/generate - Generate a song directly

User

  • GET /api/user/info - Get current user information
  • GET /api/user/credits - Get user credits

Agents

  • GET /api/agents - List available agents
  • GET /api/agents/:id - Get a specific agent

Analytics

  • GET /api/analytics - Get analytics data

Webhooks

  • POST /api/webhooks/register - Register a webhook for notifications
  • POST /api/webhooks/callback - Webhook callback endpoint (for Artistify AI to send events)

Authentication

This server uses Solana wallet-based authentication. To authenticate:

  1. Call GET /api/auth/message to get a message string
  2. Sign the message with a Solana wallet
  3. Send the signed message, original message, and public key to POST /api/auth/authenticate
  4. The server will return a success response if authentication is successful

Webhooks

You can set up webhook listeners to be notified when specific events occur on the Artistify AI platform.

To register a webhook:

// Register a webhook for song and image completion events
const webhook = await fetch("/api/webhooks/register", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://your-server.com/webhook-endpoint",
    events: ["song.completed", "image.completed"],
  }),
});

The POST /api/webhooks/callback endpoint is used internally by the Artistify AI platform to deliver webhook events to this server.

License

MIT