|
1 | 1 | # Repository Guidelines |
2 | 2 |
|
3 | 3 | ## Project Structure & Module Organization |
4 | | -The Vite + React app lives in `src/` with `main.tsx` mounting `App.tsx`. Feature-specific UI is grouped under `src/components` (e.g., `create-project`, `deeploys`), while route screens sit in `src/pages`. Shared hooks/utilities are in `src/lib` and `src/shared`, smart-contract adapters in `src/blockchain`, and schema/types in `src/schemas`, `src/data`, and `src/typedefs`. Static assets live in `public/` and `src/assets/`; builds land in `dist/`. |
| 4 | +This is a Next.js App Router project. Routes and layouts live in `app/` (file-based routing via `page.tsx`, `layout.tsx`, `not-found.tsx`, and dynamic segments like `[id]`). The codebase uses route groups for organization, e.g. `app/(public)` and `app/(protected)` (the protected group is gated by `app/(protected)/protected-layout.tsx`). |
| 5 | + |
| 6 | +Most feature UI remains in `src/`: feature-specific components are grouped under `src/components` (e.g., `create-project`, `deeploys`, `tunnels`), shared UI/logic in `src/shared`, hooks/utilities/contexts/providers in `src/lib`, smart-contract adapters in `src/blockchain`, and schema/types in `src/schemas`, `src/data`, and `src/typedefs`. Static assets live in `public/` and `src/assets/`. Next build output is `.next/` (a legacy `dist/` directory may exist from pre-Next builds and should not be treated as the Next build output). |
5 | 7 |
|
6 | 8 | ## Build, Test, and Development Commands |
7 | 9 | Run all commands from the repo root: |
8 | | -- `npm run dev` launches the Vite dev server with HMR. |
9 | | -- `npm run dev:logs` adds verbose Vite diagnostics for debugging config issues. |
10 | | -- `npm run build` type-checks through `tsc -b` then emits a production bundle to `dist/`. |
| 10 | +- `npm run dev` launches the Next.js dev server (`next dev --turbo --experimental-https`). |
| 11 | +- `npm run dev:logs` enables verbose Next.js diagnostics (`NEXT_DEBUG=1 next dev --turbo --experimental-https`). |
| 12 | +- `npm run build` creates a production build (`next build`, outputs to `.next/`). |
| 13 | +- `npm run start` serves the production build locally (`next start`). |
11 | 14 | - `npm run lint` executes ESLint with the project’s React/TypeScript rules. |
12 | | -- `npm run preview` serves the last build for local production smoke tests. |
13 | 15 |
|
14 | 16 | ## Deeploy API Integration |
15 | | -Deeploy workflows talk to the [edge_node](https://github.com/Ratio1/edge_node) API through wrappers in `src/lib/api/deeploy.ts`. Configure the base URL by setting `VITE_API_URL` and `VITE_ENVIRONMENT` in your `.env`; `src/lib/config.ts` routes requests across devnet/testnet/mainnet. Local storage must expose `accessToken`/`refreshToken` to satisfy the Axios interceptors. When working against a local edge node, run its server first, then point `VITE_API_URL` to the exposed port (e.g., `http://localhost:5000`). Mock responses for offline work by stubbing the helpers (`createPipeline`, `getApps`, etc.) instead of bypassing the provider. |
| 17 | +Deeploy workflows talk to the [edge_node](https://github.com/Ratio1/edge_node) API through wrappers in `src/lib/api/deeploy.ts`. Configure the base URL by setting `NEXT_PUBLIC_API_URL` and `NEXT_PUBLIC_ENVIRONMENT` (and optionally `NEXT_PUBLIC_DEV_ADDRESS`) in your env file (prefer `.env.local`); `src/lib/config.ts` routes requests across devnet/testnet/mainnet. Local storage must expose `accessToken`/`refreshToken` to satisfy the Axios interceptors. When working against a local edge node, run its server first, then point `NEXT_PUBLIC_API_URL` to the exposed port (e.g., `http://localhost:5000`). |
| 18 | + |
| 19 | +Because this is Next.js, be mindful of client/server boundaries: modules that access `localStorage` (like `src/lib/api/deeploy.ts`) must only run in client components/hooks (files with `'use client'`) and should not be imported/executed from server components. |
16 | 20 |
|
17 | 21 | ## Coding Style & Naming Conventions |
18 | | -Prettier (`.prettierrc`) enforces four-space indentation, single quotes, semicolons, and Tailwind class sorting—format before committing. Use PascalCase for components, camelCase for functions and state, and kebab-case for feature folders. Respect path aliases from `tsconfig.app.json` (such as `@components/...`) to avoid brittle relative imports. ESLint relaxes certain hook rules; still supply explicit dependency arrays and delete unused code paths. |
| 22 | +Prettier (`.prettierrc`) enforces four-space indentation, single quotes, semicolons, and Tailwind class sorting—format before committing. Use PascalCase for components, camelCase for functions and state, and kebab-case for feature folders. Respect path aliases from `tsconfig.json` (such as `@components/...`) to avoid brittle relative imports. In the `app/` router, add `'use client'` to components that use hooks, browser APIs, or context providers. |
19 | 23 |
|
20 | 24 | ## Testing Guidelines |
21 | 25 | Automated tests are not yet wired into `package.json`. Prefer Vitest plus React Testing Library when adding coverage; place specs alongside source as `*.test.ts(x)` or under `src/__tests__/`. Stub Deeploy API calls and blockchain providers to keep tests deterministic, and document manual QA steps in your PR until the suite matures. |
|
0 commit comments