A command-line interface (CLI) tool built in Go that fetches and displays movie information from The Movie Database (TMDB) API. Get quick access to popular, top-rated, upcoming, and now playing movies right from your terminal.
- Fetch different categories of movies:
- Now Playing
- Popular Movies
- Top Rated Movies
- Upcoming Movies
- Clean terminal output with formatted movie details
- Error handling for API and network issues
- Configurable via environment variables
- Simple and intuitive command-line interface
- Go 1.16 or higher
- TMDB Bearer Token (Get it here)
- Clone the repository:
git clone https://github.com/yourusername/tmdb-app.git
cd tmdb-app- Set up your TMDB Bearer Token:
export TMDB_BEARER_TOKEN='your-bearer-token-here'- Build the application:
make buildThe CLI tool supports the following commands:
# Get now playing movies
./bin/tmdb-app --type "playing"
# Get popular movies
./bin/tmdb-app --type "popular"
# Get top rated movies
./bin/tmdb-app --type "top"
# Get upcoming movies
./bin/tmdb-app --type "upcoming".
├── cmd/
│ └── tmdb-app/
│ └── main.go
├── internal/
│ ├── api/
│ │ ├── client.go
│ │ └── models.go
│ ├── config/
│ │ └── config.go
│ └── cli/
│ └── app.go
├── pkg/
│ └── formatter/
│ └── formatter.go
├── go.mod
├── Makefile
└── README.md
cmd/: Contains the main application entry pointsinternal/: Private application codeapi/: TMDB API client and data modelsconfig/: Configuration managementcli/: CLI application logic
pkg/: Public packages that can be used by external applicationsformatter/: Output formatting utilities
# Build the application
make build
# Run tests
make test
# Run the application directly
make run- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Movie List:
====================================
Title: Gladiator II (2024-11-05)
Rating: 6.8/10 (1979 votes)
Popularity: 4782.6
Overview:
Years after witnessing the death of the revered hero Maximus...
------------------------------------
Title: Your Fault (2024-12-26)
Rating: 7.1/10 (641 votes)
Popularity: 4279.1
Overview:
The love between Noah and Nick seems unwavering...
------------------------------------
Total movies shown: 20
The application uses environment variables for configuration:
| Variable | Description | Required |
|---|---|---|
| TMDB_BEARER_TOKEN | Your TMDB API Bearer Token | Yes |
The application handles various error cases:
- Invalid movie types
- API authentication failures
- Network connectivity issues
- Rate limiting
- Invalid responses
This project uses the TMDB API v3. For more information about the API, visit:
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- The Movie Database (TMDB) for providing the API
- The Go community for the amazing tooling and libraries
Your Name - @letsmakecakes_
Project Link: https://github.com/letsmakecakes/tmdb-cli