{"id":50695738,"url":"https://github.com/hngprojects/open-profile-fe","last_synced_at":"2026-06-09T06:08:30.272Z","repository":{"id":357516809,"uuid":"1237238158","full_name":"hngprojects/open-profile-fe","owner":"hngprojects","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-03T12:07:05.000Z","size":10231,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2026-06-03T12:15:12.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/hngprojects.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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-13T02:14:31.000Z","updated_at":"2026-06-03T11:01:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hngprojects/open-profile-fe","commit_stats":null,"previous_names":["hngprojects/open-profile-fe"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hngprojects/open-profile-fe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fopen-profile-fe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fopen-profile-fe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fopen-profile-fe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fopen-profile-fe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hngprojects","download_url":"https://codeload.github.com/hngprojects/open-profile-fe/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fopen-profile-fe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34093840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-09T06:08:29.406Z","updated_at":"2026-06-09T06:08:30.263Z","avatar_url":"https://github.com/hngprojects.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js Starter\n\nNext.js 16 + React 19 + Tailwind v4 + shadcn (radix-maia). Validated env, typed proxy, and the standard set of route conventions wired up.\n\n## Stack\n\n- **Next.js 16** App Router (`proxy.ts`, `forbidden.tsx`, `unauthorized.tsx`)\n- **React 19**, **TypeScript** (strict)\n- **Tailwind v4** with shadcn `radix-maia` style\n- **`@t3-oss/env-nextjs`** + **Zod 4** for build-time env validation\n\n## Getting started\n\n```bash\npnpm install\ncp .env.example .env.local   # fill in values\npnpm dev\n```\n\nOpen \u003chttp://localhost:3000\u003e.\n\n## Scripts\n\n| Command          | What it does                     |\n| ---------------- | -------------------------------- |\n| `pnpm dev`       | Dev server                       |\n| `pnpm build`     | Production build (validates env) |\n| `pnpm start`     | Run the production build         |\n| `pnpm lint`      | ESLint                           |\n| `pnpm typecheck` | `tsc --noEmit`                   |\n\n## Environment variables\n\nSchemas live in [`src/env/`](./src/env), split by side:\n\n- [`src/env/server.ts`](./src/env/server.ts) — server-only vars. t3-env throws at runtime if a client component reads it.\n- [`src/env/client.ts`](./src/env/client.ts) — `NEXT_PUBLIC_*` vars, safe everywhere.\n\nBoth are imported in [`next.config.ts`](./next.config.ts) so the build fails on any malformed value. Set `SKIP_ENV_VALIDATION=1` to bypass (Docker, lint-only CI).\n\n| Var                    | Side   | Required | Notes                                 |\n| ---------------------- | ------ | -------- | ------------------------------------- |\n| `NODE_ENV`             | server | auto     | `development` / `test` / `production` |\n| `API_BASE_URL`         | server | optional | Upstream API for server-side `fetch`  |\n| `API_SECRET`           | server | optional | Bearer token forwarded server-side    |\n| `NEXT_PUBLIC_APP_URL`  | client | optional | Defaults to `http://localhost:3000`   |\n| `NEXT_PUBLIC_APP_NAME` | client | optional | Defaults to `Next Starter`            |\n\nUse it like:\n\n```ts\n// Server code (route handlers, Server Components, Server Actions)\nimport { env } from \"@/env/server\";\n\nawait fetch(`${env.API_BASE_URL}/users`, {\n  headers: { Authorization: `Bearer ${env.API_SECRET}` },\n});\n\n// Client code or shared metadata\nimport { env } from \"@/env/client\";\n\nconsole.log(env.NEXT_PUBLIC_APP_URL);\n```\n\n## Proxy (`src/proxy.ts`)\n\nReplaces the legacy `middleware.ts` (Next.js 16 renamed it). It runs before the cache and:\n\n- Generates an `x-request-id` and forwards it to the request headers + response\n- Sets baseline security headers (`X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy`, `Permissions-Policy`)\n- Skips static assets via the matcher\n\nAdd auth gating, rewrites, or redirects there as needed. Note: `runtime` config is **not** allowed in `proxy.ts` — it always runs on Node.js.\n\n## Route conventions wired up\n\n| File                          | Purpose                                  |\n| ----------------------------- | ---------------------------------------- |\n| `src/app/loading.tsx`         | Root suspense fallback                   |\n| `src/app/error.tsx`           | Client error boundary (`unstable_retry`) |\n| `src/app/not-found.tsx`       | 404 page                                 |\n| `src/app/forbidden.tsx`       | 403 page (calls `forbidden()`)           |\n| `src/app/unauthorized.tsx`    | 401 page (calls `unauthorized()`)        |\n| `src/app/robots.ts`           | `/robots.txt`                            |\n| `src/app/sitemap.ts`          | `/sitemap.xml`                           |\n| `src/app/api/health/route.ts` | Liveness probe at `GET /api/health`      |\n\n`forbidden.tsx` and `unauthorized.tsx` require `experimental.authInterrupts: true`, already enabled in [`next.config.ts`](./next.config.ts).\n\n## API layer (`src/api`)\n\nAll outbound HTTP calls to the backend, their TypeScript types, and **TanStack React Query option objects** belong under [`src/api`](./src/api). Prefer one folder per feature (for example [`src/api/auth/`](./src/api/auth)), with naming like:\n\n| File           | Responsibility                                     |\n| -------------- | -------------------------------------------------- |\n| `*.service.ts` | Thin functions that call `callApi` (or similar)    |\n| `*.type.ts`    | Request/response DTO types                         |\n| `*.options.ts` | `mutationOptions` / `queryOptions` for React Query |\n\nShared helpers (`callApi`, errors, staleness presets) live in [`src/api/base`](./src/api/base). For queries that depend on route params or other inputs, set `enabled` with [`isQueryEnabled`](./src/api/base/base.util.ts) **inside** the corresponding `*.options.ts` factory so components stay dumb.\n\n### Client-side requests\n\nIn **Client Components** (or other browser code), do not call services directly for data that should be cached, deduped, or retried. Use **TanStack React Query** and import the option object from the feature’s `*.options.ts` file.\n\n- **Mutations** — export a **constant** created with `mutationOptions` (no parameters needed for the option itself).\n- **Queries** — export a **function** that returns `queryOptions(...)`, so callers can pass IDs, filters, or other inputs into `queryKey`, `queryFn`, and **`enabled`** (typically via **`isQueryEnabled`** so the query skips until inputs are ready).\n\nExamples:\n\n```tsx\n\"use client\";\n\nimport { useMutation, useQuery } from \"@tanstack/react-query\";\nimport { loginOption, getCurrentUserOption } from \"@/api/auth/auth.options\";\n\n// Mutation: pass the exported option directly\nconst login = useMutation(loginOption);\n\n// Query: invoke the option factory\nconst userQuery = useQuery(getCurrentUserOption());\n```\n\nWhen a query should only run after required inputs exist, encode that in **the options factory**, not at each `useQuery` call site. Use **`isQueryEnabled`** (from [`base.util.ts`](./src/api/base/base.util.ts)): it accepts a string, optional primitive, or a record of param values:\n\n```ts\nimport { fetchUser } from \"@/api/users/user.service\";\nimport { isQueryEnabled } from \"@/api/base/base.util\";\nimport { queryOptions } from \"@tanstack/react-query\";\n\nexport function fetchUserOption(userId: string | undefined) {\n  return queryOptions({\n    queryKey: [\"users\", userId],\n    enabled: isQueryEnabled(userId),\n    // `queryFn` runs only when `enabled` is true\n    queryFn: ({ signal }) =\u003e fetchUser(userId!, { signal }),\n  });\n}\n```\n\n```tsx\n\"use client\";\n\nimport { useQuery } from \"@tanstack/react-query\";\nimport { fetchUserOption } from \"@/api/users/user.options\"; // illustrative\n\ntype Props = { userId: string | undefined };\n\nexport function UserPanel({ userId }: Props) {\n  const query = useQuery(fetchUserOption(userId));\n  // ...\n}\n```\n\nKeep `queryFn` implementations in services (`*.service.ts`); options files wire keys, staleness, `enabled` / `isQueryEnabled`, and `mutationFn` / `queryFn` to those functions.\n\n## Project layout\n\n```\nsrc/\n├── api/                # Backend API: services, types, React Query options\n│   ├── base/           # callApi, shared types/errors, staleness utils\n│   └── auth/           # Example feature slice\n├── app/                # App Router routes \u0026 file conventions\n│   └── api/health/     # Liveness probe\n├── components/ui/      # shadcn components (added via `pnpm dlx shadcn@latest add ...`)\n├── lib/utils.ts        # cn() helper\n├── env/\n│   ├── server.ts       # Server-only env schema\n│   └── client.ts       # NEXT_PUBLIC_* env schema\n└── proxy.ts            # Next.js 16 proxy (formerly middleware)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhngprojects%2Fopen-profile-fe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhngprojects%2Fopen-profile-fe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhngprojects%2Fopen-profile-fe/lists"}