How shahadat-hossain99/bloodsync-client works
1. This is a Next.js App Router application, so the architecture is split around route segments in src/app, with page files defining routes and colocated client components handling interactivity. The top-level app shell is in src/app/layout.js, with global styles in src/app/globals.css.
2. The product domain is a blood-donation platform. The main user-facing surfaces are:
- a public marketing/home area,
- public donation request browsing and detail pages,
- authentication pages,
- a role-based dashboard for donors, volunteers, and admins,
- supporting informational pages under resources.
3. The public/home subsystem is composed of reusable sections in src/components/home such as the hero/banner, “how it works”, “why choose us”, contact, and marquee/ticker widgets. These are assembled into the homepage and likely drive the main acquisition flow from awareness into registration or donation-request browsing.
4. The donation-request subsystem is one of the core data flows. It appears in both public and authenticated areas:
- src/app/donation-requests for public listing/detail viewing,
- src/app/dashboard/create-donation-request for creating requests,
- src/app/dashboard/my-donation-requests for user-owned requests,
- src/app/dashboard/edit-donation-request/[id] for editing,
- src/app/dashboard/all-blood-donation-request for broader administrative/ops visibility.
This suggests a shared underlying request model exposed through both public and dashboard experiences.
5. Authentication is a distinct boundary. The app has sign-in/register pages plus a catch-all auth API route at src/app/api/auth/[...all]/route.js. Supporting auth code lives in src/lib/auth.js, src/lib/auth-client.js, src/lib/core/session.js, and src/lib/core/server.js, with src/context/AuthContext.jsx likely propagating the current session/user through the client tree. The presence of unauthorized, forbidden, and role-specific dashboard layouts indicates authorization is enforced both in routing and UI composition.
6. The dashboard is role segmented. There is a shared dashboard shell in src/app/dashboard/layout.jsx plus role-specific sublayouts for admin, donor, and volunteer. Shared dashboard chrome is implemented in src/components/dashboard/DashboardHeader.jsx and DashboardSidebar.jsx, while individual dashboard pages handle role-specific views like profile, requests, and user management.
7. Data access is split between server-side action modules and client-friendly API wrappers. The src/lib/action/* files suggest server actions or server-only business logic for donations, requests, search, and users. In parallel, src/lib/api/* contains API-facing helpers for donation requests and users. This separation implies a backend boundary where pages and client components call into a thin data layer rather than embedding fetching logic directly.
8. Search is a dedicated subsystem (src/app/search plus src/lib/action/search.action.js). That implies cross-entity lookup over at least donation requests and/or users, and it likely feeds the discovery flow for public users and dashboard operators.
9. Geographic metadata is bundled locally in public/geoInfo with districts, divisions, and upazilas JSON files. The hook src/hooks/useGeoData.js probably loads and normalizes this data for forms such as registration, profile, or donation-request creation, making geography selection a client-side data dependency rather than a remote service call.
10. Shared UI and infrastructure components are centralized:
- src/components/shared/Navbar and Footer for the public shell,
- src/components/Breadcrumb.jsx and src/components/seo/ClientMetadata.jsx for navigation/metadata,
- src/lib/imageUpload.js for upload handling,
- src/lib/marquee.js for ticker content.
This keeps presentation concerns separate from route-specific business logic.
11. The app also includes informational/legal pages under src/app/resources plus privacy-policy, terms, and faq, which are isolated content routes rather than part of the transactional dashboard flow.
12. Overall, the main architecture boundary is: public marketing and browsing on one side, authenticated role-based operations on the other, with shared domain services in src/lib and shared UI in src/components. The data model revolves around users, authentication/session state, donation requests, search, and location metadata.
Main entry points: layout.jsx Dashboard shell · donation.action.js Request services · page.js Home · imageUpload.js Media & geo
Components 24
App routes
Next.js App Router surfaces and route segments
- App shell · Global app wrapper and route chrome
src/app/layout.js - Home · Public landing page and acquisition entry
src/app/page.js - Auth pages · Sign-in and registration screens
src/app/auth - Public requests · Browse public donation requests
src/app/donation-requests - Request details · Public donation request detail view
src/app/donation-requests/[id] - Dashboard shell · Shared authenticated dashboard frame
src/app/dashboard/layout.jsx - Admin area · Admin-specific dashboard segment
src/app/dashboard/admin - Donor area · Donor-specific dashboard segment
src/app/dashboard/donor - Volunteer area · Volunteer-specific dashboard segment
src/app/dashboard/volunteer - Request ops · Create, edit, and manage donation requests
src/app/dashboard/create-donation-request - Profile · User profile and account view
src/app/dashboard/profile - Resources · Informational and legal pages
src/app/resources - Search · Cross-entity search surface
src/app/search - Funding · Public funding/donation support page
src/app/funding
Shared UI
Reusable presentation components across routes
- Navbar · Top-level navigation and user menu
src/components/shared/Navbar/Navbar.jsx - Footer · Site-wide footer content
src/components/shared/Footer/Footer.jsx - Dash chrome · Dashboard header and sidebar navigation
src/components/dashboard/DashboardHeader.jsx - Home sections · Hero, benefits, how-it-works, contact, ticker widgets
src/components/home
Domain services
Client/server helpers and cross-cutting business logic
- Auth core · Auth client, session, and server helpers
src/lib/auth.js - Request services · Donation request business logic and API helpers
src/lib/action/donation.action.js - Search service · Search logic over app entities
src/lib/action/search.action.js - User services · User-facing data access and profile helpers
src/lib/action/users.js - Media & geo · Image upload helpers and local geographic metadata
src/lib/imageUpload.js
Local data
Bundled geographic reference data
- Geo JSON · District, division, and upazila reference data
public/geoInfo
Connections 24
- App shell → Navbar: wraps · Global shell renders shared public navigation
- App shell → Footer: wraps · Global shell renders shared footer
- Home → Home sections: assembles · Homepage is composed from reusable marketing sections
- Home → Navbar: uses · Home page shares public navigation
- Home → Footer: uses · Home page shares public footer
- Auth pages → Auth core: uses · Sign-in and registration rely on auth/session helpers
- Public requests → Request services: reads · Public listings are backed by request data services
- Request details → Request services: reads · Detail pages load a single donation request
- Dashboard shell → Dash chrome: wraps · Authenticated dashboard uses shared chrome
- Admin area → Dashboard shell: extends · Admin segment sits under the shared dashboard layout
- Donor area → Dashboard shell: extends · Donor segment sits under the shared dashboard layout
- Volunteer area → Dashboard shell: extends · Volunteer segment sits under the shared dashboard layout
- Request ops → Request services: writes · Create/edit/manage request screens call request actions
- Profile → User services: reads · Profile view uses user data services
- Profile → Media & geo: uses · Profile forms may use upload and location helpers
- Search → Search service: drives · Search page is powered by dedicated search logic
- Resources → Footer: shares · Informational pages use shared site footer
- Funding → Navbar: uses · Funding page shares public navigation
- Request services → User services: relates to · Request workflows connect to user ownership and profile data
- Auth core → User services: supplies identity · Session state feeds user-aware operations
- Media & geo → Geo JSON: loads · Client hooks normalize bundled geography JSON
- Request ops → Media & geo: uses · Request forms rely on media and location support
- Auth pages → Dashboard shell: guards · Authenticated areas depend on role-based access
- Search service → Request services: queries · Search likely spans donation request records