[KongchangAI]
· 2 min read· 1,137 words

Next.js 16.1 in Practice: Building the Frontend of an AI Event Booking App

Next.js 16.1 in Practice: Building the Frontend of an AI Event Booking App

Using an AI event booking platform as an example, demonstrating the complete workflow of a new Next.js project from initialization to style customization.

Based on a Bilibili tutorial, the article walks through creating a Next.js 16.1.0 project with `npx create-next-app@latest` and turning it into a business foundation: configuration choices (TypeScript, ESLint/Biome, React Compiler, Tailwind CSS, src directory, App Router); using tabs to organize requirements, implementation, and docs; fixing the first-visit body error via the official prompt attribute; clearing page.tsx and globals.css and verifying styling with a Tailwind class; switching fonts from Geist to Montserrat with four weights and unifying weight hierarchy in globals.css. It previews the next section on installing the shadcn component layer and notes that `!important` weight overrides should be replaced with Tailwind utility classes in large projects.

Initialization: The Choices Behind a Single Command

According to the demo by the Bilibili creator, the project was created using the npx create-next-app@latest command, with the app named next-events. The creator did not have the latest version installed locally, and the CLI prompted that Next.js would be installed at version 16.1.0.

Configuration question screen

In the subsequent configuration prompts, the creator provided the following answers: not using the recommended defaults, manually selecting TypeScript, ESLint (or Biome), React Compiler, Tailwind CSS, the src directory, App Router, and declining a custom import alias. This combination essentially corresponds to the "modern standard configuration" for current Next.js projects — TypeScript ensures type safety, App Router is the officially promoted routing solution, and Tailwind eliminates the need for an additional styling setup step.

One easily overlooked point: React Compiler was checked and enabled. Its support for automatic memoization is still evolving; enabling it for a brand-new project is generally fine, but if migrating an existing project, you need to evaluate its impact on the build process.

The difference between App Router and Pages Router: App Router is the new routing paradigm introduced in Next.js 13, organizing routes based on the app directory, using React Server Components by default, and supporting nested layouts, streaming rendering, and parallel routes. Pages Router is the earlier approach based on the pages directory, primarily using client-side rendering and getServerSideProps/getStaticProps for data fetching. The two can coexist in the same project, but new projects typically choose App Router directly, since official documentation and ecosystem components (such as shadcn) have fully shifted to this paradigm.

What is React Compiler: React Compiler is a compile-time optimization tool introduced by the React team that automatically inserts memoization logic into components at build time (similar to auto-generating useMemo/useCallback), reducing the manual optimization burden. It is still in an evolving stage and imposes certain constraints on code style (e.g., requiring components to follow the Rules of React). Enabling it adds an extra compilation step to the build process, so compatibility and build time need to be evaluated when migrating existing projects.

Development Workflow Habits

The creator demonstrated their own approach to organizing browser tabs: the first tab holds the requirements document (requirements.html), the second tab holds the running application, and the third and fourth tabs are reserved for official documentation and third-party sites.

Tab workflow

This habit may seem trivial, but it is very practical for full-stack project development — requirements, implementation, and references remain visible at all times, reducing the cost of switching back and forth. Engineering habits like this often have a greater impact on long-term efficiency than the usage of any specific API.

Cleaning Up the Default Template: Less Is More

After the project starts, npm run dev launches on localhost:3000, but the first visit encounters an error. The creator's approach was to click the error prompt to get the official solution, paste the provided attribute onto the <body> tag in layout.tsx, and the error disappeared immediately.

Fixing the body tag error

Next came the cleanup work: page.tsx was fully selected and cleared, then rewritten as simple Home page text; globals.css kept only the first line of imports, with all other default styles deleted. After cleanup, the creator deliberately added a p-5 Tailwind class to verify that the styling system still worked — the padding applied correctly, confirming that Tailwind was unaffected by the cleanup.

This "delete then immediately verify" approach is worth adopting. Default template styles often intertwine with custom styles; clearing everything at once and then restoring items one by one is much cleaner than overriding them individually.

Font System: Unifying on Montserrat

The project title and description in layout.tsx were updated to next events and the corresponding booking platform description. For fonts, the creator removed the default Geist Sans and Geist Mono and switched to Montserrat, imported via next/font, specifying subsets and variable, and loading four weights: 400, 500, 600, and 700.

Configuring the Montserrat font

Then in globals.css, the base font weight was unified: all elements set to box-sizing: border-box and font-weight: 500; the .bold class uses font-weight: 700 !important; the .semi-bold class uses font-weight: 600 !important. After refreshing, the default font weight on the page was noticeably bolder, matching the design expectations.

There is a trade-off here: directly using !important to override weight classes is sufficient for small projects, but as the project grows, it is better to manage weights using Tailwind's font-medium/font-semibold/font-bold utility classes or theme extensions to avoid conflicts with component library styles.

What next/font does: next/font is Next.js's built-in font loading solution. It self-hosts font files at build time, automatically generates @font-face rules, eliminates layout shift (CLS), and supports preloading optimization by weight and subset. Compared with the traditional Google Fonts <link> approach, next/font produces no additional third-party requests and avoids font flickering. When using it, specify the required character subsets (e.g., latin) via subsets, declare the loaded weights via a weight array, and register the font as a CSS variable (e.g., --font-montserrat) via the variable option, making it easy to reference in Tailwind themes or global styles.

Next Step: The shadcn Component Layer

At the end of the video, the creator previewed that the next section would cover installing and demonstrating shadcn. In the Next.js + Tailwind combination, shadcn provides component source code that can be copied into the project rather than a black-box dependency, which pairs well with the App Router directory structure and is a fairly mainstream UI choice in the community today.

Looking at the whole process, the value of this content is not in any stunning trick, but in breaking down the "from zero to development-ready" process of a standard project into reproducible steps: version confirmation, configuration choices, error handling, template cleanup, style verification, and font unification. For developers new to Next.js, following this order can help avoid a lot of confusion caused by the default template.

One-line Summary

Using an AI event booking platform as an example, demonstrates the complete workflow of a new Next.js project from initialization to style customization.

Paragraph Summary

Based on a Bilibili tutorial, the article walks through the complete steps of creating a Next.js 16.1.0 project with npx create-next-app@latest and transforming it into a business foundation: during configuration, selecting TypeScript, ESLint/Biome, React Compiler, Tailwind CSS, the src directory, and App Router; during development, using tabs to organize requirements, implementation, and documentation; fixing the body error on first visit using the official prompt attribute; then clearing page.tsx and globals.css and verifying the styling system with a Tailwind class; switching fonts from Geist to Montserrat with four weights and unifying weight hierarchy in globals.css. The article ends by previewing the next section on installing the shadcn component layer and reminding that the !important weight override approach should be replaced with Tailwind utility classes in large projects.

#Next.js 16.1#create-next-app#App Router#Tailwind CSS#next/font#Montserrat#shadcn#React Compiler
Share:

Related articles