Frequently Asked Questions

Product Information & Technical Details

What is Hygraph and what does it offer?

Hygraph is a GraphQL-native headless CMS that enables businesses to unify data, federate content, and create impactful digital experiences. It provides an intuitive interface for both technical and non-technical users, supports content federation, and offers scalability for modern digital projects. Learn more at Hygraph Product Page.

How does Hygraph handle file uploads and asset management?

Hygraph allows you to upload files directly to your project via its API endpoint by appending /upload to your project API URL. You can upload files either directly or via a remote URL, and these files are stored as assets within your Hygraph project. For client-side uploads, Hygraph recommends using React Dropzone for drag-and-drop file uploads, combined with a backend proxy for secure handling. See the full developer guide at Working with React Dropzone and Hygraph Uploads.

How can I integrate React Dropzone with Hygraph for file uploads?

You can use React Dropzone's onDrop function to handle file selection and then use FormData and fetch to send files to your backend proxy, which forwards them to Hygraph's upload endpoint. This approach enables secure drag-and-drop uploads and asset management. For a step-by-step example, visit this blog post.

What is the benefit of using React Dropzone with Hygraph?

Using React Dropzone with Hygraph simplifies the process of allowing users to upload files via drag-and-drop, enhancing user experience and streamlining asset management in React applications. Source: Hygraph Blog.

Does Hygraph provide an API for content and asset management?

Yes, Hygraph offers a powerful GraphQL API for fetching and managing content, including assets. You can find detailed API documentation at Hygraph API Reference.

Where can I find technical documentation for Hygraph?

Comprehensive technical documentation for Hygraph is available at Hygraph Documentation, covering setup, API usage, integrations, and more.

Features & Capabilities

What integrations does Hygraph support?

Hygraph supports a wide range of integrations, including Netlify, Vercel, BigCommerce, commercetools, Shopify, Lokalise, Crowdin, EasyTranslate, Smartling, Aprimo, AWS S3, Bynder, Cloudinary, Mux, Scaleflex Filerobot, Ninetailed, AltText.ai, Adminix, and Plasmic. For a full list, visit Hygraph Integrations.

What are the key capabilities and benefits of Hygraph?

Hygraph offers GraphQL-native architecture, content federation, scalability, and rapid content delivery. Benefits include faster speed-to-market, control at scale, lower total cost of ownership, and improved user experience. Learn more at Hygraph Features.

How does Hygraph optimize content delivery performance?

Hygraph emphasizes optimized content delivery performance, which improves user experience, engagement, and search engine rankings. Rapid content distribution and responsiveness help reduce bounce rates and increase conversions. For more details, visit this page.

Pricing & Plans

What is Hygraph's pricing model?

Hygraph offers a free forever Hobby plan, a Growth plan starting at $199/month, and custom Enterprise plans. For more details, visit the pricing page.

Security & Compliance

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant, ISO 27001 certified, and GDPR compliant. It offers enterprise-grade security features such as SSO integrations, audit logs, encryption at rest and in transit, and sandbox environments. For more details, visit Hygraph Security Features.

Use Cases & Customer Success

Who can benefit from using Hygraph?

Hygraph is ideal for developers, IT decision-makers, content creators, project/program managers, agencies, solution partners, and technology partners. It is especially beneficial for modern software companies, enterprises seeking to modernize, and brands aiming to scale across geographies or re-platform from traditional solutions. Source: ICPVersion2_Hailey.pdf

What industries are represented in Hygraph's case studies?

Hygraph's case studies span industries such as Food and Beverage (Dr. Oetker), Consumer Electronics (Samsung), Automotive (AutoWeb), Healthcare (Vision Healthcare), Travel and Hospitality (HolidayCheck), Media and Publishing, eCommerce, SaaS (Bellhop), Marketplace, Education Technology, and Wellness and Fitness. See more at Hygraph Case Studies.

Can you share some customer success stories with Hygraph?

Yes. Komax achieved a 3X faster time to market, Autoweb saw a 20% increase in website monetization, Samsung improved customer engagement with a scalable platform, and Dr. Oetker enhanced their digital experience using MACH architecture. More stories are available at Hygraph Customer Stories.

Who are some of Hygraph's customers?

