Description
The current package.json has dependency issues: @typesh/node is misspelled (should be @types/node), and there are no scripts for common development tasks beyond dev/build/start/lint. Additionally, no tools for code generation, API client generation, or contract type generation are configured.
Developer experience gaps:
@typesh/node typo in package.json (will cause install warning/error)
- No
npm run format for Prettier
- No
npm run typecheck for TypeScript
- No
npm run analyze for bundle analysis
- No OpenAPI/client code generation from backend spec
- No contract type generation from Solidity/Rust ABIs
- No
npm run clean for clearing build artifacts
- No
npm run storybook script
- No development proxy configuration for backend API
- No prebuild validation hooks
Technical Context & Impact
- Affected Components/Files:
package.json
- Impact: Developer friction; broken dependencies; missing essential tooling
Step-by-Step Implementation Guide
- Fix package.json errors: Correct
@typesh/node to @types/node in devDependencies
- Add npm scripts:
"format": "prettier --write 'src/**/*.{ts,tsx,css}'",
"format:check": "prettier --check 'src/**/*.{ts,tsx,css}'",
"typecheck": "tsc --noEmit",
"clean": "rm -rf .next node_modules",
"analyze": "ANALYZE=true next build",
"validate": "npm run typecheck && npm run lint && npm test",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"gen:api": "openapi-typescript ../backend/openapi.json -o src/lib/types/api.ts",
"gen:contracts": "soroban contract bindings typescript --output-dir src/lib/contracts/",
"dev:proxy": "concurrently \"next dev\" \"tsx proxy.ts\"",
"postinstall": "husky"
- Add dev dependencies: Install
concurrently, openapi-typescript, prettier, husky
- Configure proxy:
next.config.ts with rewrites for backend API in development:
async rewrites() {
return [
{ source: '/api/:path*', destination: 'http://localhost:3001/api/:path*' }
];
}
- Add contract type generation: Create
scripts/generate-contract-types.ts that reads Soroban contract spec and generates TypeScript types
- Create
.nvmrc: Pin Node.js version (20.x) for consistent development
- Set up VS Code launch.json: Debug configurations for Next.js, tests, and API routes
- Add
package.json validation: Disallow any types in code review checklist
Verification & Testing Steps
- Run
npm install -> verify no warnings or errors
- Run
npm run typecheck -> passes with zero errors
- Run
npm run validate -> lint + typecheck + test all pass
- Run
npx tsc --noEmit -> passes
- Verify API proxy: start backend on 3001 -> start frontend on 3000 -> /api/xxx proxies to 3001
- Run
npm run clean -> verifies .next and node_modules removed
Description
The current
package.jsonhas dependency issues:@typesh/nodeis misspelled (should be@types/node), and there are no scripts for common development tasks beyond dev/build/start/lint. Additionally, no tools for code generation, API client generation, or contract type generation are configured.Developer experience gaps:
@typesh/nodetypo in package.json (will cause install warning/error)npm run formatfor Prettiernpm run typecheckfor TypeScriptnpm run analyzefor bundle analysisnpm run cleanfor clearing build artifactsnpm run storybookscriptTechnical Context & Impact
package.jsonStep-by-Step Implementation Guide
@typesh/nodeto@types/nodein devDependenciesconcurrently,openapi-typescript,prettier,huskynext.config.tswithrewritesfor backend API in development:scripts/generate-contract-types.tsthat reads Soroban contract spec and generates TypeScript types.nvmrc: Pin Node.js version (20.x) for consistent developmentpackage.jsonvalidation: Disallowanytypes in code review checklistVerification & Testing Steps
npm install-> verify no warnings or errorsnpm run typecheck-> passes with zero errorsnpm run validate-> lint + typecheck + test all passnpx tsc --noEmit-> passesnpm run clean-> verifies .next and node_modules removed