chore: add ai instruction files * chore: add ai instruction files * let the instruction file apply to all files, not only ts files Approved-by: Linus Flood
2.8 KiB
2.8 KiB
applyTo
| applyTo |
|---|
| {apps/scandic-web/**/*,apps/partner-sas/**/*,apps/scandic-redirect/**/*,packages/**/*} |
Monorepo and Project Overview
OVERVIEW: This is a monorepository managed by [Turborepo] containing Next.js applications and several shared internal packages.
PROJECT STRUCTURE:
/apps/*: Where public-facing applications live./apps/scandic-web: The public-facing site for Scandic Hotels. Displaing cms content from Contentstack, a hotel room booking flow, and user profile management. Hosted on Netlify./apps/partner-sas: A whitelabel version of the Scandic site for SAS customers that mostly relates to booking a hotel room. Hosted on Netlify/apps/scandic-redirect: A service for handling redirects when a url doesn' t match any static content or a page in Contentstack. Hosted on Netlify/apps/redis-api: An api that acts as a http front to Redis due to serveless constraints. Hosted as a container app in Azure.
/packages/*: Where shared code and utilities are stored. They are built withtranspilePackagesso they do not have their own build pipeline/packages/design-system: Shared React/UI components hosted as a Storybook./packages/trpc: Shared trpc routers and logic./packages/tracking: Shared tracking utilities and analytics./packages/booking-flow: The main revenue-generating part where you find booking flow logic and related components.
INSTRUCTIONS FOR GENERATION:
- Shared Code: When generating code that could be reusable (components, hooks, utility functions, types), check the
/packagesdirectory for existing files. If a new, shared piece of logic is needed, generate it within the appropriate/packagessubdirectory. - Imports: All imports from shared packages must use the configured package name (e.g.,
import { Button } from '@repo/ui'). Do not use relative paths to import code between apps and packages. - Dependency Manager: All package installations, script commands, and documentation examples must use Yarn.
- Testing: All unit testing must use Vitest.
Next.js & React Best Practices
FRAMEWORK: Next.js (Use App Router) and React. LANGUAGE: TypeScript with strict mode enabled.
COMPONENTS:
- Default to Server Components: All components in the
/appdirectory are Server Components by default. Only use'use client'when necessary for interactivity (hooks, event handlers, etc.). - Styling: Use Css Modules.
- Immutability: Never mutate props or state directly. Always return new objects or arrays for updates.
- Data Fetching All client-side and server-side data fetching logic should use types and procedures defined in the shared /packages/trpc
FILE NAMING:
- Components:
PascalCase(ProductCard.tsx). - Hooks:
camelCaseand start withuse(useUser.ts).