How samiulislamramim/sportigy-arbree works
1. Overall shape
- This is a Next.js 15 + TypeScript scaffold built around a reusable UI/component library rather than a domain-specific backend.
- The repository is organized as a presentation-first frontend: routes live in src/app, while reusable behavior is factored into components, hooks, store, api, and providers.
2. Route layer: App Router entry points
- src/app is the navigation boundary for the app.
- It contains the root layout and app-level states (layout.tsx, loading.tsx, error.tsx, not-found.tsx) plus a home page and an examples section.
- The examples subtree is important: it acts as a demo surface for the reusable form, dialog, and table patterns rather than a business workflow.
3. Page-to-container pattern
- Route files are thin and delegate to container components like home-container.tsx, examples-container.tsx, dialog-container.tsx, form-container.tsx, and table-container.tsx.
- This suggests a boundary where routing concerns stay in app/ and feature composition lives in containers under src/app/... or components/....
4. Reusable UI subsystem
- src/components/ui contains the base design-system primitives: button, input, select, dialog, table, tabs, tooltip, sheet, etc.
- These are the lowest-level visual building blocks, likely shadcn-generated wrappers over Radix-style primitives.
- Higher-level components should be composed from these primitives rather than directly from route code.
5. Common application components
- src/components/common holds app-wide reusable widgets: navbar, app shell, theme toggle, pagination, toast, action button, dialog wrapper, and the dynamic table.
- The fields subtree is a major subsystem: it provides many specialized input controls for forms, including date pickers, uploads, OTP, rich text, multi-select, phone number, range date, and more.
- This makes the repo more of a component toolkit with form-heavy capabilities than a simple page app.
6. Form subsystem
- Form handling is centered in src/forms/react-hook-form, with a custom hook (use-form.hook.ts) and example schema(s).
- src/components/forms/login-form.component.tsx likely demonstrates how react-hook-form integrates with the shared field components.
- The architecture implies a separation between schema/form logic and field rendering widgets.
7. State management boundary
- Global state is managed with zustand under src/store/zustand.
- The included stores (counter.store.ts, user.store.ts) look like example or starter stores, reinforcing that the repo is scaffolded and extensible.
- State usage is likely client-side and localized to components rather than centralized app-wide data orchestration.
8. Data access layer
- src/api/fetch is the API boundary, using the native fetch API rather than a heavier client.
- The presence of client.api.ts and users.api.ts suggests a simple split between shared fetch/client setup and resource-specific endpoints.
- This layer is separate from UI and stores, which keeps remote data access isolated for future expansion.
9. Cross-cutting client hooks
- src/hooks contains generic React hooks for debounce, fetch, intersection observer, local storage, media query, and toggle behavior.
- These hooks are infrastructure for the UI layer, enabling reusable behavior without embedding logic in components.
- Several of them support common frontend concerns like responsiveness, persistence, and async loading.
10. Providers and app-wide context
- src/providers wraps application-level concerns such as theme and toast messaging.
- toast.provider.tsx and theme.provider.tsx indicate that the root app layout likely composes provider boundaries around the page tree.
- This is where the app’s global client context is introduced before route content renders.
11. Styling and utility layer
- tailwind.config.ts, postcss.config.mjs, and src/app/globals.css define the styling pipeline.
- src/lib/utils.util.ts is the shared utility layer, likely used by UI primitives and composition helpers.
- The architecture depends on Tailwind for styling consistency and utility-driven composition.
12. Scripts and repo hygiene
- scripts/cleanup.mjs is a notable maintenance tool: it removes demo/example code when the scaffold is turned into a real product.
- That reinforces the repo’s role as a starter architecture with built-in demo surfaces and a cleanup path.
13. External/runtime boundaries
- The documented runtime stack is purely frontend: Next.js, React, TypeScript, shadcn UI, zustand, react-hook-form, fetch.
- There is no auth subsystem and no dedicated backend service layer in this repo, so the main architecture boundary is between UI/client state and HTTP fetch calls.
14. How data typically flows
- A route renders a page/container, the container composes common and UI components, those components use hooks/providers/store as needed, and remote data is pulled through the fetch API layer.
- Forms flow in the opposite direction: field components feed react-hook-form, which validates via schemas and then submits through UI actions or API calls.
Main entry points: navbar.component.tsx Common widgets · button.component.tsx UI primitives · layout.tsx Root app · cusInputField.component.tsx Field system
Components 25
App Router
Route entry points, layouts, and demo pages.
- Root app · App Router shell and global route boundaries.
src/app/layout.tsx - Home page · Main landing route wired through a thin container.
src/app/page.tsx - Home container · Composes the home surface outside the route file.
src/app/home-container.tsx - Examples area · Demo surface for form, dialog, and table patterns.
src/app/examples/page.tsx - Examples container · Shared container for the examples subtree.
src/app/examples/examples-container.tsx - Form demo · Examples route focused on form composition.
src/app/examples/form/page.tsx - Form container · Container for the form example.
src/app/examples/form/form-container.tsx - Dialog demo · Examples route focused on dialog composition.
src/app/examples/dialog/page.tsx - Dialog container · Container for the dialog example.
src/app/examples/dialog/dialog-container.tsx - Table demo · Examples route focused on table composition.
src/app/examples/table/page.tsx - Table container · Container for the table example.
src/app/examples/table/table-container.tsx
UI System
Reusable components, field widgets, and form compositions.
- UI primitives · Base visual building blocks such as inputs, dialogs, tables, and tabs.
src/components/ui/button.component.tsx - App shell · Global navigation and layout chrome.
src/components/common/app-shell.component.tsx - Common widgets · Reusable app widgets like navbar, pagination, theme toggle, and dialog wrappers.
src/components/common/navbar.component.tsx - Field system · Specialized input controls for complex forms and uploads.
src/components/common/fields/cusInputField.component.tsx - Dynamic table · Higher-level table composition for flexible tabular rendering.
src/components/common/DynamicTable/dynamic-table.component.tsx - Login form · Example form wiring shared fields into a concrete form.
src/components/forms/login-form.component.tsx - RHF runtime · Shared react-hook-form hook and schema layer.
src/forms/react-hook-form/hooks/use-form.hook.ts
Data & State
Fetch layer, hooks, and client-side state management.
- Fetch API · Native fetch boundary and resource-specific API modules.
src/api/fetch/client.api.ts - Zustand store · Global client-side state containers for app examples and local UI state.
src/store/zustand/index.ts - React hooks · Reusable behavior for debounce, fetching, media queries, storage, and observers.
src/hooks/use-fetch.hook.ts
Platform
Styling, providers, shared utilities, and maintenance scripts.
- Providers · Theme and toast context wrappers mounted around the app tree.
src/providers/index.tsx - Shared utils · Common helpers used across components and composition code.
src/lib/utils.util.ts - Styling · Global styling pipeline and app stylesheet.
src/app/globals.css - Cleanup script · Removes demo scaffold code when promoting the starter into a product.
scripts/cleanup.mjs
Connections 24
- Root app → Providers: wraps · Root layout composes application-wide context providers.
- Root app → App shell: uses · Layout-level shell frames route content.
- Root app → Styling: loads · Global stylesheet is applied at app root.
- Home page → Home container: delegates · Route file forwards rendering to the container.
- Examples area → Examples container: delegates · Examples index route delegates to shared container.
- Form demo → Form container: delegates · Form route keeps routing thin.
- Dialog demo → Dialog container: delegates · Dialog route keeps routing thin.
- Table demo → Table container: delegates · Table route keeps routing thin.
- Examples container → Login form: composes · Examples surface showcases the login form composition.
- Form container → Field system: composes · Form demo uses the shared field system.
- Dialog container → Common widgets: composes · Dialog demo uses shared dialog and chrome widgets.
- Table container → Dynamic table: composes · Table demo uses the dynamic table layer.
- Login form → RHF runtime: binds · Concrete form is built on the shared react-hook-form runtime.
- Field system → UI primitives: wraps · Specialized fields are assembled from base UI primitives.
- Common widgets → UI primitives: wraps · Shared widgets are composed from the primitive component set.
- Dynamic table → UI primitives: wraps · Dynamic table builds on the base table primitives.
- App shell → Common widgets: contains · App shell includes shared navigation and chrome widgets.
- Common widgets → React hooks: uses · Widgets rely on reusable client hooks for behavior.
- Field system → React hooks: uses · Field widgets use cross-cutting hooks for input behavior.
- Fetch API → React hooks: used by · Fetching concerns are surfaced through reusable hooks.
- Zustand store → Common widgets: feeds · Client state supports shared interactive widgets.
- Providers → Common widgets: supports · Theme and toast providers back shared UI behavior.
- UI primitives → Shared utils: uses · Primitive components share common helper utilities.
- Cleanup script → Examples area: targets · Cleanup script removes demo/example surfaces.