Skip to content

Public Resource Sharing via Username #27

@Rayan9064

Description

@Rayan9064

Public Resource Sharing via Username

Description

Implement a feature to share resources publicly using usernames. Anyone should be able to access a user's shared links and resources by visiting a URL like /u/{username} or /shared/{username}.

Requirements

  • Create a new page/route (e.g., /u/[username]) that displays all public resources of the specified user.
  • Show user's public collections and resources in a read-only view.
  • Add a search feature on this page to filter/search through the shared resources (by title, tags, notes).
  • Implement client-side caching to avoid repeated DB calls:
    • Cache the fetched resources in local storage or session storage.
    • Use a cache key based on username and last updated timestamp.
    • Set a reasonable TTL (e.g., 5-10 minutes) to balance freshness and cost.
    • Only refetch if cache is stale or user explicitly refreshes.
  • Ensure viewers cannot edit, delete, or modify the shared resources (read-only mode).
  • Handle cases where username doesn't exist (404 page).
  • Add basic SEO/meta tags for shared pages (title, description with username).

Technical Details

  • API endpoint: Extend /api/resources to support fetching public resources by username (e.g., GET /api/resources?username={username}&public=true).
  • Caching: Use SWR or React Query for automatic caching, revalidation, and deduping.
  • UI: Reuse existing resource card components but in read-only mode (no edit/delete buttons).
  • Security: Ensure only public resources are returned; no private data leakage.
  • Performance: Paginate results if user has many resources; implement lazy loading.

Acceptance Criteria

  • URL /u/{username} loads and displays public resources.
  • Search bar filters resources by title/tags/notes.
  • Resources are cached client-side to reduce DB calls.
  • No edit/delete actions visible on shared pages.
  • Proper error handling for invalid usernames.
  • Mobile-responsive design.

Related Files

  • app/api/resources/route.ts (extend GET handler)
  • src/pages/u/[username].tsx (new page component)
  • src/components/SharedDump.tsx (reuse or extend for shared view)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions