Skip to content

justyn-clark/github-users-app-nextjs-13

Repository files navigation

Overview

This project showcases a robust mobile first web application built using Next.js 13 as the React framework and Tailwind CSS for styling. The combination of Next.js's performance optimization and Tailwind CSS's utility-first approach creates a solid foundation for creating modern web applications. This overview highlights how the project is structured to facilitate a seamless onboarding experience for new developers and ensure code quality.

Key Features

  • Next.js 13: The choice of Next.js as the React framework brings performance benefits, server-side rendering, and simplified routing to the project. This enables faster loading times and improved search engine optimization.

  • Tailwind CSS: The use of Tailwind CSS ensures consistent and efficient styling by leveraging pre-built utility classes. This approach speeds up development and maintains a unified design language.

Developer Tooling

To facilitate an efficient development workflow, the project integrates several essential developer tools:

  • Automatic Code Formatting: Prettier is employed to automatically format code, ensuring consistent code style across the project.

  • Linting: ESLint is configured to catch common code issues and enforce coding standards, promoting clean and maintainable code.

  • Type Checking: TypeScript is adopted to provide static type checking, reducing runtime errors and improving code quality.

  • Pre-Commit Hooks: The project utilizes Husky and lint-staged to enforce linting and testing before code commits, ensuring accountability and preventing low-quality code from entering the repository.

Test Suites

The project includes comprehensive test suites for unit tests and end-to-end (e2e) tests:

  • Unit Tests: Jest is used for unit testing, covering individual components, utility functions, and API helpers. This ensures each piece of the application works as expected in isolation.

  • End-to-End (E2E) Tests: Cypress is employed for e2e testing, focusing on simulating user interactions and verifying the application's behavior as a whole. E2E tests cover critical user flows and ensure that the application's functionality is cohesive and reliable.

Application Structure

The application consists of two main pages: the Home Page and the User Detail Page. These pages are built using reusable UI components to promote modularity and reusability. Data fetching is handled at the page level, improving component isolation and simplifying maintenance.

  • ArrowLeftIcon.tsx: Represents a custom arrow icon used for navigation or indicating back actions.
  • Boundary.tsx: Handles 404s for non pages.
  • DetailsHeader.tsx: Renders the header section for the User Detail Page, displaying essential user information.
  • Followers.tsx: Renders the list of followers for a specific user, showcasing their avatars and usernames.
  • Header.tsx: Represents the header component that is common to both pages, providing navigation and other options.
  • Image.tsx: A reusable component that renders an image with options like width, height, alt text, and priority for lazy loading.
  • Organizations.tsx: Displays the list of organizations the user is associated with, using their avatars and names.
  • Repos.tsx: Renders the list of repositories owned by the user, showing repository names and descriptions.
  • SkeletonCard.tsx: Renders the loader used in Suspense.
  • UserList.tsx: Represents the user list component used on the Home Page to display GitHub users with their avatars and usernames.

Onboarding and Contribution

This setup provides an ideal environment for new developers to contribute effectively:

  • Clear Project Structure: The separation of pages, components, tests, and configuration files ensures newcomers can quickly navigate the codebase.

  • Developer Tools: The integrated developer tools foster good coding practices and offer immediate feedback, helping developers catch errors early.

  • Comprehensive Testing: Robust test suites empower developers to confidently make changes without introducing regressions.

  • Automatic Formatting and Linting: The tooling takes care of code formatting and linting, reducing cognitive overhead and enabling focus on writing quality code.

  • Type Safety: TypeScript enforces type correctness, making the codebase more maintainable and minimizing potential bugs.

In summary, this project sets a high standard for new developers by providing an organized, well-tested, and developer-friendly codebase. The adoption of Next.js, Tailwind CSS, and essential developer tools creates a strong foundation for creating and maintaining a consistent and high-quality web application. Tradeoffs Made: During the implementation, some tradeoffs were made:

  1. Rate Limit: Considering the rate limit on the public GitHub API, it was decided to either mock the API response or use a personal access token to fetch the API. This decision impacts the actual number of API calls made during development and testing.

  2. Reusability: To achieve reusability, components were designed to be modular and follow the principle of proper separation of concerns. Reusable components were created for rendering user avatars and user information.

  3. Error Handling: Error handling was implemented to handle cases like 404s or other API errors. However, further enhancement can be made to improve error handling for a more user-friendly experience.

Potential Extensions:

Given more time, the project can be extended in several ways:

  1. Pagination: Implement pagination to handle a larger number of users and repos efficiently.

  2. Sorting and Filtering: Add sorting and filtering options on the Home Page to allow users to find specific GitHub users easily.

  3. Caching and Optimizations: Implement caching mechanisms to reduce API calls and optimize the application's performance.

  4. User Authentication: Incorporate user authentication to increase the rate limit and provide access to user-specific data.

  5. Scalability: Plan for potential growth and scalability by considering state management solutions like Zustand or a Postgres Database.

Conclusion:

The implemented project provides a solid foundation for displaying GitHub user information and can be extended to offer additional features and improve overall usability. The use of reusable components, adherence to modern development practices, and proper error handling demonstrate the beginnings of a system that will make future engineering efforts easier. As the project evolves, the consideration of mobile responsiveness, ease of creating detail pages, and handling error cases will further enhance its usability and maintainability.

About

An application that uses the public Github API to render Github users and display information about their account.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published