Title here
Summary here
| Concern | Choice |
|---|---|
| Framework | React 19 + React Compiler |
| Bundler | Vite 6 |
| Package manager | Bun (workspace monorepo) |
| Routing | TanStack Router (file-based) |
| Data fetching | TanStack Query v5 |
| Styling | Tailwind CSS v4 |
| Headless UI | Base UI (@base-ui/react) |
| Icons | Phosphor Icons (@phosphor-icons/react) |
| i18n | i18next + react-i18next |
| Type checking | TypeScript 5.7 (strict) |
packages/observer-web/
index.html
vite.config.ts
tsconfig.json
vite-env.d.ts
src/
main.tsx # app bootstrap (Router + Query + i18n)
main.css # Tailwind entry
lib/
api.ts # fetch wrapper (credentials: include, 401 auto-refresh)
i18n.ts # i18next setup
types/
auth.ts # auth DTOs matching backend
stores/
auth.tsx # AuthProvider context + useAuth hook
locales/
ky.json # Kyrgyz Latin (default)
en.json # English
routes/
__root.tsx # root layout (AuthProvider wraps Outlet)
_auth.tsx # public layout — redirects to / if authenticated
_auth/
login.tsx # /login
register.tsx # /register
_app.tsx # protected layout — redirects to /login if not
_app/
index.tsx # / (dashboard stub)just web-install # install dependencies (bun)
just web-dev # start dev server (http://localhost:5173)
just web-build # production build
just web-preview # preview production build@/ alias resolves to src/. Configured in both tsconfig.json and vite.config.ts.
Import order (blank line between groups):
react, react-dom@tanstack/*, @base-ui/*, @phosphor-icons/*, i18next)@/lib/*, @/stores/*, @/types/*)./constants, ./types).module.css) — always lastsrc/routes/. TanStack Router’s Vite plugin auto-generates the route tree._app/ (requires authentication)._auth/ (redirects away if already authenticated).Example:
// src/routes/_app/settings.tsx → /settings (protected)
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_app/settings")({
component: SettingsPage,
});
function SettingsPage() {
return <div>Settings</div>;
}src/locales/ky.json and src/locales/en.json.useTranslation():import { useTranslation } from "react-i18next";
function MyComponent() {
const { t } = useTranslation();
return <p>{t("namespace.key")}</p>;
}Interpolation uses {{variable}} syntax in JSON:
{ "greeting": "Salam, {{name}}" }t("greeting", { name: "Ali" }); // → "Salam, Ali"
| Variable | Default | Description |
|---|---|---|
VITE_API_URL | http://localhost:9000 | Backend API base URL |
Vite only exposes variables prefixed with VITE_.