What is Hygraph FM and how does it relate to artist content modeling?
Hygraph FM is a music streaming platform example built using Hygraph, demonstrating how to create an artist content model that integrates external metadata from LastFM via a remote source. The tutorial guides users through building a modular, scalable content model for artists, including fields for artist name, slug, image, and promotional components. (Source)
How do I add a remote source like LastFM to my Hygraph project?
To add LastFM as a remote source, log into your Hygraph account, create a new project, and navigate to the Schema section. Select "Add" next to Remote Sources, enter the display name, prefix, description, type (REST), and base URL (https://ws.audioscrobbler.com/2.0/). Paste your custom type definitions (SDL) and click "Add" to connect LastFM. (Source)
What fields should be included in an artist content model for a music platform?
A robust artist content model should include fields for Artist Name (single line text), Slug (auto-generated from name), Artist Image (asset picker), LastFM Remote Source (REST field for metadata), and a Promotional Block (modular component for marketing and CTAs). (Source)
How do modular components enhance content modeling in Hygraph?
Modular components allow you to add reusable content blocks such as Buttons, Callouts, and CTAs to your models. This approach enables marketing and sales teams to test different messaging and scale content without developer intervention, improving flexibility and editor experience. (Source)
What is the process for creating artist content entries in Hygraph?
After building your artist model, navigate to the content section, click "Add entry," and fill out the form with artist details. You can use real artists (e.g., Radiohead, Wu-Tang Clan) to leverage LastFM metadata. Each entry can include custom images, promotional blocks, and external metadata. (Source)
How do I query artist content and metadata in the Hygraph API playground?
Use the API playground to test queries and mutations. For example, you can query artist content by ID and retrieve fields such as name, slug, image, callout, and LastFM metadata (bio, tags, similar artists). The playground supports autocomplete and preview features for efficient testing. (Source)
Why use a remote source for artist metadata instead of manual entry?
Using a remote source like LastFM automates the retrieval of up-to-date artist metadata (bio, stats, tags, similar artists), reducing manual data entry and ensuring consistency. It also enables dynamic content updates and richer user experiences. (Source)
How do I shape JSON data from LastFM to work with Hygraph's GraphQL API?
Convert the LastFM JSON response into GraphQL SDL (Schema Definition Language) using tools like JSON to GraphQL. Define custom types for fields such as bio, tags, stats, and similar artists, then paste these definitions into Hygraph's remote source configuration. (Source)
What are the benefits of using modular components for promotional content?
Modular components allow marketing and sales teams to easily add, test, and update promotional content (e.g., CTAs, banners) without developer support. This approach supports scalability, flexibility, and rapid iteration for business goals. (Source)
How do I validate URLs in modular components within Hygraph?
When creating a Button component, use the slug field for URLs and enable validation by selecting "Make a specific pattern" and choosing "URL" from the dropdown. This ensures only valid URLs are accepted for CTAs and links. (Source)
Can I localize content fields in Hygraph's modular components?
Yes, you can localize fields such as Heading and Body in the Call To Action component by enabling the "Localized" option. This supports multilingual content and global marketing campaigns. (Source)
What is the recommended approach for managing artist images in Hygraph?
While you can automate image retrieval from remote sources, it's often better to use the Asset Picker field for manual curation. This gives marketing and artist management teams control over branding and image selection. (Source)
How do I test API queries for artist metadata in Hygraph?
Use the API playground to preview queries for artist entries. For example, you can query for artist name, slug, image, callout, and LastFM metadata (bio, tags, similar artists) using the entry ID. (Source)
What are the next steps after building an artist content model in Hygraph?
After building the artist model and adding content, you can connect a frontend (e.g., Next.js 13) to your Hygraph FM project to present artist content dynamically. This enables rich, interactive user experiences. (Source)
How does collaborative content modeling benefit organizations using Hygraph?
Collaborative content modeling ensures input from stakeholders (marketing, product, sales) is incorporated, resulting in models that meet business needs, reduce bottlenecks, and empower teams to make content changes independently. (Source)
What are some example artists used in the Hygraph FM tutorial?
The tutorial uses artists such as Radiohead, Wu-Tang Clan, A Tribe Called Quest, and De La Soul to demonstrate content entry and metadata retrieval from LastFM. (Source)
How do I use the JSONVue extension for validating API responses?
Install the JSONVue extension in your browser (e.g., Chrome) to view and validate JSON responses from APIs like LastFM, making it easier to read and debug data for integration with Hygraph. (Source)
What is the role of the API ID and Slug in Hygraph models?
The API ID uniquely identifies fields in your model, while the Slug field generates URL-friendly identifiers based on the artist name, supporting SEO and content organization. (Source)
How do I ensure my custom type definitions are correctly added in Hygraph?
After pasting your SDL into the custom type definition field, check the summary bar against your original file to confirm all types are included. This helps avoid errors and ensures proper API integration. (Source)
What is the significance of the 'Promotional Block' field in the artist model?
The Promotional Block field allows you to add multiple modular components (Button, CTA, Callout) to an artist entry, supporting dynamic marketing and engagement strategies. (Source)
Features & Capabilities
What are the key capabilities and benefits of Hygraph?
Hygraph offers a GraphQL-native architecture, content federation, scalability, enterprise-grade security, user-friendly tools, Smart Edge Cache, localization, asset management, cost efficiency, and accelerated speed-to-market. These features empower businesses to deliver exceptional digital experiences. (Source)
Does Hygraph support integration with external APIs and remote sources?
Yes, Hygraph supports integration with external APIs and remote sources, including REST and GraphQL endpoints. You can connect platforms like LastFM, Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, and more. (Source)
What types of APIs does Hygraph provide?
Hygraph provides multiple APIs: Content API (read/write), High Performance Content API (low latency, high throughput), MCP Server API (AI assistant integration), Asset Upload API, and Management API. (Source)
How does Hygraph ensure high performance for content delivery?
Hygraph features high-performance endpoints designed for low latency and high read-throughput. The platform actively measures GraphQL API performance and provides optimization best practices. (Source)
What technical documentation is available for Hygraph users?
Hygraph offers extensive documentation covering API reference, schema components, references, webhooks, AI integrations, and more. Access all resources at Hygraph Documentation.
What integrations are available in the Hygraph Marketplace?
The Hygraph Marketplace offers pre-built apps for headless commerce, PIMs, DAMs, and more. Explore available integrations at Hygraph Marketplace.
Can developers build custom integrations with Hygraph?
Yes, developers can build custom functionalities using the Hygraph SDK or connect external APIs via REST and GraphQL, enabling tailored solutions for unique business needs. (Source)
How does Hygraph support localization and asset management?
Hygraph provides advanced localization features and asset management capabilities, making it ideal for global teams managing multilingual content and digital assets. (Source)
What feedback have customers given about Hygraph's ease of use?
Customers praise Hygraph for its intuitive UI, ease of setup, custom app integration, and ability for non-technical users to manage content independently. Real-time changes and reduced developer bottlenecks are frequently highlighted. (Source)
Pricing & Plans
What pricing plans does Hygraph offer?
Hygraph offers three main plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different limits and features tailored to individual, small business, and enterprise needs. (Source)
What features are included in the Hobby plan?
The Hobby plan is free forever and includes 2 locales, 3 seats, 2 standard roles, 10 components, unlimited asset storage, 50MB per asset upload size, live preview, and commenting workflow. (Source)
What does the Growth plan cost and what does it include?
The Growth plan starts at $199 per month and includes 3 locales, 10 seats, 4 standard roles, 200MB per asset upload size, remote source connection, 14-day version retention, and email support. (Source)
What is included in the Enterprise plan?
The Enterprise plan offers custom limits on users, roles, entries, locales, API calls, components, remote sources, version retention (1 year), scheduled publishing, dedicated infrastructure, global CDN, security controls, SSO, multitenancy, backup recovery, custom workflows, dedicated support, and custom SLAs. (Source)
Security & Compliance
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 compliant (since August 3, 2022), ISO 27001 certified, and GDPR compliant. These certifications ensure robust security and data protection for users. (Source)
How does Hygraph protect user data?
Hygraph encrypts data at rest and in transit, provides granular permissions, audit logs, SSO integrations, regular backups, and options for dedicated hosting in multiple regions. (Source)
What is Hygraph's process for reporting security incidents?
Hygraph provides a customer reporting process for security, confidentiality, integrity, and availability failures, incidents, concerns, and complaints. (Source)
Use Cases & Customer Success
Who can benefit from using Hygraph?
Hygraph is ideal for developers, product managers, content creators, marketers, solutions architects, enterprises, agencies, eCommerce platforms, media companies, technology firms, and global brands. (Source)
What industries are represented in Hygraph's case studies?
Can you share specific customer success stories using Hygraph?
Yes. Samsung built a scalable API-first application, Dr. Oetker enhanced digital experience, Komax achieved 3x faster time to market, AutoWeb increased monetization by 20%, BioCentury accelerated publishing, Voi scaled multilingual content, HolidayCheck reduced bottlenecks, and Lindex Group accelerated global delivery. (Source)
What business impact can customers expect from using Hygraph?
Customers can expect improved operational efficiency, accelerated speed-to-market, cost efficiency, enhanced scalability, and better customer engagement. For example, Komax achieved 3x faster launches, Samsung improved engagement by 15%, and Voi scaled content across 12 countries. (Source)
How long does it take to implement Hygraph?
Implementation time varies by project. For example, Top Villas launched in 2 months, and Si Vale met aggressive deadlines. Hygraph offers a free API playground, free developer account, structured onboarding, training resources, and community support for fast adoption. (Source)
What pain points does Hygraph solve for customers?
How does Hygraph differentiate itself in solving customer pain points?
Hygraph stands out with its GraphQL-native architecture, content federation, user-friendly interface, cost efficiency, robust APIs, Smart Edge Cache, and advanced localization. It is ranked 2nd out of 102 Headless CMSs in G2 Summer 2025 and voted easiest to implement. (Source)
Who are some of Hygraph's notable customers?
Notable customers include Samsung, Dr. Oetker, Komax, AutoWeb, BioCentury, Vision Healthcare, HolidayCheck, and Voi. (Source)
We will build an artist content model for the music streaming platform Hygraph FM, add the LastFM Rest API as a remote source to retrieve metadata, and create a modular component to structure our artist content.
Written by Lo
on Jun 14, 2023
We all have our preferred music streaming platform that provides the soundtrack to our day. No matter the platform you choose, they all have content for each artist such as a photo, bio, and suggestions for similar artists.
Let’s learn how to build an artist content model using the LastFM Rest API as a remote source to retrieve metadata and a modular component to structure our artist content.
Using modular components and remote sources, we can create dynamic and engaging artist content that's easy to maintain and update. With Hygraph's content federation features, we can pull in data from LastFM and add it to our content model in a way that makes sense and considers the overall content workflow of our business.
Because we are logged into our account, the contact email will be pre-filled. Next, we will add an application name, feel free to choose any name you want and click to Submit the form. Once the form is submitted, you will get an API Key and Secret, save this information as we will use it to connect LastFM to Hygraph later on.
For now, let’s test our API to make sure that we are able to successfully retrieve artist data.
Getting a JSON response from LastFM REST API
The LastFM API documentation gives us the Root URL and methods available to make a request. The root or base URL is https://ws.audioscrobbler.com/2.0/ (Keep the base URL close by, we will need it later!) and we will use the artist.getinfo method to retrieve artist metadata in JSON format. If we build out our request URL, we get something like:https://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=ADD_ARTIST_NAME&api_key=YOUR_API_KEY&format=json.
Replace ADD_ARTIST_NAME with an artist and YOUR_API_KEY with the API key you generated earlier.
Example URL: https://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=prince&api_key=a1ddbd6d333dcc1af79a5123674adb0c&format=json
For example, if we search for the artist, Prince, with a valid API key in our web browser, we should get all information available about Prince.
Pro Tip
Install a JSON validator extension for your web browser. This tutorial uses Google Chrome as a browser and the JSONVue extension. With our extension installed, we get lovely JSON that is organized and easier to read.
Back to our regularly scheduled programming…
Great work—We have a working API Key and are able to retrieve artist data in JSON format! From our JSON response, we are able to get a bio, stats, tags, and similar artists for Prince. Our next step is to get this data into the right shape to work with Hygraph’s GraphQL API.
Shaping LastFM JSON to work as a native GraphQL API SDL
A Schema Definition Language or SDL is a way to define the shape of data that can be queried in a GraphQL API. It describes the schema or types of data available, their relationships, and how the data can be queried. We need to tell Hygraph the shape of the data to expect and make available. To do that, we'll create custom types using an SDL to define the schema that will be available to us via the Hygraph API. To jumpstart the process, we can use a JSON to GraphQL tool that will take our LastFM JSON response and generate GraphQL type definitions for us.
# SDL for LastFM REST API
typeLink{
text:String
rel:String
href:String
}
typeLinks{
link:Link
}
typeBio{
published:String
summary:String
content:String
links:Links
}
typeTag{
name:String
url:String
}
typeTags{
tag:[Tag]
}
typeImage{
size:String
}
typeSimilar{
artist:[Artist]
}
typeStats{
listeners:String
playcount:String
}
typeArtist{
name:String
mbid:String
url:String
streamable:String
ontour:String
bio:Bio
tags:Tags
similar:Similar
stats:Stats
image:[Image]
}
typeAutogeneratedMainType{
artist:Artist
}
Using the SDL generator should output the custom type definitions above. Copy and paste your SDL into a code editor or IDE of your choice and let’s make a few small changes to these types. Sometimes when connecting to older REST APIs where naming conventions are not as strict, you can get special characters in type names. In the case of the Image type from LastFM, there is a #text value that is used for the URLs for images. This cannot be queried using GraphQL because #text will be stripped out as a comment. Remove text: String from Type Image. Last, instead of using AutogeneratedMainType we will use ArtistMeta as our Main Type name.
We have our SDL, now it's time to connect LastFM to Hygraph as a remote source. Login to Hygraph or create an account if you do not already have one. Once you are logged in, scroll down to “Add a new project”. We have the option to create a blank project or to use a starter template. For this project, we will start with a blank project, so click on the “Add project” square to get started.
Add HygraphFM or a name of your choice as the “Project name” and select the “Region” from the dropdown menu that is geographically close to you to host your content. Once complete, click the Add Project button and Hygraph will create a blank project for you.
When Hygraph finishes the setup process, we are taken to our project dashboard. On the left sidebar menu, select “Schema”, then click “Add” next to Remote Sources.
Display Name: LastFM API
Prefix: LastFmApi
Description: LastFM Rest API for artist metadata
Type: REST
Base URL: https://ws.audioscrobbler.com/2.0/
When you choose a remote source Type, new fields for the Base URL and Custom type definitions are revealed. Add the base URL from LastFM that we saved earlier.
Adding our Custom Type Definitions
Next, copy and paste the custom type definitions from our SDL into the Custom Type definition field. The top bar of the field conveniently gives us a summary of the types we pasted in.
Pro Tip
When working with a large number of type definitions, it is helpful to check this summary against our original SDL file to make sure we got all of our definitions.
Click the “Add” button at the top right corner and Hygraph will add LastFM as a remote source to our project. Now that we have connected LastFM as a remote source to our project, we can start building our artist content model and a modular component to create a structure for artist content.
Instead of thinking about a specific presentation such as an app or website, it is important to think about your organization and business goals as a whole when building a content model.
A content model is a definition of your data stored in Hygraph, but never forget that it also represents the process your editors will use to create and enter content. Think of a content model as a way to provide universal clarity on a process, task, or data point for the entire business while also ensuring you get the right data types in the API. In our case, we want to create a profile that provides information and statistics for every artist on our music platform. However, what other business needs should be included in this model? Getting input from stakeholders such as content creators, marketers, designers, product managers or account executives from the start of the build process ensures that you are developing a tool that works for everyone. When we as developers work collaboratively to create content models, it decreases the time we spend putting out fires, frees up our capacity and creativity to develop new tools and features, and empowers our organization to make content changes as needed.
After talking with marketing, product, and sales we learn that we need to incorporate content sections for marketing campaigns, a banner that promotes new album releases, and a CTA to invite friends (aka new users) to the platform. With this new information in mind, we are now ready to build the artist content model in Hygraph. From the “Schema” menu item in our Hygraph project, select “Add” from the Models section.
From here, we give our model a Display name, Artist, and the API ID and Plural API ID autocomplete for us, and click the “Add Model” button. Once setup is finished, the Artist model will display and we get a list of fields that we can use to populate our model.
Single line text: Title field
The first field we need is a string field for the Artist Name, so we will use the Single line text field. For API ID, let’s use artist and check “Use as title field” option.
Slug field
Next, we will add a slug field to our artist model and we want it to generate the slug from our title in the options. In the Slug template field, add {artist} . This lets Hygraph know which field to use to generate our slug.
Asset: Image field
To go along with the data we are pulling in from LastFM, we want to include an image of the artist. Add the Asset Picker field and name it, Artist Image.
You may be wondering why we’re not pulling in images directly from our remote source. It can be really difficult to know when to automate or have manual control over fields, so it is important that we develop cross-functionally to understand the full context and purpose for content. In this case, our marketing team and artist management want the ability to curate images for artists. Sometimes, it makes more sense for your overall business goals or brands to have more control vs the ability to automate everything.
Rest: LastFM remote source field
Earlier, we connected LastFM as a remote source. Now we can add a Rest field to our artist model. Scroll down to the list of field types, and select “REST” and we will give this field a name, Hygraph's LastFM Remote Source Field and the API ID will auto-populate to hygraphLastFmRemoteSourceField.
Next, we choose LastFM API or the name you chose in the “Remote source” dropdown menu and GET for our “Method” and ArtistMeta for our “Return type”. This lets Hygraph know that we want to retrieve or GET information from our LastFM and we have selected the ArtistMeta type because we want to be able to access all the metadata that is available for every artist. Last, we need to append the rest of the request URL to the path. Starting with the method, copy the example URL we made earlier that contains your API key into the “Path” field. Your field should contain: ?method=artist.getinfo&artist={{doc.artist}}&api_key=a1ddbd6d333dcc1af79a5123674adb0c&format=json. Adding artist={{doc.artist}} instead of using Prince as the artist search parameter tells Hygraph that we want to make a request based on the Artist Name used in the title field of a content document.
We now have an artist model that contains title, slug, image, and LastFM remote source field. While our artist model looks great, we need to incorporate the content that marketing and sales requested.
#Creating a modular component for the artist model
The marketing and sales teams have asked for an invite your friends/new users call to action and promotional space content sections within the artist model. The best way to do this is by creating components that we will be able to add to our model as a collection of components using the modular component field. We need to create Button, Call to Action or CTA, and Callout components to help our organization accomplish its business goals. Using components vs hardcoding promotional spaces allows marketing and sales to test various types of language without needing the development team to make changes. Also, modular components help us scale our model and code, giving us the ability to add additional components later when inevitable feature requests come in and put them into a system the content editors will already know and use.
Button
From the schema menu add a new component called Button and add a string field called Text and a slug field called URL. In the "Validations" tab of the slug field, check "Make a specific pattern" and choose URL from the dropdown menu.
Callout
Next, add a new component, Callout, with these fields:
Field
Name
Options
String
Title
Title
Basic
Button
Select Button component
Call to Action (CTA)
Last, add a new component, Call To Action with these fields:
Field
Name
Options
String
Heading
Localized
Rich text
Body
Localized
Asset
Image
Default
Basic
Button
Select Button component
The "Basic" component field type does not allow multiple component instances and we only want one button for each Callout or Call to Action. Thinking about the overall content strategy and model allows us to make field type choices that are helpful to editors. So, our finished component will contain a Heading, Body, Image, and a single Button.
Our components are all done, now let's add them to the model as a modular component. Return to your artist model, and select the “Modular” field.
Give your collection of components a name, let’s use Promotional Block , select “Allow multiple values” from the “Field Options”, and choose the components we created, Button, CTA, and Callout from the dropdown menu.
Our artist model is now complete with Artist Name, Slug, Image, Hygraph’s LastFM Remote Source, and Promotional Block fields and we are ready to enter content!
Create Artist Content
It’s time to add content, navigate back to the main menu on the left side of your project. Select “content” and click on the button, “Add entry”, located on the top right.
A document entry form will appear. All the fields that we added to our Artist model are located on the form and are ready for content. Take some time to make 4 or more content entries of music artists. (Note: Choose music artists that actually exist, so we can use LastFM to get metadata). The artist used in this tutorial are:
Radiohead
Wu-Tang Clan
A Tribe Called Quest
De La Soul
Feel free to play around and add your own or use the artists above.
The API playground built into your Hygraph project is a great place to test queries, mutations, and API calls. Before we wrap things up, let’s experiment in the playground to see the information we get from LastFM API calls based on the content we added.
As a quick overview of the content, we have the artist Wu-Tang Clan with a name, slug, an image of the group, and a Callout that prompts our users to invite friends to Hygraph FM. With this in mind, let’s head over to the playground and test a query. From the entry form, click on “Preview in Playground” in the Hygraph LastFM Remote Source Field. This will take us directly to the API playground and autocomplete our query variable id with the entry form ID of the Wu-Tang Clan content. Example: {"id":"cli23id9o08rq0blh643i40v7"} . Now let’s test a query to get metadata along with the content we entered manually. Enter the following query:
# Test query in Hygraph API playground
queryWuContent($id:ID!){
values:artist(where:{id:$id},stage:PUBLISHED){
hygraphLastFmRemoteSourceField{
__typename
}
artist
artistImage{
artistImageArtist{
slug
id
promotionalBlock{
...onCallout{
id
title
button{
text
url
id
}
}
}
hygraphLastFmRemoteSourceField{
artist{
bio{
summary
}
tags{
tag{
name
}
}
similar{
artist{
name
}
}
}
}
}
}
}
}
In the above query, we are asking Hygraph to give us the artist name, slug, id, callout title with the button, and from LastFM, we want the bio summary, tags, and similar artist names.
All went well and our WuContent query returned data from LastFM! We now have a short bio, genre tags, and similar artists that we can use along with our own content to populate a front end of our choice.
To recap, we built a content model for artists on our music platform with a modular component and added Last FM as a remote source to retrieve metadata. In part two of the series, we will connect a frontend to our Hygraph FM project using Next.js 13 to present our artist content.
Blog Author
Lo Etheridge
Senior Developer Relations
Lo is Hygraph's Senior Developer Relations Specialist. They focus on developer education around Headless CMS, JS-based frontends, and API technologies as well as the dynamic cross-functional relationship between developers and content professionals.
Share with others
Sign up for our newsletter!
Be the first to know about releases and industry news and insights.