Welcome to the guide for applying as a backend developer! In this document, you'll find instructions on how to build a GraphQL API with essential features like CRUD operations and caching.
Run
npm i
docker compose up
- Use knex to query builder
- Use Redis for caching (add to docker-compose)
- Use Apollo sandbox to run queries (leave queries organized so we can run them live)
-
We expect all resolvers to be implemented (use pre-defined types on schema.graphql to guide)
- Define resolvers to query for user (sorted playlists by name)
- Define resolvers to query for songs (sorted by name)
- Define resolvers to query for playlists (sorted by name)
- Define mutation to add/remove song
- Define mutation to add/remove playlist
- Define mutation to add/remove song from playlist
- Define mutation to update user
-
Implement a Cache-Aside strategy
-
Lazy Loading: The query User should be fully cached through Lazy Loading (Implement availability with cache hit and cache miss)
- Ensure the cache invalidation when changes occur in user email only
- E.g., query User
query Query($userId: ID!) { user(id: $userId) { id email name playlists { id name songs { id name } } songs { id name } } }
-
Write Through - reverse the order of how the cache is populated (only after lazy loading)
- Should change the cache first and then the Postgres, apply on the following mutations:
- add / remove songs for a user
- add / remove songs for a playlist
- add / remove playlists for a user
- Keep cache lists sorted
- Should change the cache first and then the Postgres, apply on the following mutations:
-
-
PLUS: Write integration tests for resolvers, mutations and cache
When you're ready to share your completed application, follow these steps:
- Fork and Commit: Fork this repository and commit your developed code to the new forked repository.
- GitHub Repository: Push your forked repository to your GitHub account.
- Share the Link: Once your code is on GitHub, share the repository link with us. This will enable us to review your application effectively.