This document provides a technical specification of the nextarter-tailwind template. It outlines the architectural decisions, core concepts, and invariants that govern the repository.
Modern web development requires a balance between rapid prototyping and maintainable architecture. nextarter-tailwind solves the "cold start" problem for Next.js projects by providing a pre-configured environment with:
- Strict linting and formatting (Biome).
- Scalable component architecture (Lib-delegation).
- Performance-first tooling (Turbo).
- Type-safe development (TypeScript).
- This is NOT a component library (though it encourages adding one like shadcn/ui).
- This is NOT a state management framework.
- This is NOT a backend starter.
The project follows a Modified App Router Architecture. While it uses Next.js App Router for routing and server-side features, the actual UI implementation is decoupled into a src/lib directory.
graph TD
subgraph "Entry Layer (Next.js App Router)"
A[src/app/layout.tsx] --> B[src/app/page.tsx]
B --> C[src/app/api/... optional]
end
subgraph "Implementation Layer (Library)"
B --> D[src/lib/pages]
A --> E[src/lib/layout]
D --> F[src/lib/components]
E --> F
D --> G[src/lib/styles]
E --> G
end
subgraph "Infrastructure"
H[Biome]
I[Turbo]
J[Husky/Commitlint]
end
| Module | Responsibility |
|---|---|
src/app |
Routing, Metadata, Viewport, and entry-point exports. |
src/lib/pages |
Page-specific UI logic and internal components. |
src/lib/layout |
Global UI shell, including Header, Footer, and Providers. |
src/lib/components |
Shared, reusable UI components (e.g., ThemeToggle). |
src/lib/styles |
Global CSS via Tailwind v4, font configurations, and utility functions. |
sequenceDiagram
participant U as User
participant N as Next.js Server
participant R as App Router (src/app)
participant L as Layout Shell (src/lib/layout)
participant P as Page Content (src/lib/pages)
U->>N: GET /
N->>R: Resolve path to app/page.tsx
R->>L: Wrap with src/lib/layout/index.tsx
L->>P: Render src/lib/pages/home/index.tsx
P-->>L: Return JSX
L-->>R: Return Root Layout + Content
R-->>U: Deliver SSR/Buffered HTML
To keep the app directory lean and focused on routing:
- Rule:
src/app/page.tsxSHOULD ONLY import and export a component fromsrc/lib/pages. - Rule: Global providers and layout wrappers MUST reside in
src/lib/layout.
- Tailwind CSS v4: Uses the latest JIT engine.
- Theme Management: Powered by
next-themeswith aThemeProviderin the root layout. - FOUC Prevention:
suppressHydrationWarningon<html>and server-side theme detection.
- Standard: Biome is used for ALL linting and formatting, replacing ESLint and Prettier.
- Convention: Filenames must follow
kebab-case.
- Strict Versioning: Uses highly specific (and sometimes experimental) versions of Node.js and Next.js as defined in
package.json. - File Size: Initial bundle is extremely small but grows with
libimplementation. - No Default Exports: Biome enforces
noDefaultExportby default, except for specific entry points where Next.js requires them.