How dtran421/portfolio works
Main Components
a. Frontend (Next.js Client Application)
• Pages & Layouts: Under src/app (e.g., main-layout.tsx, blog pages, portfolio, projects, resume, not-found pages)
• Components: In src/components subdivided into functional groups (Blog, Portfolio, Projects, Resume) that build the user interface.
• Styling & Assets: Global CSS (src/styles), Tailwind configuration (tailwind.config.js), and Storybook (for isolated component development in .storybook).
• State & Hooks: Custom React hooks (src/hooks) and context providers (src/contexts) for theme and possibly other states.
b. Backend/API Layer (Next.js API Routes)
• API Routes: Located under src/app/api where you see endpoints for “alphavantage” (for stock market data) and “blog/draft” management.
• GraphQL Integration: Files under src/graphql indicate that some portions of the site, like blog posts, resumes, or timeline data, are queried using GraphQL.
c. Infrastructure & Tools
• Testing & CI/CD: Cypress for end-to-end tests (cypress/) and GitHub Actions workflows (in the .github/workflows folder) for deployment and previews.
• Developer Tools: ESLint, Prettier, Husky pre-commit hooks, and patch files for specific dependencies.
• External APIs/Services: The alphavantage API endpoint suggests integration with third-party financial data. Additionally, some public files (Excel, PDF) are served from the public directory.
Relationships and Interactions
• The Frontend renders pages that fetch data either through Next.js API routes or directly using GraphQL queries.
• API routes serve as an intermediary between the client-side logic and external services (such as alphavantage).
• UI Components (found in src/components) combine with hooks and context to manage state, interactivity, and theme.
• Testing tools (like Cypress) are integrated to simulate user behavior and ensure data flow correctness from frontend to backend.
• GitHub Actions and Husky keep code quality, automated deployment, and code formatting in check.
Architectural Patterns
• Separation of concerns: Distinct separation between page layout (src/app) and re-usable components (src/components).
• Next.js File-based Routing: Clearly distinguishes between public pages and API endpoints.
• Component Isolation: Storybook is used to build and test individual UI components outside the full application.
• Dependency Injection & Context: Use of React Context (src/contexts) and custom hooks to manage shared states across components.
Additional Details
• Use of patches and configuration files (like next.config.js, tsconfig.json, and postcss.config.js) which indicate careful management of both build-time and runtime environments.
• Modules like src/utils and src/hooks that aid in data formatting, API calls, and general utility functions, tying them into the overall data flow.