How manish-tamang/portfolio works
Main Components
• Frontend Application: Built using Next.js (located primarily in the app/ directory) with TypeScript and styled using Tailwind CSS.
• API Layer: Located under app/api, this layer contains endpoints for analytics, authentication (via NextAuth and possibly Firebase), Spotify (now-playing, top-artists, top-songs), GitHub, guestbook email, custom views, and WakaTime.
• Content Management: Managed via the Sanity CMS integration. Notice the sanity/ directory (with config files, schemaTypes, and a Studio at app/studio) that drives blog content and possibly other dynamic pages.
• External Integrations:
• Firebase: Handling view tracking, authentication, and guestbook messaging.
• Spotify & WakaTime: Real-time music and coding stats.
• Authentication: Involving NextAuth.js (with support from Firebase) to secure parts like the dashboard.
• Component Library & Reusable UI Elements: Found in components/ (including a dedicated UI folder with various interface components) which suggest a design system being used.
• Utilities & Business Logic: Located in the lib/ folder that abstracts common functions (for blog stats, fetchers, queries, etc.).
• Static Assets: These are stored in public/ and are also built into dist/ during the build process.
• Configuration & Deployment: Look at files like next.config.mjs, tsconfig.json, tailwind.config.ts and deployment configuration for Vercel.
Establish Relationships and Interactions
• User Interface (UI Layer) interacts directly with the Next.js pages in the app/ directory.
• These pages, as well as the various components, call the API endpoints (found under app/api) to fetch dynamic data or perform actions (analytics, auth, data fetching).
• The API routes are responsible for collating data from external services (e.g., Spotify for now-playing data, WakaTime for coding stats, GitHub data, etc.) and from backend services like Firebase.
• The portfolio also leverages a CMS backend via Sanity for the blog, project data, and other content. The Studio (located at /studio) indicates that content can be managed directly through Sanity’s interface.
• Static files and assets (fonts, images, audio, etc.) reside in the public/ folder and are served to the client.
• Utility libraries (from lib/) support the integration of these various data sources in a consistent manner across the application.
• Additionally, authentication flows handled via NextAuth are integrated into the API endpoints (in app/api/auth) and use Firebase for storing user session or analytics data.
Architectural Patterns and Principles
• The project utilizes a “component-based” design pattern (React components) for the frontend.
• An API-first approach is used for fetching dynamic data from external and internal sources.
• Separation of concerns is maintained – distinct folders for pages, API routes, utilities, and CMS configurations.
• Integration of external services is abstracted through dedicated utility modules (e.g., lib/spotify.ts, lib/fetcher.ts) to keep external dependencies decoupled.
Relevant Technologies Highlighted
• Next.js (React) for the frontend web application.
• TypeScript, enhancing code quality and maintainability.
• Tailwind CSS for styling.
• Sanity CMS for content management.
• Firebase for authentication, view counting, and guestbook handling.
• NextAuth.js for supporting secure authentication flows.
• External APIs for Spotify and WakaTime integrations.
• Additional libraries like Framer Motion (for animations), Recharts (for charts), and shadcn/ui (for UI primitives).
• Pages (app/)
• Reusable UI Components (components/)
• Styling (Tailwind CSS)
• “Build/Deployment” aspects with Vercel deployment and configuration files.
• From the frontend to the API.
• From the API to external services (including Firebase, Spotify, etc.).
• From the API and CMS back to the frontend.