📚 Add AGENTS.md - Project knowledge base

Comprehensive documentation for AI agents:
 Project structure and conventions
 Deployment instructions (Dockerfile + Easypanel)
 Page structure and routing
 Data structure (site-config.ts)
 Styling guidelines (Tailwind + custom classes)
 Image handling and SEO
 Anti-patterns and best practices
 Commands and environment setup

Based on commit 668f690 (ideal Next.js setup)
This commit is contained in:
Kunthawat Greethong
2026-03-10 10:47:35 +07:00
parent 668f69048f
commit 54c7a4407e

124
AGENTS.md
View File

@@ -1,8 +1,8 @@
# DEAL PLUS TECH - PROJECT KNOWLEDGE BASE
**Generated:** 2026-03-01
**Commit:** 13436b4
**Branch:** main
**Generated:** 2026-03-10
**Commit:** 668f690
**Branch:** main
## OVERVIEW
@@ -26,11 +26,11 @@ src/
| Task | Location | Notes |
|------|----------|-------|
| Add/edit pages | `src/app/*/page.tsx` | App Router conventions |
| Add products | `src/data/site-config.ts` | ProductCategory array |
| Add/edit products | `src/data/site-config.ts` | ProductCategory array |
| Add product tables | `src/data/product-tables.ts` | Table data for specs |
| UI components | `src/components/ui/` | Button, Card, Badge |
| Layout | `src/components/layout/` | Header, Footer, FloatingContact |
| Types | `src/types/index.ts` | All interfaces |
| Types | `src/types/index.ts` | All TypeScript interfaces |
| Styling | `src/styles/globals.css` | Custom component classes |
| SEO/Metadata | `src/app/layout.tsx` | Root metadata + schema |
@@ -56,12 +56,38 @@ src/
**Path alias**: `@/*` maps to `./src/*`
## DEPLOYMENT
### Dockerfile (Production)
```dockerfile
# Multi-stage build for Next.js
FROM node:20-alpine AS deps
# ... (see Dockerfile for full config)
```
**Easypanel Configuration:**
- **Build Type:** Dockerfile
- **Dockerfile Path:** `./Dockerfile`
- **Port:** 3000
**To Deploy:**
1. Push to Git main branch
2. Easypanel auto-detects and rebuilds
3. Wait 2-3 minutes for build
4. Site is live
### Alternative: Nixpacks
If Dockerfile build fails, Easypanel can auto-detect and use Nixpacks.
## ANTI-PATTERNS (THIS PROJECT)
- **DO NOT** use `output: 'standalone'` in dev mode (breaks HMR)
- **DO NOT** hardcode contact info - use `siteConfig` from `@/data/site-config`
- **DO NOT** add tests - project has no test infrastructure
- **DO NOT** use `as any` or `@ts-ignore` - strict mode enabled
- **DO NOT** use `as any`, `@ts-ignore`, `@ts-expect-error` - strict mode enabled
- **DO NOT** modify CSS unless necessary - preserve existing design
## UNIQUE STYLES
@@ -88,8 +114,90 @@ npm run lint # ESLint check
## NOTES
- No CI/CD configured - manual deployments
- No CI/CD configured - manual deployments via Easypanel
- Environment variables in `.env.local` (copy from `.env.example`)
- Large data files in `src/data/` - edit with care
- Thai URLs require URL-encoded characters in some contexts
- `public/llm.txt` contains AI-readable content for the site
- `public/llm.txt` contains AI-readable content for the site
## PAGES STRUCTURE
| Route | File | Description |
|-------|------|-------------|
| `/` | `app/page.tsx` | Homepage with hero, featured products |
| `/about-us/` | `app/about-us/page.tsx` | About company |
| `/services/` | `app/services/page.tsx` | Services offered |
| `/products/` | `app/product/page.tsx` | Product listing |
| `/contact-us/` | `app/contact-us/page.tsx` | Contact form & info |
| `/join-us/` | `app/join-us/page.tsx` | Careers/jobs |
| `/sales-engineer/` | `app/sales-engineer/page.tsx` | Sales engineer info |
| `/portfolio/` | `app/portfolio/page.tsx` | Project portfolio |
| `/all-projects/` | `app/all-projects/page.tsx` | FAQ page |
| `/blog/` | `app/blog/page.tsx` | Blog listing |
| `/[slug]/` | `app/[slug]/page.tsx` | Dynamic product pages |
## DATA STRUCTURE
### site-config.ts
```typescript
interface ProductCategory {
id: string;
name: string; // Thai
nameEn: string; // English
slug: string; // Thai URL slug
href: string; // Full URL
description: string;
shortDescription: string;
image: string;
specifications: Array<{label: string; value: string; unit?: string}>;
features: string[];
applications: string[];
faq: Array<{question: string; answer: string}>;
schemaData: {...};
}
```
### Key Config Sections:
- `siteConfig` - Company info, contact details
- `mainNavigation` - Header navigation items
- `productCategories` - All products (20+ items)
- `workHours` - Business hours
- `socialLinks` - Social media links
## IMAGE HANDLING
**Location**: `public/images/`
**Optimization**:
- Next.js Image component auto-converts to AVIF/WebP
- Remote patterns configured for external images
- Sharp required for production builds
**Best Practices**:
- Use `next/image` component
- Always provide `alt` text in Thai
- Specify `width` and `height` to prevent layout shift
## SEO
**Metadata**:
- Thai language meta tags
- Open Graph tags for social sharing
- Twitter Card support
- Structured data (JSON-LD) for LocalBusiness
**Thai URLs**:
- All URLs in Thai language
- URL-encoded where necessary
- Trailing slashes preserved
## BACKUP
Old Next.js project backed up at:
`/Users/kunthawatgreethong/Gitea/dealplustech-backup-nextjs-{DATE}.tar.gz`
---
**Last Updated:** 2026-03-10
**Status:** Production Ready