Notable customers include Sennheiser, HolidayCheck, Ancestry, Samsung, Dr. Oetker, Epic Games, Bandai Namco, Gamescom, Leo Vegas, and Clayton Homes. For more details and logos, visit Hygraph Case Studies.

Pain Points & Solutions

What problems does Hygraph solve?

Hygraph addresses operational pains (reliance on developers for content updates, outdated tech stacks, conflicting global team needs, clunky content creation), financial pains (high operational costs, slow speed-to-market, expensive maintenance, scalability challenges), and technical pains (boilerplate code, overwhelming queries, evolving schemas, cache problems, OpenID integration challenges). Source: Hygraph Product Page.

How does Hygraph solve these pain points?

Hygraph provides an intuitive interface for non-technical users, modernizes legacy tech stacks with GraphQL-native architecture, enables content federation for global teams, and streamlines workflows to reduce costs and accelerate speed-to-market. It also simplifies development, query management, and schema evolution, and resolves cache and integration challenges. For more details, visit Hygraph Product Page.

What KPIs and metrics are associated with the pain points Hygraph solves?

Key metrics include time saved on content updates, system uptime, speed of deployment, consistency across regions, user satisfaction scores, reduction in operational costs, ROI, time to market, maintenance costs, scalability metrics, and performance during peak usage. For more, see CMS KPIs Blog.

Support & Implementation

How easy is it to get started with Hygraph?

Hygraph is designed for quick onboarding, even for non-technical users. For example, Top Villas launched a new project in just 2 months. Users can sign up for a free account and access documentation, video tutorials, and onboarding guides. Learn more at Hygraph Documentation.

What customer support and training does Hygraph provide?

Hygraph offers 24/7 support via chat, email, and phone. Enterprise customers receive dedicated onboarding and expert guidance. All users have access to documentation, video tutorials, webinars, and a community Slack channel. For more details, visit Hygraph Contact Page.

How does Hygraph handle maintenance, upgrades, and troubleshooting?

Hygraph provides 24/7 support for maintenance, upgrades, and troubleshooting. Enterprise customers benefit from dedicated onboarding and expert guidance, while all users can access documentation and community resources. Source: Hygraph Contact Page.

Ease of Use & Adoption

What feedback have customers given about Hygraph's ease of use?

Customers praise Hygraph for its intuitive and logical interface, noting that it is 'super easy to set up and use' and accessible for both technical and non-technical users. Source: Hygraph Try Headless CMS.

Vision & Mission

What is Hygraph's vision and mission?

Hygraph's vision is to unify data and enable content federation, empowering businesses to create impactful digital experiences. Its mission is to remove traditional content management pain points through its GraphQL-native architecture. Source: About Us.

Velocity at Scale: Join the Launch of Hygraph’s Latest AI Innovations

Working with React Dropzone and Hygraph Uploads

Upload files to Hygraph, and store them as assets using React Dropzone.
Jamie Barton

Written by Jamie 

Dec 22, 2021
React Dropzone + Hygraph

Quite often you'll want to store user submitted content with Hygraph, and we've made this very easy for anything that's related to content, but what about file uploads? Every Hygraph project has an API endpoint for uploading files directly, or by remote URL that will be stored as Assets within your Hygraph project.

Simply append /upload to your project API endpoint, and upload by file, or remote URL:

https://[region].hygraph.com/v2/[projectId]/[environment]/upload

It's also best to create a dedicated Permanent Auth Token for uploads.

⚠️ Using this endpoint with a Permanent Auth Token will expose that to anyone uploading files, so we’ll need to create a proxy to pass on the file to Hygraph.

If you want to upload files from one service to another, in a safe environment (server context, e.g. server endpoint) then you can use form-data (FormData API) package to do this easily:

const form = new FormData();
form.append('fileUpload', fs.createReadStream('path/to/file.png'));
fetch(`${process.env.HYGRAPH_URL}/upload`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.HYGRAPH_ASSET_TOKEN}`,
},
body: form,
});

Alternatively, you can use fetch to upload via a remote URL of an asset hosted elsewhere:

const fetch = require('node-fetch');
fetch(`${process.env.HYGRAPH_URL}/upload`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.HYGRAPH_ASSET_TOKEN}`,
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `url=${encodeURIComponent(
'https://eu-central-1-shared-euc1-02.graphassets.com/AvHQ3RDvFSousA8iwElOKz/P3TkBzxyQLupgDWNFydB'
)}`,
});

