This repository builds a static copy of the public Rick and Morty API.
The generated API is intentionally static-first and not fully compatible with the original REST API.
Endpoints:
| Endpoint | Description |
|---|---|
/api/index.json |
API root with links to resource lists. |
/api/character/index.json |
First page of characters. |
/api/character/page/<page>.json |
Characters page. |
/api/character/<id>.json |
Single character. |
/api/character/all.json |
All characters as one array. |
/api/character/episodes/<id>.json |
Episodes for a single character. |
/api/character/avatar/<id>.<ext> |
Character image. |
/api/location/index.json |
First page of locations. |
/api/location/page/<page>.json |
Locations page. |
/api/location/<id>.json |
Single location. |
/api/location/all.json |
All locations as one array. |
/api/location/residents/<id>.json |
Residents for a single location. |
/api/episode/index.json |
First page of episodes. |
/api/episode/page/<page>.json |
Episodes page. |
/api/episode/<id>.json |
Single episode. |
/api/episode/all.json |
All episodes as one array. |
/api/episode/characters/<id>.json |
Characters for a single episode. |
/meta.json |
Generation metadata. |
npm run generateBuild parameters:
| Variable | Default | Description |
|---|---|---|
PUBLIC_BASE_URL |
empty | Base URL used when rewriting links inside JSON files. GitHub Actions sets it to the repository Pages URL. |
OUTPUT_DIR |
public |
Directory where static files are written. |
SOURCE_API_URL |
https://rickandmortyapi.com/api |
Upstream API base URL. |
RATE_LIMIT_TIMEOUT_MS |
60000 |
Fallback wait after HTTP 429 without Retry-After. |
RETRY_TIMEOUT_MS |
1000 |
Base wait before retrying retryable non-rate-limit failures. |
MAX_RETRIES |
8 |
Maximum retry count for retryable upstream failures. |
The generated files are written to public.