A simple and elegant REST API for serving inspirational quotes with a web UI.
- Random quote generation via REST API
- 20+ pre-loaded inspirational quotes
- Multiple query options (by ID, category, author)
- Web UI with interactive quote display
- Admin panel with authentication
- SQLite database for settings and admin users
- Docker support with health checks
- Multi-platform binaries (Linux, Windows, macOS, BSD)
# Pull and run the latest image
docker run -d \
--name quotes \
-p 8080:80 \
-v ./data:/data \
ghcr.io/apimgr/quotes:latestAccess the API at http://localhost:8080
# Production deployment
docker-compose up -d
# Development/testing
docker-compose -f docker-compose.test.yml up -d# Download the latest release
wget https://github.com/apimgr/quotes/releases/latest/download/quotes-linux-amd64.tar.gz
# Extract
tar -xzf quotes-linux-amd64.tar.gz
# Run
./quotes --port 8080GET /api/v1/random- Get a random quoteGET /api/v1/quotes- Get all quotesGET /api/v1/quotes/{id}- Get a specific quote by IDGET /api/v1/quotes/category/{category}- Get quotes by categoryGET /api/v1/quotes/author/{author}- Get quotes by authorGET /api/v1/status- Get API status and version
GET /api/v1/admin/settings- Get all settingsPOST /api/v1/admin/settings- Set or update a settingDELETE /api/v1/admin/settings/{key}- Delete a setting
# Get a random quote
curl http://localhost:8080/api/v1/random
# Response
{
"success": true,
"data": {
"id": 1,
"quote": "The only way to do great work is to love what you do.",
"author": "Steve Jobs",
"category": "inspiration"
}
}PORT- Server port (default: 8080)ADDRESS- Server address (default: 0.0.0.0)CONFIG_DIR- Configuration directoryDATA_DIR- Data directoryLOGS_DIR- Logs directoryDB_PATH- Database file pathADMIN_USER- Admin username (first run only)ADMIN_PASSWORD- Admin password (first run only)ADMIN_TOKEN- Admin API token (first run only)
On first run, admin credentials are automatically generated and saved to:
$CONFIG_DIR/admin-credentials.txt
Or set them manually using environment variables.
- Go 1.23 or later
- Make (optional)
# Build for all platforms
make build
# Build for current platform only
go build -o quotes ./src
# Run tests
make test
# Create release artifacts
make release
# Build Docker image (development)
make docker-devquotes/
├── src/
│ ├── data/
│ │ └── quotes.json # Quote data
│ ├── quotes/ # Quote service
│ ├── database/ # Database layer
│ ├── paths/ # OS-specific paths
│ ├── server/ # HTTP server
│ └── main.go # Entry point
├── Dockerfile
├── docker-compose.yml
├── Makefile
└── README.md
Edit src/data/quotes.json and add your quote:
{
"id": 21,
"quote": "Your inspirational quote here",
"author": "Author Name",
"category": "category-name"
}Port: 172.17.0.1:64180:80
Storage: ./volumes/
docker-compose up -dPort: 64181:80
Storage: /tmp/quotes/volumes/
docker-compose -f docker-compose.test.yml up -dAccess the web interface at:
- Home:
http://localhost:8080/ - Admin Panel:
http://localhost:8080/admin
MIT License - see LICENSE.md for details
Created by apimgr