Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# object-storage-web

React + Vite console for Internxt Object Storage. One app serves five consoles: sub-account, partners, wholesalers,
management, and the legacy one (`/login`, `/buckets`). The account hierarchy is in README.md.

## Commands

- Install: `cp .npmrc.template .npmrc && npm ci`
- Lint: `npm run lint`
- Typecheck: `npx tsc -b`
- Tests (Vitest, a few seconds): `npm test`; one file: `npx vitest run <path>`
- Build: `npm run build`

## Map

- `src/<console>/` for management, partners, wholesalers and sub-account: views, components, services, and
`core/<console>-axios.ts`, the console's own axios instance with its token and 401 handling
- `src/components`, `src/services`, `src/utils`, `src/hooks`: shared by every console; `src/views`: legacy console
- `src/core/config/axios.ts`: the legacy console's axios instance
- `src/services/s3.service.ts`: every S3 call, made with the AWS SDK straight from the browser
- `src/locales/{en,es}`: translations, used by the sub-account console; the other consoles have English text inline
- `src/sub-account/README.md`: Given/When/Then spec of the sub-account console

## Conventions

- No comments that explain what the code does; only a corner-case why that the code can't show. If unsure whether a
comment qualifies, ask instead of writing it.
- A console's services call the API through that console's axios instance, never another console's.
- Services map backend shapes to UI types (`mapDbSubAccount`, `mapPartner`); components get the mapped types.
- Tests sit next to the code as `*.test.ts` and cover services and `core`.
- Customer-facing text never names the storage provider: say "Object Storage Provider".
- A change to the sub-account console keeps `src/sub-account/README.md` true: new behaviour adds its scenario.

## Gotchas

- `npm run dev` needs the internal backend (`s3-server` and `payments-api` from `internxt/local-environment`); without
it nothing past the login page works.
- The wholesalers console only exists with `VITE_ENABLE_WHOLESALER_PANEL=true`.
- The pre-commit hook runs `npm test` and `npm run lint`, so either failing blocks the commit.
28 changes: 28 additions & 0 deletions REVIEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Review guide

## Critical paths

- `src/*/core/*-axios.ts` and `src/*/services/*-auth.service.ts`: tokens, 401 handling and re-authentication. A
mistake logs users out or sends one console's token with another console's requests.
- `src/services/s3.service.ts` and `src/sub-account/services/iamPolicy.service.ts`: they act on customer data and
bucket permissions directly. A wrong policy grants or removes access to buckets.
- Destructive actions (delete or suspend sub-accounts, partners, wholesalers, members, buckets, objects): they must
ask for confirmation and must be unavailable in states that don't allow them.

## Always check

- Comments that explain what the code does: only a corner-case why is allowed.
- When a fetch fails, the view clears the previous data or marks it as stale instead of showing it as current.
- Sub-accounts in Pending deletion or Deleted expose no actions.
- Customer-facing text never names the storage provider.
- Sub-account console changes match `src/sub-account/README.md`, and new behaviour adds its scenario.

## Ignore

- Formatting and anything ESLint or `tsc` already enforce
- `package-lock.json` and coverage output

## Output

Inline comments as `file:line`, plus one top-level summary that starts with `Risk: low | medium | high` and the
reason, based on the critical paths above.
Loading