Skip to content

backend: implement NFC tag payload generation endpoint #35

@ShantKhatri

Description

@ShantKhatri

Summary

Product doc section 5.2 specifies NFC tap support — a physical card or badge sticker programmed with the DevCard link. Add a backend endpoint that generates and returns the correct NDEF payload (NFC Data Exchange Format) for a user's DevCard URL so the mobile app can write it to an NFC tag.

Context

This is a post-MVP feature but the backend work is self-contained and maps to apps/backend/src/routes/ as a new nfc.ts route file.

Tasks

  • create apps/backend/src/routes/nfc.ts.
  • add GET /api/nfc/payload (authenticated) that returns:
    { "type": "URI", "payload": "https://devcard.dev/<username>" }
  • add GET /api/nfc/payload?card=<cardId> variant for context card-specific URLs.
  • validate that cardId (if provided) belongs to the authenticated user.
  • register route in apps/backend/src/app.ts.
  • add tests asserting the correct payload structure and ownership check.
  • document the endpoint in apps/backend/README.md with a note linking to the ndefjs library the mobile team should use on the client side.

Acceptance Criteria

  • endpoint returns correct NDEF-compatible payload.
  • card ownership is validated before returning the card-specific URL.
  • tests pass.

Difficulty

medium — straightforward route design but requires understanding NDEF URI record structure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions