{"id":27841387,"url":"https://github.com/tvatdci/effect-params-context-reduce","last_synced_at":"2026-04-05T08:33:04.082Z","repository":{"id":290635475,"uuid":"879589316","full_name":"TVATDCI/effect-params-context-reduce","owner":"TVATDCI","description":"React User Management with Context API, useReducer \u0026 Axios A mini-project demonstrating how to fetch and manage user data in a React app using React Router, useContext, useReducer, and Axios. This project includes user list and details pages, global state management, and API integration.","archived":false,"fork":false,"pushed_at":"2026-02-17T20:23:30.000Z","size":508,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-18T01:28:06.121Z","etag":null,"topics":["api-integration","axios","front-end-development","javascript","react","react-router","state-management","styled-components","usecontext","useeff","usereducer","usest","vite"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TVATDCI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-28T07:36:48.000Z","updated_at":"2026-02-17T20:14:06.000Z","dependencies_parsed_at":"2025-05-03T04:59:22.446Z","dependency_job_id":"467abbde-b9cc-458c-8224-5cdb90fe8bcd","html_url":"https://github.com/TVATDCI/effect-params-context-reduce","commit_stats":null,"previous_names":["tvatdci/effect-params-context-reduce"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TVATDCI/effect-params-context-reduce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Feffect-params-context-reduce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Feffect-params-context-reduce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Feffect-params-context-reduce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Feffect-params-context-reduce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TVATDCI","download_url":"https://codeload.github.com/TVATDCI/effect-params-context-reduce/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TVATDCI%2Feffect-params-context-reduce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31430009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T08:13:15.228Z","status":"ssl_error","status_checked_at":"2026-04-05T08:13:11.839Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-integration","axios","front-end-development","javascript","react","react-router","state-management","styled-components","usecontext","useeff","usereducer","usest","vite"],"created_at":"2025-05-03T04:59:18.231Z","updated_at":"2026-04-05T08:33:04.074Z","avatar_url":"https://github.com/TVATDCI.png","language":"JavaScript","readme":"# Project: Mini User Management App\n\n## Project Overview\n\nA React-based application demonstrating best practices in routing, state management, and component organization. This project was refactored from a student codebase to implement modern patterns including Tailwind CSS v4, API service layer, error boundaries, and mock authentication.\n\n---\n\n## Repository Branches\n\n| Branch                        | Description                                |\n| ----------------------------- | ------------------------------------------ |\n| `feature/initiative-codebase` | Original student code (before refactoring) |\n| `feature/update`              | Refactored code with modern patterns       |\n\n---\n\n## Features\n\n- **User List Page**: Displays a list of users fetched from an API with loading and error states\n- **User Details Page**: Shows detailed information about a selected user (protected route)\n- **Global State Management**: Uses `useContext` and `useReducer` for user state\n- **Lazy Loading**: React's `lazy` and `Suspense` for better performance\n- **Centralized Routing**: Route paths managed in `routes-paths.js`\n- **API Service Layer**: Axios instance with interceptors for clean API calls\n- **Error Handling**: ErrorBoundary component and ErrorMessage UI\n- **Loading States**: Loading component with spinner\n- **Mock Authentication**: Login/Logout flow with protected routes\n- **Tailwind CSS v4**: Modern utility-first styling with custom theme\n\n---\n\n## Tech Stack\n\n| Technology       | Version | Purpose               |\n| ---------------- | ------- | --------------------- |\n| React            | ^19.2.0 | UI Framework          |\n| React Router DOM | ^7.9.6  | Client-side routing   |\n| Axios            | ^1.13.5 | HTTP requests         |\n| Tailwind CSS     | ^4.0.0  | Styling               |\n| PropTypes        | ^15.8.1 | Runtime type checking |\n| Vite             | ^6.2.0  | Build tool            |\n| ESLint           | ^9.22.0 | Linting               |\n\n---\n\n## API Used\n\nUser data is fetched from: [https://jsonplaceholder.typicode.com/users](https://jsonplaceholder.typicode.com/users)\n\n---\n\n## Project Structure\n\n```bash\n/src\n├── /components\n│   ├── /common\n│   │   ├── ErrorBoundary.jsx    # Catches React errors\n│   │   ├── ErrorMessage.jsx     # Error display component\n│   │   └── Loading.jsx          # Loading spinner\n│   ├── UserList.jsx             # User list with API call\n│   └── UserProfile.jsx          # User profile display\n├── /context\n│   ├── AuthContext.jsx          # Authentication state\n│   └── UserContext.jsx          # User data state\n├── /pages\n│   ├── Home.jsx                 # Home page with UserList\n│   ├── Login.jsx                # Mock login page\n│   └── UserDetails.jsx          # User details (protected)\n├── /reducers\n│   └── userReducer.js           # User state reducer\n├── /services\n│   ├── api.js                   # Axios instance\n│   └── userService.js           # User API methods\n├── /assets\n│   ├── d-skull.svg\n│   └── spacecharter.svg\n├── App.jsx                      # Main app with providers\n├── AppRoutes.jsx                # Route definitions\n├── Layout.jsx                   # Layout with header/nav\n├── NotFound.jsx                 # 404 page\n├── ProtectedRoute.jsx           # Route guard component\n├── routes-paths.js              # Route constants\n├── index.css                    # Tailwind CSS config\n└── main.jsx                     # Entry point\n```\n\n---\n\n## Key Concepts Demonstrated\n\n### `useParams`\n\nExtracts URL parameters (user ID) in the UserDetails component.\n\n### `useContext`\n\nProvides global state via UserContext and AuthContext.\n\n### `useReducer`\n\nManages complex user state with actions: `SET_USERS`, `SET_SELECTED_USER`, `SET_LOADING`, `SET_ERROR`.\n\n### `useEffect`\n\nHandles side effects like API calls on component mount.\n\n### API Service Layer\n\nSeparates API logic from components using `services/api.js` and `services/userService.js`.\n\n### Error Boundary\n\nClass component that catches JavaScript errors in child components.\n\n### Protected Routes\n\n`ProtectedRoute` component checks authentication before rendering children.\n\n---\n\n## How to Run\n\n```bash\n# Clone the repository\ngit clone https://github.com/TVATDCI/effect-params-context-reduce.git\ncd effect-params-context-reduce\n\n# Install dependencies\nnpm install\n\n# Start development server\nnpm run dev\n\n# Open in browser\nhttp://localhost:5173/effect-params-context-reduce/\n```\n\n---\n\n## Usage\n\n1. **Home Page**: View list of users from API\n2. **Login**: Click \"Login\" button, enter any username/password\n3. **User Details**: After login, click a user name to see details\n4. **Logout**: Click \"Logout\" to end session\n\n---\n\n## Refactoring Summary\n\nThis project was refactored from a student codebase. See [`plans/refactoring-plan.md`](plans/refactoring-plan.md) for detailed changes.\n\n### Issues Fixed\n\n- Router duplication between `main.jsx` and `App.jsx`\n- Missing return statement in reducer default case\n- Incorrect asset import paths\n- No error handling UI\n- No loading states\n- Unused imports and console.log statements\n\n### Improvements Added\n\n- API service layer with Axios interceptors\n- ErrorBoundary for graceful error handling\n- Loading and ErrorMessage components\n- Mock authentication with protected routes\n- Tailwind CSS v4 with custom theme\n- PropTypes for runtime type checking\n\n---\n\n## Future Enhancements\n\n- [ ] Add unit tests with Vitest\n- [ ] Implement real authentication (JWT/OAuth)\n- [ ] Add user search/filter functionality\n- [ ] Implement user pagination\n- [ ] Add more pages (About, Contact, Settings)\n\n---\n\n## Contributing\n\nContributions are welcome! Please fork the repository and submit a pull request.\n\n---\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file.\n\n---\n\n## Acknowledgments\n\n- [React Router](https://reactrouter.com/) for client-side routing\n- [Axios](https://axios-http.com/) for API requests\n- [Tailwind CSS](https://tailwindcss.com/) for styling\n- [JSONPlaceholder](https://jsonplaceholder.typicode.com/) for the test API\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvatdci%2Feffect-params-context-reduce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftvatdci%2Feffect-params-context-reduce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvatdci%2Feffect-params-context-reduce/lists"}