{
+ const response = await fetch(`${API_URL}/products`);
+
+ if (!response.ok) {
+ throw new Error("Failed to load products.");
+ }
+
+ return response.json();
+}
+```
+
+Do not scatter backend URLs throughout pages and components.
+
+Keep HTTP concerns away from presentation components when possible.
+
+---
+
+# Server and Client Boundaries
+
+Be deliberate about the boundary between server and client code.
+
+Server-side code may handle:
+
+- server-side data loading
+- secure environment variables
+- server-only APIs
+- protected backend communication
+- route handlers
+- server actions when appropriate
+
+Client-side code may handle:
+
+- interaction
+- browser APIs
+- local UI state
+- Redux
+- event listeners
+- client-only libraries
+
+Never expose secrets to Client Components.
+
+---
+
+# Environment Variables
+
+Do not access environment variables randomly throughout the project.
+
+Centralize configuration when useful.
+
+Example:
+
+```text
+config/env.ts
+```
+
+Never expose secrets using:
+
+```text
+NEXT_PUBLIC_*
+```
+
+Only values intentionally accessible in the browser should use `NEXT_PUBLIC_`.
+
+---
+
+# Error Handling
+
+Use Next.js error boundaries where appropriate.
+
+Examples:
+
+```text
+error.tsx
+not-found.tsx
+```
+
+Handle expected failures explicitly.
+
+Do not silently swallow errors.
+
+Provide user-friendly messages for recoverable failures.
+
+Log technical information where appropriate without exposing sensitive data to end users.
+
+---
+
+# Loading States
+
+Use:
+
+```text
+loading.tsx
+```
+
+when route-level loading UI is appropriate.
+
+For local interactive operations, use explicit loading state.
+
+Avoid blocking unrelated parts of the UI unnecessarily.
+
+---
+
+# State Derived from Existing State
+
+Do not duplicate values that can be calculated.
+
+Bad:
+
+```ts
+const [firstName, setFirstName] = useState("");
+const [lastName, setLastName] = useState("");
+const [fullName, setFullName] = useState("");
+```
+
+Prefer:
+
+```ts
+const fullName = `${firstName} ${lastName}`;
+```
+
+Keep state minimal.
+
+---
+
+# useEffect
+
+Do not use `useEffect` to calculate values that can be derived during rendering.
+
+Use `useEffect` primarily for synchronizing with external systems.
+
+Examples:
+
+- WebSocket
+- browser APIs
+- subscriptions
+- external widgets
+- timers
+- event listeners
+
+Always clean up resources when required.
+
+---
+
+# Avoid Deep Nesting
+
+Prefer guard clauses and early returns.
+
+Bad:
+
+```ts
+if (session) {
+ if (session.user) {
+ if (session.user.active) {
+ // logic
+ }
+ }
+}
+```
+
+Prefer:
+
+```ts
+if (!session?.user) return;
+if (!session.user.active) return;
+
+// Main logic
+```
+
+Keep the happy path visible.
+
+---
+
+# Avoid Magic Values
+
+Bad:
+
+```ts
+if (status === 4) {
+}
+```
+
+Prefer:
+
+```ts
+if (status === MachineStatus.Offline) {
+}
+```
+
+Bad:
+
+```ts
+if (retryCount > 3) {
+}
+```
+
+Prefer:
+
+```ts
+const MAX_RETRY_COUNT = 3;
+
+if (retryCount > MAX_RETRY_COUNT) {
+}
+```
+
+Use descriptive constants where they improve understanding.
+
+---
+
+# Naming
+
+Names should explain intent.
+
+Prefer:
+
+```ts
+selectedProduct
+currentUser
+isMachineOnline
+canEditSale
+hasAdminPermission
+shouldReloadProducts
+```
+
+Avoid vague names such as:
+
+```ts
+data
+info
+item2
+temp
+res2
+obj
+value1
+stuff
+```
+
+unless the surrounding context makes the meaning completely obvious.
+
+---
+
+# TypeScript and JavaScript
+
+JavaScript and TypeScript may coexist.
+
+Prefer TypeScript for new important logic where practical.
+
+Do not perform unnecessary project-wide TypeScript migrations during unrelated work.
+
+Avoid `any` where useful types can be defined.
+
+Keep feature-specific types close to their feature.
+
+Use global/shared types only when genuinely shared.
+
+---
+
+# Tailwind CSS
+
+Use Tailwind CSS for styling.
+
+Keep styles close to components.
+
+Avoid creating excessive abstraction only to hide Tailwind classes.
+
+If a visual pattern is reused meaningfully, extract a reusable component.
+
+Maintain readable class structures.
+
+Avoid unnecessarily complex conditional class expressions.
+
+---
+
+# Testing
+
+Tests are required for meaningful behavior.
+
+Use:
+
+```text
+Vitest
+React Testing Library
+Playwright
+```
+
+Use Vitest for:
+
+- utilities
+- business logic
+- selectors
+- reducers
+- non-UI modules
+
+Use React Testing Library for:
+
+- interactive components
+- forms
+- user behavior
+- conditional rendering
+
+Use Playwright for critical user flows.
+
+Examples:
+
+```text
+login
+logout
+create product
+edit machine
+view report
+critical dashboard navigation
+```
+
+Test behavior rather than implementation details.
+
+---
+
+# Comments
+
+All project comments must be written in English.
+
+Use comments to explain:
+
+- intent
+- business rules
+- important decisions
+- limitations
+- unusual behavior
+- non-obvious workarounds
+
+Do not use excessive comments for obvious code.
+
+Important functions should have short English documentation comments.
+
+---
+
+# File Organization
+
+Keep related code close together.
+
+Avoid giant generic folders containing hundreds of unrelated files.
+
+Bad:
+
+```text
+components/
+ ProductCard
+ LoginForm
+ SalesChart
+ MachineStatus
+ UserAvatar
+ ReportFilter
+ ...
+```
+
+Prefer:
+
+```text
+features/products/components/
+features/auth/components/
+features/sales/components/
+features/machines/components/
+```
+
+Use global component directories only for truly shared components.
+
+---
+
+# Refactoring Rules
+
+When refactoring an existing Next.js project:
+
+1. First understand the existing behavior.
+2. Preserve functionality unless a behavior change is requested.
+3. Identify duplicated logic.
+4. Identify large pages and components.
+5. Identify unclear naming.
+6. Identify unnecessary Client Components.
+7. Identify unnecessary `useEffect` usage.
+8. Identify duplicated state.
+9. Identify business logic buried in JSX.
+10. Identify API calls scattered across UI code.
+11. Refactor incrementally.
+12. Add or update tests.
+13. Remove dead code when safe.
+14. Do not rewrite working code only to match a theoretical architecture.
+15. Do not introduce unnecessary layers.
+16. Keep the final result understandable to junior developers.
+
+---
+
+# New Features
+
+When implementing a feature:
+
+1. Find or create the correct feature directory.
+2. Reuse existing shared components.
+3. Keep the page thin.
+4. Prefer Server Components by default.
+5. Create Client Components only where needed.
+6. Put API communication into a service when it improves separation.
+7. Keep Redux only for meaningful shared client state.
+8. Keep business rules testable.
+9. Add appropriate tests.
+10. Keep names explicit.
+11. Avoid introducing abstractions before they are needed.
+
+---
+
+# New Projects
+
+For a new Next.js project:
+
+- use App Router
+- use Tailwind CSS
+- configure Redux Toolkit
+- configure Vitest
+- configure React Testing Library
+- configure Playwright
+- configure linting
+- establish useful path aliases
+- create only necessary directories
+- keep Server Components as the default
+- create a clear README
+- avoid empty architecture folders
+- avoid unnecessary dependencies
+
+---
+
+# Junior-Friendly Development Rules
+
+Always ask:
+
+"Can a junior developer understand this file without knowing hidden architectural conventions?"
+
+Prefer explicit code.
+
+Prefer:
+
+```ts
+const product = await getProduct(productId);
+
+if (!product) {
+ return null;
+}
+
+return product;
+```
+
+over clever compressed expressions.
+
+Avoid:
+
+- excessive abstractions
+- unnecessary generics
+- complex type tricks
+- deeply nested callbacks
+- deeply nested conditions
+- complicated ternaries
+- hidden side effects
+- unnecessary factories
+- unnecessary inheritance
+- excessive indirection
+- premature reusable frameworks
+
+A small amount of duplication is better than a confusing abstraction.
+
+Refactor duplication when a clear reusable concept actually emerges.
+
+---
+
+# Final Decision Rule
+
+When multiple implementations are valid, prefer the one that is:
+
+1. simplest
+2. easiest to read
+3. easiest to test
+4. easiest to debug
+5. easiest to extend
+6. easiest for a junior developer to understand
+
+Do not optimize for impressive architecture.
+
+Optimize for clarity, predictability, and maintainability.
\ No newline at end of file
diff --git a/Next.js Frontend Architecture Guide.md b/Next.js Frontend Architecture Guide.md
deleted file mode 100644
index 6bb4c38..0000000
--- a/Next.js Frontend Architecture Guide.md
+++ /dev/null
@@ -1,599 +0,0 @@
-# Next.js Frontend Architecture Guide
-
-## Objective
-
-This document defines the architecture rules for this Next.js project.
-
-Before implementing new features, refactoring existing code, or creating new modules, read and follow this architecture.
-
-The goal is to create a scalable, production-ready frontend suitable for a professional development team.
-
----
-
-# Technology Stack
-
-The project must use:
-
-- Next.js (App Router)
-- React
-- TypeScript
-- Redux Toolkit
-- Axios
-- Tailwind CSS
-- Ant Design
-
-Do not introduce alternative frameworks or libraries unless explicitly requested.
-
----
-
-# Architecture Pattern
-
-Use:
-
-## Feature-Based Architecture
-
-Organize code around business features, not technical file types.
-
-Avoid:
-
-```
-src/
-
-components/
-pages/
-services/
-utils/
-```
-
-as the main structure.
-
-Use:
-
-```
-src/
-
-├── app/
-│ ├── (routes)/
-│ ├── api/
-│ ├── providers/
-│ ├── layout.tsx
-│ ├── loading.tsx
-│ ├── error.tsx
-│ └── globals.css
-│
-├── features/
-│ ├── auth/
-│ ├── users/
-│ ├── products/
-│ ├── companies/
-│ └── ...
-│
-├── components/
-│ ├── ui/
-│ ├── common/
-│ └── layouts/
-│
-├── services/
-│ ├── api/
-│ ├── storage/
-│ └── websocket/
-│
-├── store/
-│
-├── hooks/
-│
-├── lib/
-│
-├── types/
-│
-├── utils/
-│
-└── config/
-```
-
----
-
-# Next.js App Router Rules
-
-Use Next.js App Router.
-
-Routes must be created using:
-
-```
-app/
-```
-
-Example:
-
-```
-app/dashboard/page.tsx
-```
-
-creates:
-
-```
-/dashboard
-```
-
-Do not use React Router.
-
-Do not manually create routing logic.
-
----
-
-# Server Components vs Client Components
-
-## Default Rule
-
-All components should be Server Components by default.
-
-Example:
-
-```tsx
-export default function UsersPage() {
- return Users
;
-}
-```
-
----
-
-## Client Components
-
-Use Client Components only when required.
-
-Examples:
-
-- useState
-- useEffect
-- Redux hooks
-- Browser APIs
-- Event handlers
-
-Then add:
-
-```tsx
-'use client';
-```
-
-at the top.
-
-Example:
-
-```tsx
-'use client';
-
-export default function LoginForm() {}
-```
-
-Do not add `"use client"` unnecessarily.
-
----
-
-# Feature Structure
-
-Each business feature must be isolated.
-
-Example:
-
-```
-features/auth/
-
-├── api/
-│ └── auth.api.ts
-│
-├── components/
-│ └── LoginForm.tsx
-│
-├── hooks/
-│ └── useLogin.ts
-│
-├── store/
-│ └── auth.slice.ts
-│
-├── schemas/
-│ └── auth.schema.ts
-│
-├── types.ts
-│
-└── index.ts
-```
-
-Example business features:
-
-```
-features/
-
-auth
-users
-companies
-machines
-inventory
-sales
-payments
-reports
-settings
-```
-
----
-
-# Component Architecture
-
-## Shared Components
-
-Reusable components belong here:
-
-```
-components/ui/
-```
-
-Examples:
-
-```
-Button
-Modal
-Input
-Table
-Dropdown
-Form
-```
-
-These components must not contain business logic.
-
----
-
-Business components belong inside features:
-
-Example:
-
-```
-features/products/components/ProductCard.tsx
-```
-
-Not:
-
-```
-components/ProductCard.tsx
-```
-
----
-
-# API Architecture
-
-All API communication must go through Axios.
-
-Never call Axios directly inside components.
-
-Wrong:
-
-```tsx
-function Users() {
- axios.get('/users');
-}
-```
-
-Correct:
-
-```
-Component
-
-↓
-
-Hook
-
-↓
-
-Feature API
-
-↓
-
-Axios Service
-
-↓
-
-Backend API
-```
-
----
-
-Axios configuration:
-
-```
-services/api/
-
-axios.ts
-interceptors.ts
-endpoints.ts
-```
-
-Example:
-
-```ts
-export const api = axios.create({
- baseURL: process.env.NEXT_PUBLIC_API_URL,
-});
-```
-
----
-
-# Redux Toolkit Rules
-
-Redux Toolkit is used only for global client state.
-
-Examples:
-
-- Authentication state
-- User preferences
-- Application settings
-- Global UI state
-
-Structure:
-
-```
-store/
-
-├── index.ts
-├── provider.tsx
-└── slices/
-```
-
-Feature state:
-
-```
-features/auth/store/
-
-auth.slice.ts
-auth.selector.ts
-```
-
----
-
-Do not store everything in Redux.
-
-Use:
-
-```
-useState
-```
-
-for local component state.
-
-Use Redux only for shared application state.
-
----
-
-# Redux Provider in Next.js
-
-Redux Provider must be a Client Component.
-
-Example:
-
-```
-store/provider.tsx
-```
-
-```tsx
-'use client';
-
-import {Provider} from 'react-redux';
-
-export function ReduxProvider({children}) {
- return {children};
-}
-```
-
-Register it in:
-
-```
-app/layout.tsx
-```
-
----
-
-# TypeScript Rules
-
-The project must be strongly typed.
-
-Avoid:
-
-```ts
-any;
-```
-
-Prefer:
-
-```ts
-interface;
-type;
-generics;
-unknown;
-```
-
-Each feature owns its types:
-
-Example:
-
-```
-features/users/types.ts
-```
-
----
-
-# Tailwind CSS Rules
-
-Use Tailwind for:
-
-- Layout
-- Spacing
-- Responsive design
-- Custom styling
-
-Example:
-
-```tsx
-
-```
-
-Avoid unnecessary CSS files.
-
-Global CSS should only contain:
-
-- Variables
-- Theme
-- Global styles
-
----
-
-# Ant Design Rules
-
-Use Ant Design for complex UI components:
-
-Examples:
-
-- Tables
-- Forms
-- Modal
-- DatePicker
-- Dropdown
-- Pagination
-- Notification
-
-Use Tailwind for:
-
-- Layout
-- Positioning
-- Spacing
-- Responsive behavior
-
-Do not rewrite Ant Design components unless required.
-
----
-
-# Data Fetching Rules
-
-Follow this structure:
-
-```
-Page
-
-↓
-
-Feature Component
-
-↓
-
-Custom Hook
-
-↓
-
-API Layer
-
-↓
-
-Axios
-
-↓
-
-Backend
-```
-
-Never put business API logic inside UI components.
-
----
-
-# Dependency Rules
-
-Features should remain independent.
-
-Wrong:
-
-```
-features/products
-
-imports
-
-features/auth
-```
-
-Correct:
-
-```
-features/products
-
-↓
-
-services
-components
-utils
-```
-
-Shared logic belongs in:
-
-```
-components/
-services/
-utils/
-lib/
-```
-
----
-
-# Refactoring Rules
-
-When refactoring an existing project:
-
-1. Analyze the current structure first.
-2. Do not rewrite everything immediately.
-3. Move code gradually into feature folders.
-4. Preserve existing functionality.
-5. Improve:
- - Type safety
- - Separation of concerns
- - API abstraction
- - Component reuse
- - State management
-
----
-
-# Code Quality Rules
-
-Every file should have one responsibility.
-
-Avoid:
-
-```
-User.tsx
-
-- UI
-- API
-- Validation
-- State
-```
-
-Prefer:
-
-```
-UserCard.tsx
-
-user.api.ts
-
-useUser.ts
-
-user.schema.ts
-```
-
----
-
-# Final Architecture Goal
-
-The final project must be:
-
-- Scalable
-- Maintainable
-- Team-friendly
-- Type-safe
-- Easy to test
-- Ready for future features
-
-Always prefer clean architecture over fast implementation.
-
-Before creating code, understand where the code belongs in this architecture.