How do I use Hygraph to build a stock market website?
To build a stock market website with Hygraph, you can integrate a finance API (such as Alpha Vantage) as a Remote Source, generate a GraphQL SDL from the API's JSON response, set up a Hygraph project, and create custom models and fields to fetch and display financial data. The tutorial on Hygraph's blog provides step-by-step instructions, including code samples and UI setup using Remix, Tremor, and Tailwind CSS.
What steps are involved in setting up Hygraph for a finance API integration?
The steps include registering for an API key (e.g., Alpha Vantage), generating a GraphQL SDL from the API's JSON response, creating a new Hygraph project, adding the Remote Source, defining custom type definitions, creating a custom model, adding content entries, and setting up API access tokens for secure requests. Detailed instructions are available in the tutorial.
How do I create a custom model in Hygraph for financial data?
After adding a Remote Source, you can create a custom model (e.g., "Earning") in Hygraph, add fields such as a REST field for the API data and a text field for the company symbol, and configure the model to fetch and display financial data. The process is illustrated in the tutorial with screenshots and code samples.
What is required to authenticate API requests in Hygraph?
Hygraph requires a permanent API token for authenticated requests. You can create this token in the Project settings under API Access, assign read permissions, and use it in your web app to securely query your models. The tutorial provides step-by-step guidance on generating and using the token.
How long does it take to implement Hygraph for a new project?
Implementation time varies by project complexity. For example, Top Villas launched a new project in just 2 months using Hygraph. The platform offers a streamlined onboarding process, free API playground, and extensive documentation to accelerate setup. Source
Is Hygraph easy for non-technical users to set up and use?
Yes, Hygraph is frequently described as intuitive and easy to set up, even for non-technical users. Its editor UI and custom app integration allow independent content management and real-time changes, reducing reliance on developers. Source
What training and support resources are available for Hygraph?
Hygraph offers webinars, live streams, how-to videos, extensive documentation, and a community Slack channel for support and onboarding. These resources help users quickly adopt and maximize the platform's value. Documentation
Features & Capabilities
What is a Remote Source in Hygraph?
A Remote Source in Hygraph allows you to connect external APIs (such as finance APIs) and treat their data as native GraphQL endpoints. This enables seamless integration and querying of third-party data within your Hygraph project. Documentation
Does Hygraph support GraphQL APIs?
Yes, Hygraph is a GraphQL-native Headless CMS and provides multiple GraphQL APIs, including Content API, High Performance Content API, MCP Server API, Asset Upload API, and Management API. API Reference
What integrations does Hygraph offer?
Hygraph offers integrations with Digital Asset Management systems (Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), Adminix, Plasmic, and supports custom integrations via SDK and external APIs. Marketplace apps are also available for headless commerce and PIMs. Integrations Documentation
What technical documentation is available for Hygraph?
Hygraph provides comprehensive documentation covering API reference, schema components, references, webhooks, and AI integrations (AI Agents, AI Assist, MCP Server). All resources are available at Hygraph Documentation.
What are the key capabilities and benefits of Hygraph?
Hygraph offers GraphQL-native architecture, content federation, scalability, enterprise-grade security and compliance, 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. Features
How does Hygraph optimize product performance?
Hygraph delivers high-performance endpoints for low latency and high read-throughput content delivery, actively measures GraphQL API performance, and provides practical optimization advice. Details are available in the performance blog and GraphQL Report 2024.
Pricing & Plans
What pricing plans does Hygraph offer?
Hygraph offers three main pricing plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different features and limits tailored to individual, small business, and enterprise needs. Pricing Page
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/assignment workflow. Pricing Page
What features are included in the Growth plan?
The Growth plan starts at $199/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 desk. Pricing Page
What features are included in the Enterprise plan?
The Enterprise plan offers custom limits on users, roles, entries, locales, API calls, components, remote sources, version retention for a year, scheduled publishing, dedicated infrastructure, global CDN, security controls, SSO, multitenancy, backup recovery, custom workflows, dedicated support, and custom SLAs. Pricing Page
Security & Compliance
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. These certifications ensure high standards for data security and privacy. Secure Features
How does Hygraph ensure data security?
Hygraph uses granular permissions, audit logs, SSO integrations, encryption at rest and in transit, regular backups, and dedicated hosting options in multiple regions. Security incidents can be reported through a dedicated process. Secure Features
Use Cases & Benefits
What are some use cases for Hygraph?
Hygraph is used as a headless CMS, media products and platforms data source, knowledge management tool, and inventory/catalog management platform. It supports niche use cases like financial data visualization and publishing platforms. Use Cases
Who can benefit from using Hygraph?
Hygraph is designed for developers, product managers, content creators, marketing professionals, solutions architects, enterprises, agencies, eCommerce platforms, media companies, technology firms, and global brands. Case Studies
What industries are represented in Hygraph's case studies?
Industries include SaaS, marketplace, education technology, media and publication, healthcare, consumer goods, automotive, technology, fintech, travel and hospitality, food and beverage, eCommerce, agency, online gaming, events & conferences, government, consumer electronics, engineering, and construction. Case Studies
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 time-to-market, and Samsung improved engagement by 15%. Case Studies
Can you share specific case studies or success stories?
Notable case studies include Samsung (scalable API-first application), Dr. Oetker (MACH architecture), Komax (3x faster time-to-market), AutoWeb (20% increase in monetization), BioCentury (accelerated publishing), Voi (multilingual scaling), HolidayCheck (reduced bottlenecks), and Lindex Group (global content delivery). Case Studies
Who are some of Hygraph's customers?
Customers include Samsung, Dr. Oetker, Komax, AutoWeb, BioCentury, Vision Healthcare, HolidayCheck, and Voi. These companies span multiple industries and have leveraged Hygraph for various digital transformation projects. Case Studies
Pain Points & Solutions
What operational pain points does Hygraph solve?
Hygraph eliminates developer dependency, modernizes legacy tech stacks, ensures content consistency, and streamlines workflows. For example, HolidayCheck reduced bottlenecks, enabling marketers to update content independently. Case Study
What financial pain points does Hygraph address?
Hygraph reduces operational and maintenance costs, accelerates speed-to-market, and supports scalable content delivery. Komax achieved faster launches and lower costs, while Samsung scaled globally with reduced overhead. Case Study
What technical pain points does Hygraph solve?
Hygraph simplifies schema evolution, integrates third-party systems, optimizes performance, and enhances localization and asset management. Its GraphQL-native architecture and Smart Edge Cache address common bottlenecks. GraphQL Report 2024
How does Hygraph differentiate itself in solving pain points?
Hygraph stands out with its user-friendly interface, GraphQL-native architecture, content federation, cost efficiency, robust APIs, Smart Edge Cache, and localization features. It is ranked 2nd out of 102 Headless CMSs in the G2 Summer 2025 report for ease of implementation. G2 Report
Competition & Comparison
How does Hygraph compare to traditional CMS platforms?
Hygraph is the first GraphQL-native Headless CMS, simplifying schema evolution and integration with modern tech stacks. Unlike traditional CMS platforms that rely on REST APIs, Hygraph offers content federation, user-friendly tools, and enterprise-grade features for scalability and flexibility. Comparison
Why choose Hygraph over alternatives?
Hygraph offers unique advantages such as GraphQL-native architecture, content federation, enterprise-grade security, user-friendly tools, scalability, proven ROI, and market recognition. It ranked 2nd out of 102 Headless CMSs in the G2 Summer 2025 report. G2 Report
Product Information & Technical Requirements
What is the primary purpose of Hygraph?
Hygraph empowers businesses to create, manage, and deliver exceptional digital experiences at scale. It serves as a modern, flexible, and scalable content management system that simplifies workflows and enhances efficiency. Product Page
What are the technical requirements for integrating Hygraph with Remix, Tremor, and Tailwind CSS?
You need to set up a Remix app, install dependencies (graphql-request, graphql, @tremor/react, tailwindcss), configure Tailwind CSS and Tremor styles, and use environment variables for API access. The tutorial provides detailed code samples and configuration steps. Tutorial
How do I display financial data using Hygraph and Tremor?
After fetching financial data via Hygraph's Content API, you can use Tremor's Card, Title, and LineChart components to visualize annual earnings per share. The tutorial includes sample code for mapping and formatting data for chart display. Tutorial
Where can I find the final code for the stock market website tutorial?
Working with Remote Sources to build a stock market website
Let's learn how to use a finance API as a Remote Source with Hygraph and how to beautifully display the data using Remix, Tremor, and Tailwind CSS.
Written by MuhammadÂ
on May 22, 2023
Every team in every industry uses content, whether they create, manage, analyze, or distribute it. Federated content platforms like Hygraph give your frontend team options for how to integrate your content sources with the tech stack you're already using (and that your non-technical team members are already comfortable with). Companies have leaned on Hygraph as a headless CMS, as a media products and platforms data source, as a next-generation knowledge management tool, and even as an inventory and catalog management platform.
But for now, let’s explore a more niche use case—displaying the financial data of publicly traded companies via a simple web app.
For the next few minutes, you will learn how to display a simple line chart containing a company's historical Earnings Per Share (EPS). We’ll use the Alpha Vantage API to get financial data, hook it up as a Hygraph Remote Source, and run queries against it with GraphQL. This tutorial uses Remix to build the web app, Tailwind CSS, and Tremor for styling and professional out-of-the-box charting components.
Let’s start with a free Alpha Vantage account. Save the API key you receive after registering—you’ll need it later.
You’ll be working with the Earnings API. It provides earnings data for whichever publicly traded company you want. You can immediately test it with language-specific code from its documentation.
Click the example URL to get a JSON response similar to this:
{
"symbol":"IBM",
"annualEarnings":[
{
"fiscalDateEnding":"2022-12-31",
"reportedEPS":"9.12"
},
// ...
{
"fiscalDateEnding":"1997-12-31",
"reportedEPS":"3.09"
},
{
"fiscalDateEnding":"1996-12-31",
"reportedEPS":"2.77"
}
],
"quarterlyEarnings":[
{
"fiscalDateEnding":"2022-12-31",
"reportedDate":"2023-01-25",
"reportedEPS":"3.6",
"estimatedEPS":"3.6",
"surprise":"0",
"surprisePercentage":"0"
},
// ...
{
"fiscalDateEnding":"1996-06-30",
"reportedDate":"1996-07-25",
"reportedEPS":"0.63",
"estimatedEPS":"0.61",
"surprise":"0.02",
"surprisePercentage":"3.2787"
},
{
"fiscalDateEnding":"1996-03-31",
"reportedDate":"1996-04-17",
"reportedEPS":"0.55",
"estimatedEPS":"0.6",
"surprise":"-0.05",
"surprisePercentage":"-8.3333"
}
]
}
As you can see, it provides quarterly and yearly earnings per share and a few other details. The final web app built from this tutorial will chart annual earnings per share using this data.
This tutorial uses Hygraph as an intermediary, letting you interact with the Alpha Vantage API via a GraphQL interface. Create a new Hygraph account, and you’re ready to create a new project.
Click Add project.
Name it whatever you want—this tutorial uses the name Stockmarket API—and selects the region closest to you.
Add a Remote Source
Under Remote Sources in the sidebar of your new project, click + Add.
Name it whatever you want—this tutorial uses Alpha Vantage API.
Scroll down a bit to specify a base URL. Set https://www.alphavantage.co as the base URL, then click + Add custom type definition. This is where you add the GraphQL SDL you generated in the last section.
Click + Add custom type definition three times to add three different definitions. Note that you can refer to one type from another, similar to how the Root type refers to AnnualEarning and QuarterlyEarning in the following image.
Once you’ve defined the custom types, click Add to add the new Remote Source successfully.
Creating a custom model
To create a custom model that uses this Remote Source, click + Add` in the Models** section.
Name it whatever you want—this tutorial uses Earning.
Scroll to the bottom of the available fields section to add a REST field to the model.
Name it Alpha Vantage and change the Return type to Root.
Scroll until you reach the option to specify an input argument and the Remote Source path. You can either refer to another field in the model and use that as part of the input path, or specify an input just for this field.
Let's specify a string input for this field that lets us pass in a symbol to query for.
Click Add, and Hygraph should add this new Alpha Vantage field to your model.
Adding the content entry
However, Hygraph needs data stored for the model before it can return any data from a remote source.
The Alpha Vantage field you created is read-only—you can’t run any mutations against it. So you need to create a new field where you can save data. Add a new single-line text field to the model and name it Symbol.
Go to the Content section in the sidebar and add a new entry from the UI.
Add IBM as the Symbol value and click Save & publish.
Click API playground in the sidebar and try querying your custom model. If everything works, you should also see the Alpha Vantage API response as part of the output.
Creating a permanent token
Hygraph's Content API rejects unauthenticated requests by default. That means you have one last thing to do before moving on to the web app development part of the tutorial: create a new permanent token for making requests against your model.
Go to Project settings > API Access > + Add tokento create a new permanent token.
Name it whatever you want—this tutorial uses the name Web App token.
On the permissions page, go to Content permissions and click + Add permission.
Give your token read permissions.
If you return to the API Access page, you’ll see the Content API endpoint. Save the token you created in the last step and this API endpoint. You need both in the next section when you create the web app.
With everything ready on the Hygraph end, let's start building the web app.
In this half of the tutorial, let’s make a Remix application that utilizes Tailwind CSS and Tremor to display a friendly UI. We’ll use graphql-request to request Hygraph's Content API.
Requirements
To get a basic Remix app up and running, you need to run the following:
$ npx create-remix@latest
Follow the on-screen instructions and name your app whatever you like. The app in this tutorial is called hygraph-app. Simple.
Need to install the following packages:
create-remix@1.14.0
Ok to proceed?(y) y
?Where would you like to create your app? hygraph-app
?What type of app do you want to create?Just the basics
?Wheredo you want to deploy?ChooseRemixAppServerif you're unsure; it's easy to change deployment targets.RemixAppServer
?TypeScript or JavaScript?TypeScript
?Do you want me to run `npm install`?Yes
npm WARN deprecated @npmcli/move-file@1.1.2:This functionality has been moved to @npmcli/fs
npm WARN deprecated rollup-plugin-inject@3.0.2:Thispackage has been deprecated and is no longer maintained.Please use @rollup/plugin-inject.
npmWARN deprecated sourcemap-codec@1.4.8:Please use @jridgewell/sourcemap-codec instead
added 938 packages, and audited 939 packages in 1m
235 packages are looking for funding
run `npm fund`for details
found 0 vulnerabilities
đź’ż That's it!`cd` into "/hygraph-app" and check the READMEfor development and deploy instructions!
`
While you’re at it, go ahead and install graphql-request, graphql, Tailwind CSS, and tremor as dependencies:
Remix has experimental built-in support for Tailwind CSS, so you don't need to run the Tailwind CSS compiler separately. However, this support is experimental and hidden behind a feature flag. Enable it by editing the remix.config.js file and setting the unstable_tailwind option to true.
/** @type {import('@remix-run/dev').AppConfig} */
module.exports={
ignoredRouteFiles:["**/.*"],
future:{
unstable_tailwind:true,
},
};
Next, run Tailwind CSS's init command to create a Tailwind CSS config file:
$ npx tailwindcss init
This should result in a new tailwind.config.js file in your project directory. Update it to look like this:
/** @type {import('tailwindcss').Config} */
module.exports={
content:["./app/**/*.{ts,tsx,jsx,js}"],
theme:{
extend:{},
},
plugins:[],
}
The modified value for the content key ensures that Tailwind CSS parses and compiles Tailwind CSS-specific classes in your code files.
Next, create a main CSS file and import all your Tailwind CSS layers. Create a new styles directory in the app folder and a new tailwind.css file. Populate this file with the following imports:
@tailwind base;
@tailwind components;
@tailwind utilities;
Link this stylesheet in your Remix app by editing the root.tsx file in the app folder and adding the following code:
import styles from "./styles/tailwind.css";
export const links: LinksFunction = () => [
{ rel: "stylesheet", href: styles },
];
You’re all set up to use Tailwind CSS in your project. Whenever you run npm run dev or npm run build, Remix automatically runs the Tailwind CSS compiler to ensure all appropriate styles are generated.
Setting up Tremor
Tremor setup is a bit easier than Tailwind CSS. You have to ensure you import the default styles that come with it.
Edit the index.tsx file in the routes directory and add the following code to the file:
import styles from "@tremor/react/dist/esm/tremor.css";
export function links() {
return [{ rel: "stylesheet", href: styles }];
}
Loading data from Hygraph
Remix makes use of loader functions for data fetching. These are exported functions in your route files named loader. The code within these functions only runs on the server side when a request is made to the route file. This code is never bundled in the client-side JS files, which means you can safely use any environment variables in it.
To get started, save a few environment variables and use them in your Remix app by creating a .env file in the root of your project folder. Remix automatically loads these environment variables and provides access to them in the loader function.
Add the following two environment variables in the .env file:
HYGRAPH_URL=__YOUR_HYGRAPH_URL__
API_TOKEN=__YOUR_API_TOKEN
Editor's Note
You can get both of these values from the last section where you created a permanent token in the Hygraph dashboard.
Edit the app/routes/index.tsx file and add the following code:
import { json, LoaderArgs, LoaderFunction } from "@remix-run/node";
import { gql, GraphQLClient } from "graphql-request";
const data: any = await hygraph.request(dataQuery, { symbol: symbol });
return json({ data: data['earnings'][0]['alphaVantage'], symbol: symbol })
}
The code is fairly straightforward but does have a few interesting bits.
The url.searchParams object returns any values that might be passed to the route as part of the key/value pair in the GET request. For instance, if you send a request to hygraph.com/?symbol=ibm, it provides you access to symbol=ibm. You’ll use this to hook a form and update the chart when the user queries for a new symbol.
Additionally, the code uses the graphql-request library to simplify GraphQL queries. It allows you to set up an authorization header once and then utilize it for all future queries. This tutorial is a simple project with only one route, so you can define everything in this loader function. But if you use multiple routes, you can move the queries to a separate file and import them wherever required.
The function terminates by returning the JSON data from Hygraph, ready to be used in the exported Component—more on this in just a second.
Displaying the line chart
Edit the Index function to make use of the data from the loader function:
import { Card, Title, LineChart } from "@tremor/react";
import { Form, useLoaderData } from "@remix-run/react";
It’s loading the JSON returned by the loader function.
It creates a new object using that in reverse order so that the chart starts with the earliest date on the left.
And it’s parsing the EPS values to floats so that they display correctly on the chart.
Then, it extracts the earliest and the latest date from the data just to make the UI a bit nicer by mentioning these dates in the title. It does this by taking the first and last fiscalDateEnding values from the data and extracting the year portion from that.
A dataFormatter function is also defined. This formats the y-axis values and puts a $ sign at the front.
Here’s the updated return statement that displays the whole UI:
<Title>Annual Earnings of {company} ({earliestDate} to {latestDate})</Title>
<LineChart
data={newchartdata}
dataKey="fiscalDateEnding"
categories={["reported EPS"]}
colors={["blue"]}
valueFormatter={dataFormatter}
marginTop="mt-10"
yAxisWidth="w-10"
/>
</Card>
</div>
);
The Form component is a Remix built-in that allows you to implement loading states in the UI. It’s based on the HTML form element.
Other than that, the code makes use of the Card, Title, and LineChart components from Tremor. You can read the official docs to learn more about them.
Optionally, you can make your UI tidier by centering the chart and input vertically on the page. Edit the app/root.tsx file and modify the body tag to resemble this:
In this fairly long but hopefully interesting tutorial, you learned how to use a finance API as a Remote Source with Hygraph and how to beautifully display the data using Remix, Tremor, and Tailwind CSS.
Using your ideas from this tutorial, you can construct your future projects using Hygraph, as the powerful platform has a wide range of functionalities that help developers build anything, including publishing platforms like BioCentury that fetch live financial data.
Ask anything in our official Slack workspace if you have questions, and our team would be happy to help you.
Blog Author
Muhammad Yasoob Ullah Khalid
Yasoob is an author, blogger, and tech speaker. His books include "Intermediate Python" and "Practical Python Projects," and he's currently working on Azure at Microsoft.
Share with others
Sign up for our newsletter!
Be the first to know about releases and industry news and insights.