A simple TypeScript API that returns random data with Unkey authentication.
- 🔐 Unkey API key authentication
- 📊 Random data generation (users, products, quotes, jokes)
- ⚡ Fast and lightweight
- 🛠️ TypeScript with strict type checking
- 📝 Code style enforced with Biome
pnpm installCopy .env.example to .env and add your Unkey credentials:
cp .env.example .envUpdate the .env file with your actual Unkey credentials:
MY_ROOT_KEY: Your Unkey root key (get it from https://unkey.com)
pnpm devThe server will start on http://localhost:8080 (or the PORT specified in .env).
docker build -t simple-unkey-api .docker run -p 8080:8080 \
-e MY_ROOT_KEY=your_unkey_root_key_here \
simple-unkey-apiOr using a .env file:
docker run -p 8080:8080 --env-file .env simple-unkey-apiGET /- API information and available endpointsGET /health- Health check endpoint
All endpoints under /api/* require a valid Unkey API key in the Authorization header.
GET /api/users?count=5- Get random usersGET /api/products?count=5- Get random productsGET /api/quotes?count=1- Get random quotesGET /api/jokes?count=1- Get random jokesGET /api/random- Get a random item of any type
Include your Unkey API key in the Authorization header:
curl -H "Authorization: Bearer your_api_key_here" http://localhost:8080/api/userscurl -H "Authorization: Bearer your_api_key_here" http://localhost:8080/api/users?count=10curl -H "Authorization: Bearer your_api_key_here" http://localhost:8080/api/products?count=5curl -H "Authorization: Bearer your_api_key_here" http://localhost:8080/api/quotescurl -H "Authorization: Bearer your_api_key_here" http://localhost:8080/api/jokes?count=3pnpm buildpnpm startpnpm lintpnpm lint:fix- TypeScript
- Express.js
- Unkey for authentication
- Biome for linting and formatting
- pnpm for package management