A comprehensive REST API serving over 5,000 jokes across 16 categories. Built with Go, featuring a full web interface, GraphQL support, and Swagger documentation.
Official Site: jokes.apimgr.us
The Jokes API provides free, open access to 5,160+ jokes across 16 different categories. No authentication required, no API keys needed - just pure comedy at your fingertips.
- 🎯 5,160+ Jokes across 16 categories
- 🌐 Full Web Interface with dark/light themes
- 🚀 REST API with versioning (
/api/v1) - 🔮 GraphQL support for flexible queries
- ⚡ Swagger/OpenAPI documentation
- 📱 PWA Support for offline access
- 🔓 No Authentication - freely available
- ⚙️ File-based Configuration (YAML)
- 🐳 Docker ready with compose
- 📦 Single Static Binary with embedded assets
curl -fsSL https://raw.githubusercontent.com/apimgr/jokes/main/scripts/install.sh | sudo bashcurl -fsSL https://raw.githubusercontent.com/apimgr/jokes/main/scripts/install.sh | bashirm https://raw.githubusercontent.com/apimgr/jokes/main/scripts/windows.ps1 | iex# Using docker-compose
docker-compose up -d
# Using docker directly
docker run -d \
-p 64321:80 \
-v ./data:/data \
-v ./config:/config \
--name jokes-api \
ghcr.io/apimgr/jokes:latestDownload pre-built binaries from the releases page:
- Linux:
jokes-api-linux-amd64,jokes-api-linux-arm64 - macOS:
jokes-api-darwin-amd64,jokes-api-darwin-arm64 - Windows:
jokes-api-windows-amd64.exe,jokes-api-windows-arm64.exe - BSD:
jokes-api-freebsd-amd64,jokes-api-freebsd-arm64
The application auto-creates configuration on first run:
- Root users:
/etc/apimgr/jokes/server.yaml - Regular users:
~/.config/apimgr/jokes/server.yaml
server:
host: "0.0.0.0" # Bind address
port: 64321 # Port (random 64xxx by default)
rate_limit: 2000 # Requests per hour per IP# Start the server
./jokes-api
# Show help
./jokes-api --help
# Show version
./jokes-api --version
# Check status (no root required)
./jokes-api --status
# Custom port
./jokes-api --port 8080
# Custom address
./jokes-api --address 127.0.0.1
# Custom data directory
./jokes-api --data /path/to/datasudo systemctl status jokes-api
sudo systemctl start jokes-api
sudo systemctl stop jokes-api
sudo systemctl restart jokes-api
sudo journalctl -u jokes-api -fsudo launchctl list | grep jokes
sudo launchctl unload /Library/LaunchDaemons/com.apimgr.jokes.plist
sudo launchctl load /Library/LaunchDaemons/com.apimgr.jokes.plist
tail -f /usr/local/var/log/apimgr/jokes/stdout.logGet-Service -Name JokesAPI
Start-Service -Name JokesAPI
Stop-Service -Name JokesAPI
Restart-Service -Name JokesAPI# Get a random joke
curl http://localhost:64321/api/v1/jokes/random
# Get 5 random jokes
curl http://localhost:64321/api/v1/jokes/random/5
# Get joke by ID
curl http://localhost:64321/api/v1/jokes/1
# Get jokes from specific category
curl "http://localhost:64321/api/v1/jokes/random?limitTo=[nerdy]"
# Exclude explicit content
curl "http://localhost:64321/api/v1/jokes/random?exclude=explicit"
# Replace names
curl "http://localhost:64321/api/v1/jokes/random?firstName=John&lastName=Doe"
# Get all categories
curl http://localhost:64321/api/v1/jokes/categories
# Get statistics
curl http://localhost:64321/api/v1/jokes/count
# Health check
curl http://localhost:64321/healthzAccess GraphQL Playground at: http://localhost:64321/graphql
Example query:
query {
randomJoke(limitTo: "[nerdy]", exclude: "explicit") {
id
joke
categories
}
stats {
total
categories {
name
count
}
}
}Interactive API documentation: http://localhost:64321/swagger
| Category | Count | Description |
|---|---|---|
| animal | 670 | Animal-related humor |
| chuck-norris | 593 | Classic Chuck Norris jokes |
| nerdy | 554 | Programming and tech jokes |
| food | 515 | Food and cooking humor |
| movie | 510 | Film and entertainment |
| sports | 380 | Athletic and sports jokes |
| explicit | 360 | Adult humor |
| history | 340 | Historical references |
| work | 340 | Office and workplace |
| travel | 180 | Travel and tourism |
| general | 158 | General humor |
| medical | 120 | Healthcare jokes |
| lawyer | 120 | Legal profession humor |
| school | 120 | Education jokes |
| science | 120 | Scientific humor |
| music | 80 | Musical references |
All API responses use a consistent wrapper:
{
"type": "success|error",
"value": <data or error message>
}- Go 1.21 or higher
- Git
- Make (optional, for build automation)
# Clone repository
git clone https://github.com/apimgr/jokes.git
cd jokes
# Download dependencies
go mod download
# Build for your platform
go build -o jokes-api .
# Or use Make to build for all platforms
make build# Run with live reload (requires air)
go install github.com/cosmtrek/air@latest
air
# Or run directly
go run main.go# Run tests
make test
# Or use go test directly
go test -v ./...# Build image
make docker
# Or use docker directly
docker build -t jokes-api .jokes/
├── main.go # Application entry point
├── go.mod # Go dependencies
├── Makefile # Build automation
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker compose config
├── Jenkinsfile # CI/CD pipeline
├── src/
│ ├── config/ # Configuration management
│ ├── models/ # Data models
│ ├── handlers/ # HTTP handlers
│ ├── routes/ # Route definitions
│ ├── web/ # Web frontend
│ │ ├── templates/ # HTML templates
│ │ └── static/ # CSS, JS, assets
│ ├── graphql/ # GraphQL schema & resolvers
│ ├── swagger/ # Swagger/OpenAPI spec
│ └── data/ # Jokes data (JSON)
├── scripts/ # Installation scripts
│ ├── install.sh # OS-agnostic installer
│ ├── linux.sh # Linux-specific
│ ├── macos.sh # macOS-specific
│ └── windows.ps1 # Windows-specific
├── README.md # This file
├── SPEC.md # API specification
└── LICENSE.md # MIT License
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
- Use
go fmtfor formatting - Run
go vetfor static analysis - Write tests for new features
- Follow existing code structure
Edit server.yaml and change the port, or specify a different port via CLI:
./jokes-api --port 8080Check logs:
- Linux:
sudo journalctl -u jokes-api -f - macOS:
tail -f /usr/local/var/log/apimgr/jokes/stdout.log - Windows: Check Event Viewer or service logs
Make sure the binary is executable:
chmod +x jokes-apiThe app will create default configuration automatically. If you need a custom location:
./jokes-api --config /path/to/config/dirMIT License - see LICENSE.md for details.
- GitHub Issues: github.com/apimgr/jokes/issues
- Website: jokes.apimgr.us
- Documentation: Full API documentation available at
/docsendpoint
Made with ❤️ by APIMGR | Part of the APIMGR Project