another step just a little remaining

This commit is contained in:
hamid
2026-06-21 00:05:07 +03:30
parent da42f15a32
commit 3fd147cf80
35 changed files with 4620 additions and 4537 deletions
+36 -18
View File
@@ -1,8 +1,14 @@
# Balinyaar — Web Client
Frontend for the Balinyaar application, built with **Next.js (App Router)**, **React**, **TypeScript**, and **Material UI (MUI)**.
Frontend for **Balinyaar**, a trust-first home-nursing marketplace in Iran. Built with
**Next.js 16 (App Router)**, **React 19**, **TypeScript**, and **Material UI (MUI) v9**.
It ships with a small library of reusable `App*` components, a theming system (light/dark), a lightweight global store, and public/private layouts wired for an authentication flow.
It ships with internationalization (`fa`/`en`, RTL-first), a no-flash light/dark theme system, a small
library of reusable `App*` components, TanStack Query for server state, and public/private layout
shells wired for cookie-based authentication.
> **AI agents:** read [CLAUDE.md](CLAUDE.md) — it is the engineering contract (architecture, providers,
> data fetching, theming, i18n, cookies, and the rules every change must follow).
## Requirements
@@ -38,39 +44,51 @@ It ships with a small library of reusable `App*` components, a theming system (l
npm run dev
```
Open [http://localhost:3000](http://localhost:3000).
Open [http://localhost:3000](http://localhost:3000). The root path redirects to `/fa` (default locale).
## Available scripts
| Script | Description |
| ------------------ | ------------------------------------------------------- |
| `npm run dev` | Start the development server with hot reload |
| `npm run build` | Production build (static export to `out/`) |
| `npm run start` | Serve a production build |
| `npm run lint` | Run ESLint (`eslint-config-next`) |
| `npm run dev` | Start the development server (Turbopack) with hot reload |
| `npm run build` | Production build |
| `npm run start` | Serve a production build |
| `npm run lint` | Lint with ESLint (flat config, `eslint .`) |
| `npm run lint:fix` | Lint and auto-fix |
| `npm run type` | Type-check with `tsc --noEmit` |
| `npm run check` | Type-check **and** lint (the quality gate) |
| `npm run format` | Format the codebase with Prettier |
| `npm test` | Run Jest in watch mode |
| `npm run test:ci` | Run Jest once (CI) |
| `npm run type` | Type-check with `tsc` |
## Project structure
```
src/
├── app/ Next.js App Router routes (home, about, auth, me) + root layout
├── components/ Reusable UI: common App* components (AppButton, AppIcon, ...) + UserInfo
├── hooks/ Custom hooks (auth, layout, events, window size)
├── layout/ PublicLayout / PrivateLayout + TopBar, SideBar, BottomBar
├── store/ Global app store (React context + reducer)
├── theme/ MUI theme provider, light/dark palettes, colors
── utils/ Helpers (storage, navigation, env, text, types)
├── app/[locale]/ App Router routes, grouped into (public-routes) and (private-routes).
│ [locale]/layout.tsx is the ROOT layout (renders <html>/<body>).
├── components/ Reusable UI: common App* components (AppButton, AppIcon, …) + UserInfo
├── constants/ App-wide named constants (routes, headers, …)
├── hooks/ Custom hooks (auth, layout/mobile, events, window size)
├── i18n/ next-intl routing + request config
── layout/ PublicLayout / PrivateLayout + TopBar, SideBar, BottomBar
├── lib/ api (client/server fetch), cookies, query (TanStack), toast
├── services/ Domain services: {domain}/{types,keys,apis,hooks}
├── store/ AppStore (React context + reducer) for client state
├── theme/ ThemeProvider, palettes, tokens.css, typography, direction
└── utils/ Helpers (storage, navigation, env, text, types)
```
The `@/*` import alias maps to `src/*` (see `tsconfig.json`).
Translation files live in [`messages/`](messages) (`en.json` / `fa.json`) and must stay in sync.
> For a deeper, agent-oriented map of conventions and where to make changes, see [AGENTS.md](AGENTS.md).
> For the full agent-oriented map of conventions and where to make changes, see [CLAUDE.md](CLAUDE.md).
## Notes
- `next.config.mjs` uses `output: 'export'`, producing a static site in `out/`.
- Authentication in `src/hooks/auth.ts` and `src/app/auth/login/LoginForm.tsx` is currently a stub (look for `// TODO: AUTH:`); wire it to the backend's JWT endpoints when implementing real auth.
- This is a server-rendered Next.js app (App Router + middleware + server-side cookies) — **not** a
static export.
- Internationalization is locale-prefixed (`/fa`, `/en`); `fa` is the default and is RTL.
- Authentication is cookie-based (`access_token` / `refresh_token`), managed through
`src/lib/cookies/` and the `src/services/auth/` hooks. The API base URL comes from
`NEXT_PUBLIC_API_URL`.