Create a full-stack Next.js 14 application using the App Router (app/ directory) called 'Focus Ball'. The application aims to help users reduce phone distraction and improve focus by encouraging interaction with a physical object, like a tennis ball. The application should have a multi-page structure and implement a robust backend with a PostgreSQL database managed by Drizzle ORM. Ensure complete CRUD operations for all key entities.
**Database Schema (Drizzle ORM):**
1. **`users` table:**
* `id` (UUID, primary key)
* `email` (text, unique)
* `password` (text) // Hashed password
* `createdAt` (timestamp)
* `updatedAt` (timestamp)
2. **`focusSessions` table:**
* `id` (UUID, primary key)
* `userId` (UUID, foreign key to `users.id`)
* `startTime` (timestamp)
* `endTime` (timestamp)
* `durationMinutes` (integer)
* `notes` (text, optional)
* `createdAt` (timestamp)
3. **`focusSettings` table:**
* `id` (UUID, primary key)
* `userId` (UUID, foreign key to `users.id`)
* `focusDurationMinutes` (integer) // Default desired focus session length
* `breakDurationMinutes` (integer) // Default break length
* `notificationIntervalMinutes` (integer) // How often to remind user to interact with physical object
* `focusModeEnabled` (boolean) // Whether the phone notification blocking is active
* `createdAt` (timestamp)
* `updatedAt` (timestamp)
**Application Structure & Features:**
1. **Authentication:** Implement secure user registration and login using NextAuth.js or a similar library. Store hashed passwords.
2. **Pages (`app/` directory):**
* `/` (Homepage/Dashboard): Display overview of current focus session status, quick start buttons, and a summary of recent sessions.
* `/sessions`: A page to view all past focus sessions with filtering and sorting options.
* `/settings`: A page for users to configure their focus session durations, break times, notification intervals, and enable/disable focus mode.
* `/auth/signin`, `/auth/signup`: Authentication pages.
* `/profile`: User profile management (e.g., changing password).
3. **Core Functionality (CRUD):**
* **Focus Sessions:** Allow users to start, stop, and save focus sessions. Calculate duration automatically. Enable users to add notes to past sessions. Provide endpoints to list all sessions for a user, get a specific session, update a session (e.g., extend time), and delete a session.
* **User Settings:** Allow users to create, read, update, and delete their focus settings. Default settings should be applied if none exist for a user.
4. **API Routes (`app/api/`):**
* Implement API routes for all CRUD operations. Example: `/api/sessions` (POST for creating, GET for listing), `/api/sessions/[id]` (GET for single, PUT for update, DELETE for delete).
* Use server actions for mutations where appropriate.
5. **Focus Mode:** Implement a mechanism (client-side logic potentially interacting with backend flags) to simulate or strongly encourage disabling distracting notifications during a focus session. This might involve instructing the user to manually enable 'Do Not Disturb' or similar system features, with the app tracking the state.
6. **Notifications:** Implement client-side notifications (using the browser's Notification API) for break reminders and prompts to interact with the physical object, based on `focusSettings`.
7. **Frontend:** Use React Server Components and Client Components effectively. Ensure a clean, intuitive UI/UX. Use a UI library like Tailwind CSS with Shadcn/ui for components.
8. **Deployment:** The application should be structured for easy deployment on platforms like Vercel.
**Technical Stack:**
* **Framework:** Next.js 14 (App Router)
* **Language:** TypeScript
* **Database:** PostgreSQL
* **ORM:** Drizzle ORM
* **Authentication:** NextAuth.js
* **Styling:** Tailwind CSS, Shadcn/ui
* **State Management:** React Context API or Zustand for client-side state.
**DO NOT:** Generate only a static landing page or a simple SPA without backend integration, database schema, and full CRUD functionality. The AI should provide a complete, runnable MVP project structure.