All configuration for Infinity Scroll is contained in the first three lines ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ClaytonSeager/InifinityScroll/llms.txt
Use this file to discover all available pages before exploring further.
Infinity.js. There is no separate config file, no .env, and no build-time substitution — the values are plain JavaScript constants that you edit directly before opening the gallery.
count sets how many images are fetched per API call, KEY authenticates every request to the Unsplash API, and query holds the active search term (managed at runtime by the search bar — you do not set this manually).
Configuration reference
Your Unsplash API Access Key. Every request to the Unsplash API is authenticated via the
client_id query parameter, which is populated from this constant. Without a valid key all fetch calls will return a 401 Unauthorized error and no images will load.Obtain your key at https://unsplash.com/developers — see Getting an Unsplash API key below. Replace the placeholder value in Infinity.js with your own Access Key before running or sharing the project.The number of images fetched in each API call. This value is passed directly as the
count query parameter in both the random and search Unsplash endpoints.The Unsplash free tier supports a maximum of 30 images per request. Values above 30 will be silently clamped by the API. Keeping count between 5 and 20 balances load time against the number of API calls consumed per browsing session.Getting an Unsplash API key
Create a free Unsplash Developer account
Visit https://unsplash.com/developers and click Register as a developer. If you already have an Unsplash account you can log in directly.
Create a new application
From your developer dashboard, click Your apps → New Application. Read and accept the API guidelines — Unsplash requires that you credit photographers when displaying images — then provide an application name and description and click Create application.
Copy your Access Key
On the application detail page, scroll down to the Keys section. Copy the value labelled Access Key (not the Secret Key).
API rate limits
The Unsplash free developer tier allows 50 requests per hour. With the defaultcount of 10, each full scroll batch consumes one request and surfaces 10 images, meaning you can load up to 500 images per hour before hitting the limit.
count value | Images per request | Max images/hour (50 req) |
|---|---|---|
| 5 | 5 | 250 |
| 10 (default) | 10 | 500 |
| 20 | 20 | 1,000 |
| 30 (API max) | 30 | 1,500 |
429 Too Many Requests response. getPhotos() will catch this as a JSON parse error and log it to the browser console — the gallery will stop loading new images until the rate limit window resets.
Recommendation: Keep count between 5 and 20 for a comfortable balance between images per scroll and hourly capacity.
Search vs. random mode
Thequery variable determines which Unsplash endpoint getApiUrl() uses to build the fetch URL.
Random mode — When query is an empty string (''), the gallery fetches random photos using the /photos/random/ endpoint:
query contains a search term (set by the search bar), the gallery switches to the /search/photos/ endpoint and appends the keyword:
results key, getPhotos() handles both shapes:
query back to '', returning the gallery to random mode on the next fetch. The query variable is managed entirely at runtime — you do not need to edit it in the source file.