Skip to content

Latest commit

 

History

History
77 lines (60 loc) · 2.52 KB

README.md

File metadata and controls

77 lines (60 loc) · 2.52 KB

Moises

Backend developer application guide

Build a GraphQL API: CRUD and Caching

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.

Get started

Run

npm i
docker compose up

Prerequisites

  • 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)

Functional Prerequisites

  1. 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
  2. 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
  3. PLUS: Write integration tests for resolvers, mutations and cache

How to Share Your Work

When you're ready to share your completed application, follow these steps:

  1. Fork and Commit: Fork this repository and commit your developed code to the new forked repository.
  2. GitHub Repository: Push your forked repository to your GitHub account.
  3. Share the Link: Once your code is on GitHub, share the repository link with us. This will enable us to review your application effectively.