Skip to content
Closed
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
65 changes: 65 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

This project (Hye Ararat) is a web app that allows users to manage system/app containers and VMs. It is built on Next.js and drives the Incus API.

## Build, Lint, and Format Commands

```bash
# Install dependencies
bun install

# Development server
bun run dev

# Production build
bun run build

# Start production server
bun run start

# Lint the codebase
bun run lint

# Format code with Prettier
bun run format

# Check formatting without modifying files
bun run format:check
```

## Folder Structure

- Files are in the nearest shared parent of all consumers.
Expand Down Expand Up @@ -42,3 +67,43 @@ When creating new API functionality, follow this structure based on the highest-
- Tailwind CSS for the frontend
- shadcn/ui based components in `app/_components/ui`
- swr for data fetching
- zod for schema validation
- react-hook-form for form management

## Data Fetching Patterns

### API Functions

Use the `jsonFetcher` utility from `app/_lib/fetcher.ts` for all Incus API calls:

```typescript
import { jsonFetcher } from '@/app/_lib/fetcher';

export async function getResource() {
return jsonFetcher('/1.0/resource').then(
(data) => data.metadata as ResourceType,
);
}
```

### SWR Hooks

Create custom hooks using SWR for data fetching with caching:

```typescript
import useSWR from 'swr';
import { getResource } from '../_lib/resource';

export function useResource() {
return useSWR('/1.0/resource', getResource);
}
```

## Coding Conventions

- Use TypeScript for all new files
- Define types in separate `.d.ts` files alongside implementation files
- Use single quotes for strings (enforced by Prettier)
- Use semicolons (enforced by Prettier)
- Prefer named exports over default exports for API functions and hooks
- Use `@/` path alias for imports from the `app` directory
Loading