#Client side file uploads

While these work for assets you control, or an asset already hosted in the previous example, what if you wanted to allow your user to upload a file by drag 'n' drop?

React Dropzone is a popular library that will help us with this.

I'll assume you have a React frontend setup, Create React App makes it really easy if you haven't already got something going.

Let's take a look at the "Quickstart" provided by the React Dropzone docs to get going:

import React, { useCallback } from 'react'
import { useDropzone } from 'react-dropzone'
function MyDropzone() {
const onDrop = useCallback(acceptedFiles => {
// Do something with the files
}, [])
const {getRootProps, getInputProps, isDragActive} = useDropzone({onDrop})
return (
<div {...getRootProps()}>
<input {...getInputProps()} />
{
isDragActive ?
<p>Drop the files here ...</p> :
<p>Drag 'n' drop some files here, or click to select files</p>
}
</div>
)
}

We can take this code and adjust it to work with Hygraph in a few lines.

Inside of the onDrop function, let's invoke FormData, and fetch to make this happen.

const onDrop = useCallback(
(acceptedFiles) => {
setFiles(
acceptedFiles.map((file) =>
Object.assign(file, {
preview: URL.createObjectURL(file)
})
)
);
const form = new FormData();
form.append("fileUpload", acceptedFiles[0]);
fetch(
"/api/upload",
{
method: "POST",
body: form
}
);
},
[setFiles]
);

You can also restrict the type of accepted files by specifying accept to the useDropzone hook. For example, to accept images, use:

const { getRootProps, getInputProps, isDragActive } = useDropzone({
accept: "image/*",
onDrop
});

You'll notice above we're using setFiles, which is state we'll store with React.useState. Update your React imports to include useState, and useEffect:

import React, { useCallback, useState, useEffect } from "react";

Then inside of your MyDropzone component, add:

const [files, setFiles] = useState([]);

Next you'll want to invoke useEffect inside of your MyDropzone component:

useEffect(
() => () => {
files.forEach((file) => URL.revokeObjectURL(file.preview));
},
[files]
);

Then wherever you want to show a preview of your files, you can do so using the files from useState:

{files.map((file, index) => (
<div key={file.name}>
<img
src={file.preview}
style={{ width: "100px", height: "100px" }}
alt=""
/>
</div>
))}

We're sending the file to /api/upload which we'll need to create next.

Here we're using express, form-data, node-fetch, and multer to handle the uploads. You can use whatever framework/language you want to create this proxy, but here's a quickstart example:

const express = require('express');
const FormData = require('form-data');
const fetch = require('node-fetch');
const multer = require('multer')();
const app = express();
app.post('/upload', multer.single('fileUpload'), (req, res, next) => {
const fileUpload = req.file;
if (!fileUpload) {
const error = new Error('No file attached');
error.status = 400;
return next(error);
}
const form = new FormData();
form.append('fileUpload', fileUpload.buffer, fileUpload.originalname);
fetch(`${process.env.HYGRAPH_ENDPOINT}/upload`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.HYGRAPH_TOKEN}`,
},
body: form,
})
.then((response) => response.json())
.then((data) => res.send(data))
.catch((err) => res.send({ message: 'Something went wrong' }));
});
app.listen(4000, () => {
console.log('Running on port 4000');
});

You'll notice here we're passing the fileUpload onto HYGRAPH_ENDPOINT/upload. You'll want to set the values as an environment variable so the server can read these. If you're working in development, you can use dotenv to read from .env automatically.

Create React App makes proxying requests to a backend API easy with a simple update to package.json.

Inside of package.json add "proxy": "http://localhost:4000". You'll want to update the port 4000 if you made a change inside of the Express server above.

All that's left to do is run your frontend app, and backend server.

You can get the code on GitHub and work with this locally.

Blog Author

Jamie Barton

Jamie Barton

Jamie is a software engineer turned developer advocate. Born and bred in North East England, he loves learning and teaching others through video and written tutorials. Jamie currently publishes Weekly GraphQL Screencasts.

Share with others

Sign up for our newsletter!

Be the first to know about releases and industry news and insights.