The repository is a monorepo for the VitNode framework, which includes a backend API, frontend documentation site, and shared packages. The codebase uses modern web technologies and follows specific conventions for development based on Next.js 15 and Hono.js 4.
- Do not nest ternary operators,
- Monorepo Structure:
apps/contains main apps (apifor backend,docsfor docs site)packages/holds shared code, core framework, ESLint and Prettier configs, and CLI toolsplugins/for extendable features
- Frontend:
- Next.js 15, App Router, Server Components
- Avoid using
next/navigationdirectly, usevitnode/lib/navigation - Forms: Use
react-hook-form@7, server actions for mutations - UI: Shadcn UI, Tailwind CSS 4, dark/light mode with system detection
- i18n: Use
next-intl,t('key')for translations,getTranslation(server),useTranslation(client) - Accessibility: WCAG 2.1 AA, semantic HTML, ARIA, keyboard/screen reader support
- Backend:
- Hono.js 4, OpenAPI via
@hono/zod-openapi, Zod 4 for validation - Database: PostgreSQL via Drizzle ORM, access via
c.get('database') - API: RESTful, versioned, rate-limited, secure session management
- Error handling: Use Hono's error middleware, log via
c.get('log') - Plugins: Register via
VitNodeAPIconfig, routes auto-mounted by pluginId
- Hono.js 4, OpenAPI via
- Docs:
- Written in
.mdxusing Fumadocs, main entry:apps/docs/content/docs/dev/index.mdx - Use
// [!code ++]to highlight code,// [!code --]to hide - No h1 tags, no emoji in headings
- Written in
- Package Manager: Use
pnpmfor all installs/scripts - Scripts:
pnpm dev(dev server),pnpm build,pnpm lint,pnpm db:migrate,pnpm docker:dev
- CLI:
- Create apps/plugins via
pnpm create vitnode-app@canary(seepackages/create-vitnode-app) - CLI prompts for package manager, app mode, ESLint, Prettier, Docker, install (see
questions.ts)
- Create apps/plugins via
- Linting/Formatting:
- Use configs from
packages/config/ - File names: snake_case, ESModule only
- TypeScript 5 strict mode
- Use configs from
- Testing:
- Use Vitest (see
vitest.config.ts)
- Use Vitest (see
- Config:
- Centralized in
vitnode.config.tsandapi/config.ts - Extend via plugins in config arrays
- Centralized in
- External:
- Next.js, Hono.js, Drizzle ORM, Zod, react-hook-form, Shadcn UI, Tailwind, next-intl
- Internal:
- Navigation, config, API, middleware, plugin system
- Security:
- XSS protection, content security policy, secure cookies
- See
apps/api/src/index.tsfor backend API setup - See
packages/vitnode/src/api/config.tsfor API registration and middleware - See
packages/vitnode/src/lib/navigation.tsfor navigation API - See
apps/docs/next.config.tsfor docs site config
For unclear or missing patterns, ask for clarification or request more examples from maintainers.
If you add new code or change existing code, always verify that everything still works by running each of the following checks:
npm run lintto run the linter.npm run lint:fixto fix any linting issues.npm run testto run the tests.
Complete the task only after all checks pass.