How cnrad/lanyard-profile-readme works
Main components
• Frontend: This includes the primary Next.js pages (src/app/page.tsx and src/app/layout.tsx) and React-based UI components (e.g., src/components/popover.tsx and the card rendering utilities in src/utils/renderCard.tsx).
• Backend/API: The API endpoints under src/app/api (notably, the dynamic API route at src/app/api/[...id]/route.ts) are responsible for processing incoming requests (with various query parameters) and delivering the customizable badge.
• Utility & Library Functions: The project has several utility modules spread across src/lib and src/utils (e.g., handling Discord data types, helper functions, Redis operations in redis.ts, converting data formats, etc.). These provide the necessary logic, data processing, and transformation to construct the badge.
Relationships and interactions
• That the API endpoint processes the incoming URL with query parameters (theme, bg, borderRadius, etc.) and then invokes the rendering logic.
• That utility libraries are used during the processing to convert responses, handle type-checking, interact with possible caching mechanisms (e.g., Redis in src/utils/redis.ts), and generate the final visual card.
• How external requests (to Lanyard/Discord) might augment the data required when rendering the badge.
Architectural patterns and design principles
• Modular Design: Based on the file tree structure, emphasize that components, utilities, and configuration files (Next.js, ESLint, Tailwind, etc.) are isolated modules. This makes the project extensible.
Relevant technologies and frameworks
• Next.js: As the core framework for rendering the application and handling serverless API routes.
• Tailwind CSS: For styling and visual customization of the badge.
• Typescript: Noted by TypeScript configuration files (tsconfig.json) and type definition files (next-env.d.ts).
• External APIs: Lanyard and Discord API interactions.
• Additional developer tools: ESLint, Prettier for code quality, and GitHub Actions for automation (see .github/workflows).
Instructing the principal software engineer
• Interaction point with external services (Lanyard/Discord) where presence data is fetched and possibly cached.
• Link the UI rendering components (React components in src/app and src/components) that are responsible for assembling the badge.