{post.title}
{post.content}
Build production-ready full-stack web apps with Next.js - SSR, SSG, API routes, and deployment.
0 of 10 concepts completed (0%)
Tutorial Contents
app/
layout.tsx → Root layout (HTML shell, applies to all routes)
page.tsx → Route: /
loading.tsx → Suspense loading state
error.tsx → Error boundary
not-found.tsx → 404 page
about/page.tsx → Route: /about
blog/
page.tsx → Route: /blog
[slug]/page.tsx → Route: /blog/:slug (dynamic)
api/
users/route.ts → API: GET /api/users, POST /api/users
users/[id]/route.ts → API: GET/PATCH/DELETE /api/users/:id// app/layout.tsx
export const metadata = {
title: { default: "My App", template: "%s | My App" },
description: "App description",export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
// Server Component runs on server, direct DB access, no useEffectexport async function generateStaticParams() { const posts = await db.post.findMany({ select: { slug: true } }); return posts.map(post => ({ slug: post.slug })); }
export async function generateMetadata({ params }) { const post = await db.post.findUnique({ where: { slug: params.slug } }); if (!post) return { title: "Not Found" }; return { title: post.title, description: post.excerpt, openGraph: { title: post.title, images: [post.coverImage] } }; }
export default async function BlogPost({ params }) {
const post = await db.post.findUnique({ where: { slug: params.slug } });
if (!post) notFound();
return (
{post.content}{post.title}
// Client Component only when browser APIs or interactivity needed "use client"; import { useState } from "react";
export default function LikeButton({ postId, initialLikes }) { const [likes, setLikes] = useState(initialLikes); return ( ); } ```
// app/api/users/route.tsexport async function GET(request: NextRequest) { const { searchParams } = new URL(request.url); const page = parseInt(searchParams.get("page") ?? "1"); const users = await db.user.findMany({ skip: (page - 1) * 20, take: 20 }); return NextResponse.json({ users }); }
export async function POST(request: NextRequest) { const body = await request.json(); const user = await db.user.create({ data: body }); return NextResponse.json(user, { status: 201 }); }
// Server Action (replaces API routes for mutations) "use server"; import { revalidatePath } from "next/cache";
export async function createPost(formData: FormData) { const title = formData.get("title") as string; await db.post.create({ data: { title } }); revalidatePath("/blog"); // invalidate the blog page cache }
// Use in a form function PostForm() { return (
); } ```// pages/index.js - SSG
export async function getStaticProps() {
const res = await fetch("https://api.example.com/posts");
const posts = await res.json();
return { props: { posts }, revalidate: 60 };
}
export default function Home({ posts }) {
return (
<ul>
{posts.map(post => (
<li key={post.id}>{post.title}</li>
))}
</ul>
);
}
// pages/api/hello.js - API Route
export default function handler(req, res) {
if (req.method === "POST") {
res.status(201).json({ message: "Created" });
} else {
res.status(200).json({ name: "World" });
}
}Explore the official documentation and deepen your knowledge with real-world practice.
Explore the Full Portfolio
This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.
The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.
For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.