A serverless, database-free REST API that serves card data for the popular party game Cards Against Humanity. This API is optimized for serverless platforms like Vercel and Netlify. It fetches the card data once, caches it in memory, and provides high-performance access to packs and cards.
- Blazing Fast: Responses are cached and served instantly.
- Serverless: Zero server maintenance, auto-scaling, and deployed to global CDNs.
- Zero Database Setup: Card data is loaded directly from a highly optimized compact JSON source.
- Flexible Data Source: Easily swap the card database via the
CAH_JSON_URLenvironment variable.
You can query the API using standard HTTP client tools like curl, fetch, or any HTTP client library.
curl "https://cah-api.firer.at/api/sets/0?n=5"Response:
[
"Not feeling a thing.",
"Throwing a car at someone.",
"A bunch of scary, alcoholic bums.",
"Stanky pirate snatch",
"The Big Rip."
]| Endpoint | Method | Description | Query Parameters | Example |
|---|---|---|---|---|
/api/sets |
GET |
List all available card packs with their names and metadata. | None | /api/sets |
/api/sets/:id |
GET |
Get a specific card pack including all its black and white cards. | n (optional): Number of random white cards to return. |
/api/sets/0 or /api/sets/0?n=5 |
/api/multi |
GET |
Retrieve multiple card packs by their IDs. | sets (required): Comma-separated list of pack IDs. |
/api/multi?sets=0,1 |
The game is simple and played similarly to Apples to Apples.
- Setup: The game requires 3 or more players. One player is selected as the first Card Czar.
- Dealing: The Card Czar deals 10 white cards (response cards) to each player.
- The Prompt: The Card Czar flips over one black card (prompt card) and reads it aloud.
- Playing: All other players choose the funniest white card(s) from their hand that answer the prompt or fill in the blank, and slide them face down to the Card Czar.
- Judging: The Card Czar shuffles all the received white cards, reads them aloud, and chooses the funniest combination.
- Winning a Round: The player who submitted the winning card gets the black card as an "Awesome Point".
- Next Round: All players draw back up to 10 white cards. The role of Card Czar rotates to the next player, and a new round begins.
For instructions on how to run this project locally, configure environment variables, and deploy to platforms like Vercel and Netlify, please refer to the DEPLOYMENT.md guide.
Credits to github.com/spglancy/CAH-API for the inspiration and endpoint structure.