How tientruongminh/nextjsdemo works
Project type and purpose
• This is a full‑stack e‑commerce “Shop bán hàng đơn giản” demo:
• Frontend: Next.js 14 (React‑based, server‑rendered)
• Backend: Fastify (Node.js web server)
• Database: Prisma (SQLite in dev, can be swapped)
• Key features: user registration/login, CRUD products, basic SEO.
File structure
• Top‑level:
• /client – Next.js app with app‑directory, API routes, components, styling, schema validations
• /server – Fastify app with controllers, routes, plugins, schema validations, Prisma in /prisma
• Root package.json – workspace management, scripts
• Frontend patterns:
• App router (layout, pages under /app)
• Reusable UI in /components/ui, shared logic in /lib and /schemaValidations
• API calls centralized in /apiRequests
• Backend patterns:
• Routes → Controllers → Hooks → Plugins
• Schema validation via fastify validatorCompiler.plugins
• Prisma client in database/index.ts
• JWT auth utilities, error‑handler plugin.
Insights from README
• Confirms tech stack and functional scope: authentication, product management, SEO focus.
Elements
• Clear labels: e.g., “Next.js App”, “Fastify Server”, “Prisma (DB)”
• Page load flow: Browser → Next.js Server → Browser
• Data flow: Browser → Frontend fetch → Backend REST → DB