A simple, fast, and lightweight REST API for anime quotes. Built with Go, providing random anime quotes from a curated collection.
- Fast and lightweight API built with Go
- Random anime quote endpoint
- Get all quotes endpoint
- Health check endpoint
- Docker support with multi-architecture images
- No external dependencies required
GET /api/v1/randomReturns a random anime quote.
Response:
{
"anime": "Fullmetal Alchemist",
"character": "Edward Elric",
"quote": "A lesson without pain is meaningless."
}GET /api/v1/quotesReturns all anime quotes in the database.
Response:
[
{
"anime": "Bleach",
"character": "Ichigo Kurosaki",
"quote": "I'm not a hero. I'm just a guy who's good at fighting."
},
...
]GET /api/v1/healthReturns the service health status.
Response:
{
"status": "healthy",
"timestamp": "2024-10-14T16:00:00Z",
"totalQuotes": 5000
}-
Download the latest binary for your platform from the releases page
-
Make it executable (Linux/macOS):
chmod +x anime-linux-amd64- Run the server:
./anime-linux-amd64 --port 8080PORT- Server port (default: 8080)ADDRESS- Server bind address (default: 0.0.0.0)
docker-compose up -dThe API will be available at http://172.17.0.1:64180
# Build dev image first
make docker-dev
# Run with test compose
docker-compose -f docker-compose.test.yml upThe API will be available at http://localhost:64181
docker run -d \
-p 8080:80 \
--name anime \
ghcr.io/apimgr/anime:latest- Go 1.23 or later
- Make (optional, for build automation)
- Docker (optional, for containerization)
Makefile Targets:
make build- Build binaries for all 8 platforms (Linux, Windows, macOS, FreeBSD - amd64/arm64)make test- Run tests with coveragemake clean- Clean build artifactsmake docker- Build and push multi-platform Docker images to ghcr.iomake docker-dev- Build Docker image for local developmentmake test-docker- Test with Docker using docker-compose.test.ymlmake test-incus- Test with Incus container (alternative to Docker)
Platforms Supported:
- linux-amd64, linux-arm64
- windows-amd64, windows-arm64
- macos-amd64, macos-arm64
- freebsd-amd64, freebsd-arm64
Version Management:
- Version stored in
release.txt(format:0.0.1without "v" prefix) - Build:
make buildreads version, doesn't modify it - Release: Manual update of
release.txtwhen ready for new version
Run with development flags:
./anime --dev --port 8080GitHub Actions:
- Automated builds on push to main
- Monthly scheduled builds (1st of month)
- Multi-platform binary releases
- Docker images pushed to ghcr.io/apimgr/anime
Jenkins:
- Multi-architecture pipeline (amd64, arm64)
- Server: jenkins.casjay.cc
- Parallel builds and tests
- Docker manifest creation for multi-arch support
# Clone the repository
git clone https://github.com/apimgr/anime.git
cd anime
# Download dependencies
go mod download
# Build binary
make build
# Or build manually
go build -o anime ./src# Using make
make build
./anime --port 8080
# Or directly with go run
go run ./src --port 8080# Run tests
make test
# Or manually
go test -v ./...Available make targets:
make build- Build binaries for all platformsmake test- Run tests with coveragemake clean- Clean build artifactsmake docker- Build and push multi-platform Docker imagesmake docker-dev- Build Docker image for local developmentmake all- Run tests and build (default)
anime/
├── src/
│ ├── data/
│ │ └── anime.json # Quote database
│ ├── anime/
│ │ └── service.go # Quote service logic
│ ├── server/
│ │ └── server.go # HTTP server and handlers
│ └── main.go # Application entry point
├── Dockerfile # Container definition
├── docker-compose.yml # Production compose
├── docker-compose.test.yml # Development compose
├── Makefile # Build automation
├── go.mod # Go dependencies
└── README.md # This file
# Get a random quote
curl http://localhost:8080/api/v1/random
# Get all quotes
curl http://localhost:8080/api/v1/quotes
# Health check
curl http://localhost:8080/api/v1/healthMIT License - See LICENSE.md for details
Anime quotes sourced from various anime series and compiled for educational and entertainment purposes.