
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@modyo/sdk
Advanced tools
JavaScript/TypeScript SDK for the Modyo headless Content Delivery API. Access your content stored in Modyo with ease in both browser and Node.js environments.
Built with TSUP for optimal performance and modern development experience.
npm install @modyo/sdk
import { Client } from '@modyo/sdk';
// Initialize the client
const client = new Client('https://your-account.modyo.cloud');
// Get a content type
const contentType = client.getContentType('blog', 'posts');
// Fetch all entries
const entries = await contentType.getEntries();
console.log(entries);
The main entry point for accessing Modyo content.
const client = new Client(accountURL, locale?)
Parameters:
accountURL (string): Your Modyo account URLlocale (string, optional): Default locale for all requestsgetContentType(spaceUID, typeUID, realm?, userToken?)Creates a ContentType instance for accessing specific content.
// Public content
const posts = client.getContentType('blog', 'posts');
// Private content (requires authentication)
const privatePosts = client.getContentType('blog', 'posts', 'my-realm', 'user-token');
getUserInfo()Gets current user information (requires authentication cookies).
const userInfo = await client.getUserInfo();
Handles content operations for a specific content type.
getEntries(filters?)Retrieves entries with optional filtering.
// Get all entries
const allEntries = await contentType.getEntries();
// Get filtered entries
const filter = contentType.Filter().Equals('meta.published', true);
const publishedEntries = await contentType.getEntries(filter);
getEntry(uuid)Gets a specific entry by UUID.
const entry = await contentType.getEntry('550e8400-e29b-41d4-a716-446655440000');
getEntryBySlug(slug)Gets a specific entry by slug.
const entry = await contentType.getEntryBySlug('my-blog-post');
getSchema()Retrieves the content type's JSON schema.
const schema = await contentType.getSchema();
getAttrs()Gets available attribute paths (requires schema to be loaded first).
await contentType.getSchema();
const attributes = contentType.getAttrs();
// Returns: ['meta.uuid', 'meta.name', 'fields.title', ...]
Filter()Creates a new filter instance for building queries.
const filter = contentType.Filter();
Build complex queries with a fluent API.
const filter = contentType.Filter()
.Equals('meta.name', 'My Post')
.LessThan('meta.created_at', '2024-01-01')
.GreaterThan('fields.views', 100)
.Before('meta.published_at', '2024-12-31')
.After('meta.updated_at', '2024-01-01');
const filter = contentType.Filter()
.In('meta.category', ['tech', 'design'])
.NotIn('meta.status', ['draft', 'archived'])
.Has('meta.tags', ['important', 'featured']);
const filter = contentType.Filter()
.Search('fields.content', 'modyo')
.SortBy('meta.created_at', 'desc')
.Pagination(2, 10)
.JSONPath('$..uuid');
const filter = contentType.Filter()
.Geohash('fields.location', 'dr5regw3p');
import { Client } from '@modyo/sdk';
const client = new Client('https://your-account.modyo.cloud');
const contentType = client.getContentType('blog', 'posts');
// Get all published posts
const publishedPosts = await contentType.getEntries(
contentType.Filter().Equals('meta.published', true)
);
// Complex filtering with multiple conditions
const complexFilter = contentType.Filter()
.In('meta.category', ['technology', 'design'])
.After('meta.published_at', '2024-01-01')
.Search('fields.title', 'modyo')
.SortBy('meta.created_at', 'desc')
.Pagination(1, 20);
const results = await contentType.getEntries(complexFilter);
// Accessing private content with authentication
const privateContent = client.getContentType(
'private-space',
'confidential-docs',
'internal-realm',
'your-user-token'
);
const privateEntries = await privateContent.getEntries();
// Client with default locale
const client = new Client('https://your-account.modyo.cloud', 'es');
// All requests will include locale=es parameter
const spanishPosts = await client
.getContentType('blog', 'posts')
.getEntries();
// Get content type structure
const schema = await contentType.getSchema();
console.log('Available fields:', schema.properties.fields);
// Get available attribute paths for filtering
const attributes = contentType.getAttrs();
console.log('Filterable attributes:', attributes);
// Paginated results
const page1 = await contentType.getEntries(
contentType.Filter().Pagination(1, 10)
);
const page2 = await contentType.getEntries(
contentType.Filter().Pagination(2, 10)
);
try {
const entries = await contentType.getEntries();
console.log('Success:', entries);
} catch (error) {
console.error('Failed to fetch entries:', error.message);
}
The SDK supports both public and private content:
No authentication required - just specify the space and content type.
Requires realm and user token authentication:
realm and userToken when creating the ContentTypeconst privateContent = client.getContentType(
'private-space',
'private-type',
'my-realm',
'user-access-token'
);
npm run build
Generates optimized bundles:
dist/index.js) - For Node.jsdist/index.mjs) - For modern bundlersdist/index.global.js) - For browser script tagsnpm test
npm run lint
npm start
Runs TSUP in watch mode with fast rebuilds.
See LICENSE file for details.
Report issues at: https://github.com/modyo/modyo-sdk/issues
For help with Modyo platform: https://support.modyo.com
FAQs
Javascript Modyo SDK to consume the API
We found that @modyo/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.