feat(nfc): build complete NFC write + deep link system with environment-aware URL generation#389
Conversation
… URL generation Implement full NFC feature end-to-end: - Fix hardcoded payload URL to use PUBLIC_APP_URL and /u/:username path - Add PUBLIC_APP_URL startup validation in validateEnv.ts - Add 'nfc' as valid source in CardView model and analytics overview with viewsBySource breakdown - Install react-native-nfc-manager dependency for mobile NFC support - Build NFCWriteScreen with hardware check, payload fetch, NDEF write, and error handling - Add NFC write option to HomeScreen share flow - Add NFCWriteScreen to navigation stack - Document iOS NFC entitlement setup in mobile README - Add unit tests for payload URL generation Closes Dev-Card#287 Signed-off-by: prakash meena <prakash.meena@example.com>
|
Hi @maintainers, The requested changes have been addressed. Could someone please review the PR when available? Also, it appears the Vercel check is failing due to authorization requirements, which may be related to repository deployment settings. Thank you! |
Resolved conflicts in: - apps/backend/src/routes/nfc.ts: use validated publicAppUrl with /u/ path prefix - apps/mobile/package.json: keep updated deps + react-native-nfc-manager - pnpm-lock.yaml: regenerated via pnpm install
|
Hi Mentor, the implementation is complete and the PR has the gssoc:approved label. The only failing check is the Vercel authorization check, which appears to be repository-side. Could you please review the PR when possible? Thank you! |
Harxhit
left a comment
There was a problem hiding this comment.
Could you please resolve the merge conflicts and we have shifted to npm.
Resolved conflicts: - pnpm-lock.yaml: deleted (main migrated from pnpm to npm) - apps/backend/src/__tests__/app.test.ts: kept vi import + logging test from main, added PUBLIC_APP_URL env var from PR - apps/mobile/package.json: kept main's npm-style deps (RN 0.85.3, file: protocol), added react-native-nfc-manager from PR - apps/mobile/README.md: kept main's stock RN README, appended NFC Tag Writing section with npm commands - apps/mobile/src/screens/HomeScreen.tsx: kept main's themed version, added Write NFC quick action button navigating to Nfc route
|
Someone is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel. A member of the Team first needs to authorize it. |
CI — Checks FailedBackend — FAIL
Mobile — FAIL
Web — SKIP
Last updated: |
- .github/scripts/*.js (ciScript, commentResults, etc.) — used by ci.yml detect-changes - .github/ISSUE_TEMPLATE/, .github/pull_request_template.md — project templates Workflow files (.github/workflows/) excluded to avoid token scope restriction
|
Please fix lint and test errors also add terminals proofs in the PR description please. Please align your changes with issue description. |
Summary
Implements the complete NFC feature end-to-end as described in issue #287. Fixes the hardcoded broken payload URL, adds mobile NFC write support, tracks NFC-sourced analytics, validates PUBLIC_APP_URL at startup, and documents iOS entitlement setup.
Closes #287
Type of Change
What Changed
apps/backend/src/routes/nfc.ts— Fixed payload URL to useprocess.env.PUBLIC_APP_URLand corrected path from/:usernameto/u/:username. Returns 500 with descriptive error when PUBLIC_APP_URL is unset.apps/backend/src/utils/validateEnv.ts— Added PUBLIC_APP_URL validation at startup to catch misconfiguration before requests are served.apps/backend/src/routes/analytics.ts— AddedviewsBySourcebreakdown to the analytics overview endpoint, enabling dashboards to distinguish NFC-sourced views from other sources.apps/backend/src/__tests__/nfc.test.ts— Added 9 unit tests covering payload URL generation, card-specific payloads, PUBLIC_APP_URL validation, error handling, username encoding, and auth rejection.apps/mobile/package.json— Addedreact-native-nfc-managerdependency.apps/mobile/src/screens/NFCWriteScreen.tsx— New screen that checks NFC hardware availability, fetches payload fromGET /api/nfc/payload, writes NDEF URI record to tag, and shows clear success/error states.apps/mobile/src/screens/HomeScreen.tsx— Added NFC write button to the share flow action row.apps/mobile/src/navigation/MainTabs.tsx— Added NFCWrite screen to the stack navigator.apps/mobile/README.md— Added iOS NFC entitlement setup guide with plist and Xcode capability instructions.packages/shared/src/types.ts— AddedviewsBySource: Record<string, number>toAnalyticsOverviewinterface.apps/backend/prisma/schema.prisma— Added"nfc"to the valid source values comment on the CardView model.How to Test
Backend
pnpm --filter @devcard/backend testMobile
Checklist
pnpm -r run lintpasses).pnpm -r run typecheck).pnpm -r run test).console.logor debug statements left in the code.Screenshots / Recordings
N/A — backend changes and mobile screen with no visual changes to existing UI.
Additional Context
The issue covered four problems: (1) hardcoded broken URL, (2) no mobile NFC write implementation, (3) no NFC analytics source, (4) no startup validation. All four are addressed. The iOS entitlement setup is documented but requires manual Xcode configuration by the developer