- Next.js 16 App Router project with Tailwind CSS - Plant disease knowledge base (93 diseases, 25 plants) - Image upload with client+server preprocessing - ML inference pipeline with mock/demo fallback - Responsive results page with disease cards and treatment - Full test suite (285 passing tests)
2.8 KiB
2.8 KiB
01. Next.js Project Scaffold, Tailwind CSS, and Directory Structure
meta: id: hyper-specific-plant-disease-id-01 feature: hyper-specific-plant-disease-id priority: P1 depends_on: [] tags: [infrastructure, setup, config]
objective:
- Scaffold a new Next.js 14+ project with App Router, install Tailwind CSS, and establish the standard directory layout so all subsequent tasks have a clean foundation.
deliverables:
/apps/web/— Next.js project with App Router (app/directory)tailwind.config.tsandglobals.csswith custom design tokens- Directory structure for
components/,lib/,api/,data/,public/uploads/,public/models/ - ESLint + Prettier config
- Basic health-check route at
/api/healthreturning{ status: "ok" } vercel.json(initial baseline) and.env.localtemplate
steps:
- Run
npx create-next-app@latestwith TypeScript, App Router, Tailwind CSS, ESLint, and src/ directory enabled. - Configure
tailwind.config.tswith custom colors (leaf-green, soil-brown, warning-amber) and extended spacing scale. - Create
app/globals.csswith Tailwind directives and base typography styles. - Create directory structure:
components/— reusable UI componentslib/— utility functions and shared helperslib/api/— backend API client wrapperslib/ml/— model loading and inference helpersdata/— knowledge base seed JSON filespublic/uploads/— uploaded image storage (gitignored)public/models/— compiled ML model files (git LFS tracked)
- Set up
app/api/health/route.tsreturning{ status: "ok", timestamp }. - Add
.env.localwith placeholder keys (NEXT_PUBLIC_MODEL_PATH=/models). - Create
vercel.jsonwith framework preset and function region config. - Add
.prettierrcand ensure ESLint extends the Next.js recommended config. - Verify the app boots with
npm run devand/api/healthresponds 200.
tests:
- Unit: N/A (scaffold has no logic to unit-test).
- Integration: Hit
/api/health→ expect 200 + JSON withstatus: "ok". - Smoke:
npm run devstarts without crash;npm run buildcompletes.
acceptance_criteria:
npm run devboots and serves at localhost:3000.GET /api/healthreturns 200{ status: "ok" }.- Tailwind custom colors compile and appear in the browser.
- All directories listed in deliverables exist.
npm run buildexits successfully with no errors.
validation:
cd apps/web
npm install
npm run dev &
curl http://localhost:3000/api/health
# → {"status":"ok","timestamp":"..."}
npm run build
# → ✓ Ready in ...ms
notes:
- Use Next.js 14.2+ (stable App Router).
- Do NOT create any page UI yet — that belongs in task 06.
- Keep
node_modulesgitignored; addpublic/uploads/to.gitignoreandpublic/models/tracked via Git LFS.