Membership & Join Requests
Relevant source files
The following files were used as context for generating this wiki page:
The Membership & Join Requests system manages the lifecycle of new user registrations and administrative oversight for the Lou Gehrig Fan Club (LGFC). This system encompasses the public-facing join interface, the authentication transition for new members, and the gated administrative tools used to review membership requests.
The primary goal of the system is to maintain a controlled entry point into the authenticated FanClub area (/fanclub/**), ensuring that users provide necessary details such as names, screen names, and email preferences before obtaining access.
Sources: context.md:7-12, src/app/auth/AuthClient.tsx:64-75
Join Request Architecture
The membership process begins with a POST request to the /api/join endpoint. This request captures user data including full name, screen name (alias), and email address. The system splits full names into first and last name components for storage in the database.
Registration Flow
Once a join request is successfully processed, the system immediately attempts to log the user in via the /api/login endpoint. If successful, the user is redirected to the FanClub dashboard. The client-side state is maintained using a lgfc_member_email key in localStorage.
Sources: src/app/auth/AuthClient.tsx:8-13, src/app/auth/AuthClient.tsx:80-108, context.md:21-24
The following sequence diagram illustrates the transition from a guest user to a registered member:
Data Structures
The system uses a standardized JoinRequest object to represent potential members. This structure is used both in the administrative dashboard and the internal API responses.
| Field | Type | Description |
|---|---|---|
id | number | Unique identifier for the request |
name | string | Full name of the applicant |
email | string | Contact email address |
screen_name | string | Public-facing alias used in discussions |
email_opt_in | number | Binary flag (0 or 1) for marketing updates |
presence_status | string | Current status of the request (e.g., pending) |
message | string | Optional message provided during join |
| Sources: src/app/admin/join-requests/page.tsx:7-18, src/app/auth/AuthClient.tsx:64-75 |
Administrative Review
Admin privileges are required to access the join request management interface located at /admin/join-requests. This interface fetches data from /api/admin/join-requests/list and requires a valid lgfc_admin_token stored in the browser's local storage.
Data Normalization
The admin dashboard includes a normalization layer to handle various data formats returned by the API, ensuring fields like id and email_opt_in are correctly typed as numbers and that strings are non-null.
Sources: src/app/admin/join-requests/page.tsx:32-62, src/app/admin/join-requests/page.tsx:82-88
The administrative flow for viewing requests is described below:
Authentication & Session Management
Membership is tightly coupled with the authentication model. While the join process creates a record, actual access to FanClub routes is governed by the presence of a member email in the client session.
- Public Access: Paths like
/,/join, and/loginare accessible to all. - Protected Access: Paths under
/fanclub/**redirect unauthenticated traffic to the homepage. - Role Determination: User roles (e.g., 'admin') are verified via
/api/member/role?email=....
Sources: context.md:21-36
Join UX and Copy Invariants
The system enforces specific UX patterns, such as providing immediate feedback that a request has been received without claiming that a verification code was emailed, as the email updates are sent manually as the club launches.
Sources: lgfc-lite-configure-remaining.sh:22-31, migrations/0027_faq_email_and_seed.sql:16-18
Summary
The Membership & Join Requests module provides the foundational layer for LGFC's community growth. It bridges the gap between public interest and authenticated member participation through a streamlined registration-to-login pipeline and a dedicated administrative audit trail for membership applications.