Skip to main content

Overview

Orphelix follows Next.js 15 App Router conventions with a clear separation of concerns. The project is organized into distinct layers for frontend, backend, data, and utilities.

app/

Next.js App Router pages and API routes

lib/

Reusable utilities, hooks, and business logic

types/

TypeScript type definitions

public/

Static assets (images, logos, fonts)

Directory Structure

Root Level

App Directory (app/)

App Router (app/app/)

Next.js 15 App Router with file-based routing:

API Routes (app/app/api/)

RESTful API endpoints following Next.js conventions:

Library Directory (app/lib/)

Reusable business logic, utilities, and shared code:

Types Directory (app/types/)

TypeScript type definitions:

Public Directory (app/public/)

Static assets served directly:

Test Directory (app/tests/)

End-to-end tests with Playwright:

Unit Tests (app/__tests__/)

Unit tests with Vitest:

Documentation (docs/)

Mintlify documentation:

Configuration Files

Root Configuration

Naming Conventions

Files

Convention: kebab-case.tsxExamples:
  • deployment-card.tsx
  • pod-logs-viewer.tsx
  • namespace-selector.tsx
  • cluster-health-score.tsx
Component Names: PascalCase
Convention: kebab-case.tsExamples:
  • kubernetes-client.ts
  • use-deployments.ts
  • github-auth.ts
  • design-tokens.ts
Exports: camelCase for functions, PascalCase for types/classes
Convention: route.ts in nested directoriesExamples:
  • api/deployments/route.ts → /api/deployments
  • api/deployments/[name]/route.ts → /api/deployments/:name
  • api/pods/[name]/logs/route.ts → /api/pods/:name/logs
Exports: Named exports (GET, POST, PUT, DELETE)
Convention: page.tsx in route directoriesExamples:
  • app/deployments/page.tsx → /deployments
  • app/deployments/[name]/page.tsx → /deployments/:name
  • app/settings/page.tsx → /settings
Exports: Default export
Convention: layout.tsx in route directoriesExamples:
  • app/layout.tsx → Root layout
  • app/deployments/layout.tsx → Deployments layout
Exports: Default export with children prop

Variables & Functions

Convention: camelCaseExamples:
Convention: camelCaseExamples:
React Components: PascalCase
Convention: UPPER_SNAKE_CASEExamples:
Convention: PascalCaseExamples:
Convention: PascalCase for enum, UPPER_SNAKE_CASE for valuesExamples:

Import Conventions

Path Aliases

Configured in tsconfig.json:

Import Order

Recommended order (enforced by ESLint):

Code Organization Best Practices

Component Structure

API Route Structure

Custom Hook Structure

File Size Guidelines

  • Components: < 300 lines
  • Hooks: < 150 lines
  • API Routes: < 200 lines
  • Utilities: < 100 lines per function

When to Split

Split files when:
  • File exceeds recommended limit
  • Multiple unrelated concerns in one file
  • Code becomes hard to navigate
  • Too many exports from single file
Example Refactoring:

Next Steps

Architecture

System architecture overview

Getting Started

Set up development environment

Testing

Testing strategy and examples

Contributing

Contribution guidelines