Next.js Application

Next.js 15+ App Router configured with React 19, Tailwind CSS, and shared packages.

Next.js in Morax

Morax scaffolds Next.js 15+ with the App Router inside the apps/web workspace. It comes pre-configured with React 19, Tailwind CSS v4, Lucide icons, and zero-build symlinks to your shared monorepo packages.

Application Layout

The Next.js app adopts a modular feature structure where business logic is separated from routes:

apps/web Layout
apps/web/
├── src/
│   ├── app/                # Next.js App Router (pages & route handlers)
│   │   ├── layout.tsx      # Root layout with fonts & providers
│   │   ├── page.tsx        # Homepage route
│   │   └── api/            # Serverless route handlers
│   ├── modules/            # Feature-driven modular components
│   │   └── Home/           # Homepage-specific components & sections
│   ├── Shared/             # Cross-cutting UI components (Navbar, Footer, Providers)
│   └── lib/                # Utility helpers (cn, tailwind merge)
├── public/                 # Static assets & icons
└── package.json            # Application dependencies & scripts

Consuming Shared Packages

Because Morax links workspace packages through pnpm symlinks, you can import components from @workspace/ui or shared packages directly with full TypeScript autocomplete:

apps/web/src/app/page.tsx
// apps/web/src/app/page.tsx
import { Button } from '@workspace/ui/components/button';
import { Card, CardHeader, CardTitle, CardContent } from '@workspace/ui/components/card';

export default function Page() {
  return (
    <main className="min-h-screen p-8 bg-black text-white">
      <Card className="max-w-md bg-zinc-900 border-zinc-800">
        <CardHeader>
          <CardTitle>Morax Monorepo</CardTitle>
        </CardHeader>
        <CardContent className="space-y-4">
          <p className="text-sm text-zinc-400">
            Rendered natively via React Server Components with shared UI tokens.
          </p>
          <Button variant="default" className="w-full">
            Get Started
          </Button>
        </CardContent>
      </Card>
    </main>
  );
}

Server & Client Boundaries

All shared packages in Morax are compiled as ES modules. Server Components run purely on the server, while interactive client components require the 'use client' directive at the component boundary.

Route Handlers & Server Actions

For lightweight API routes that need direct database access, you can import your shared database schema and query helpers inside Next.js Route Handlers:

apps/web/src/app/api/health/route.ts
// apps/web/src/app/api/health/route.ts
import { NextResponse } from 'next/server';

export async function GET() {
  return NextResponse.json({
    status: 'ok',
    service: 'web',
    timestamp: new Date().toISOString(),
  });
}