Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lekoarts/gatsby-source-tmdb
🎬 Source from The Movie Database (TMDb) in Gatsby
https://github.com/lekoarts/gatsby-source-tmdb
api gatsby gatsby-source source-plugin themoviedatabase themoviedb tmdb
Last synced: 12 days ago
JSON representation
🎬 Source from The Movie Database (TMDb) in Gatsby
- Host: GitHub
- URL: https://github.com/lekoarts/gatsby-source-tmdb
- Owner: LekoArts
- License: mit
- Created: 2018-12-01T16:23:44.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-08-27T14:06:23.000Z (about 1 year ago)
- Last Synced: 2024-10-25T10:19:08.754Z (19 days ago)
- Topics: api, gatsby, gatsby-source, source-plugin, themoviedatabase, themoviedb, tmdb
- Language: TypeScript
- Homepage: https://tmdb.lekoarts.de
- Size: 3.93 MB
- Stars: 57
- Watchers: 4
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# gatsby-source-tmdb
Source from [The Movie Database (TMDb)](https://www.themoviedb.org/) API (v3) in Gatsby. You can leverage any endpoint from the [official documentation](https://developers.themoviedb.org/3/getting-started/introduction) and pull the data directly into Gatsby's GraphQL data layer. Customize the plugin to your needs by providing customized endpoints -- read more about that in the [advanced configuration](https://github.com/LekoArts/gatsby-source-tmdb/tree/main/package/README.md#advanced-configuration) section.
You can see a **live preview** at [tmdb.lekoarts.de](https://tmdb.lekoarts.de) ([Source Code](https://github.com/LekoArts/gatsby-source-tmdb/tree/main/example)).
Create your own website with [gatsby-starter-tmdb](https://github.com/LekoArts/gatsby-starter-tmdb).
## Install
```shell
npm install gatsby-source-tmdb
```### Prerequisites
You'll need an `API Key` and `Session ID` from TMDb.
1. [Create your API key](https://developers.themoviedb.org/3/getting-started/introduction)
1. [Generate a Session ID](https://developers.themoviedb.org/3/authentication/how-do-i-generate-a-session-id)**Recommendation:** Save both values inside an `.env` file as environment variables. [Read more about env vars in Gatsby](https://www.gatsbyjs.com/docs/how-to/local-development/environment-variables/).
You can find all information on the API endpoints in the [official TMDb v3 documentation](https://developers.themoviedb.org/3/getting-started/introduction).
### Configure
Add the plugin to your `gatsby-config.js`
```js:title=gatsby-config.js
require("dotenv").config()module.exports = {
plugins: [
{
resolve: "gatsby-source-tmdb",
options: {
apiKey: process.env.API_KEY,
sessionID: process.env.SESSION_ID,
}
}
]
}
```The plugin is **not** requesting all available endpoints by default but only a [selected list](https://github.com/LekoArts/gatsby-source-tmdb/blob/main/package/src/endpoints.ts) of endpoints. It always requests the `/account` & `/configuration` endpoint. Please see the [plugin's README](https://github.com/LekoArts/gatsby-source-tmdb/blob/main/package/README.md) for more detailed information, including options & advanced customization.
## Acknowledgements
- [moviedb-promise](https://github.com/grantholle/moviedb-promise) was used for v1 of this plugin and has been really helpful/inspirational when creating v2. Thanks!
## Support Me
Thanks for using this project! I'm always interested in seeing what people do with my projects, so don't hesitate to tag me on [Twitter](https://twitter.com/lekoarts_de) and share the project with me.
Please star this project, share it on Social Media or consider supporting me on [Patreon](https://www.patreon.com/lekoarts) or [GitHub Sponsor](https://github.com/sponsors/LekoArts)!