You are an AI assistant tasked with generating a fully functional, multi-page Next.js MVP application based on the provided concept. The application, named 'Energy Pivot', will serve as a data-driven decision support platform for energy sector stakeholders, analyzing government deals, investment shifts, and their environmental/economic impacts.
**1. PROJECT OVERVIEW:**
Energy Pivot aims to empower users with insights into global energy investments, particularly focusing on shifts between fossil fuels and renewable energy projects. The problem it solves is the lack of a consolidated, analytical platform that connects major government agreements (like the US-TotalEnergies deal) with their financial implications and environmental consequences. The core value proposition is to provide data-driven intelligence for informed decision-making in the complex energy landscape, fostering a transition towards more sustainable practices by highlighting risks and opportunities.
**2. TECH STACK:**
- **Framework:** Next.js (App Router)
- **Language:** TypeScript
- **Styling:** Tailwind CSS
- **Database ORM:** Drizzle ORM (PostgreSQL or SQLite for MVP)
- **UI Components:** shadcn/ui
- **Authentication:** NextAuth.js (or Clerk for simpler integration)
- **Charting:** Recharts or Chart.js
- **State Management:** React Context API / Zustand (for global state)
- **Deployment:** Vercel
- **Form Handling:** React Hook Form
- **Validation:** Zod
**3. DATABASE SCHEMA (using Drizzle ORM syntax for PostgreSQL):**
```sql
-- User Table for Authentication
users (
id TEXT PRIMARY KEY,
name TEXT,
email TEXT UNIQUE NOT NULL,
emailVerified TIMESTAMP(3) DEFAULT NULL,
image TEXT
);
-- OAuth Accounts Table
accounts (
id TEXT PRIMARY KEY,
userId TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
type TEXT NOT NULL,
provider TEXT NOT NULL,
providerAccountId TEXT NOT NULL,
refresh_token TEXT,
access_token TEXT,
expires_at TIMESTAMP(3) DEFAULT NULL,
token_type TEXT,
scope TEXT,
id_token TEXT,
session_state TEXT,
UNIQUE(provider, providerAccountId)
);
-- Sessions Table
sessions (
id TEXT PRIMARY KEY,
sessionToken TEXT UNIQUE NOT NULL,
userId TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
expires TIMESTAMP(3) NOT NULL
);
-- Verification Tokens Table
verification_tokens (
identifier TEXT NOT NULL,
token TEXT NOT NULL,
expires TIMESTAMP(3) NOT NULL,
PRIMARY KEY (identifier, token)
);
-- Energy Projects Table
energy_projects (
id SERIAL PRIMARY KEY,
projectName TEXT NOT NULL,
company TEXT,
projectType TEXT CHECK (projectType IN ('Fossil Fuel', 'Renewable', 'Hybrid')) NOT NULL, -- 'Fossil Fuel', 'Renewable', 'Hybrid'
status TEXT CHECK (status IN ('Active', 'On Hold', 'Cancelled', 'Proposed', 'Completed')) NOT NULL, -- 'Active', 'On Hold', 'Cancelled', 'Proposed', 'Completed'
country TEXT,
region TEXT,
estimatedInvestment DECIMAL(15, 2), -- In USD
capacityMW DECIMAL(10, 2), -- For renewables/gas
startDate DATE,
endDate DATE,
createdAt TIMESTAMP(3) DEFAULT NOW(),
updatedAt TIMESTAMP(3) DEFAULT NOW()
);
-- Government Deals Table
government_deals (
id SERIAL PRIMARY KEY,
dealName TEXT NOT NULL,
company TEXT,
governmentEntity TEXT, -- e.g., 'US Department of Interior'
dealType TEXT, -- e.g., 'Lease Agreement', 'Subsidy', 'Project Endorsement'
valueUSD DECIMAL(15, 2), -- Approximate value
dealDate DATE,
relatedProjectIds INTEGER[] DEFAULT ARRAY[]::INTEGER[], -- Array of energy_projects IDs
summary TEXT,
createdAt TIMESTAMP(3) DEFAULT NOW(),
updatedAt TIMESTAMP(3) DEFAULT NOW()
);
-- Policy Changes Table
policy_changes (
id SERIAL PRIMARY KEY,
policyName TEXT NOT NULL,
governingBody TEXT, -- e.g., 'US Government', 'EU Commission'
changeType TEXT, -- e.g., 'Subsidy Reduction', 'New Regulation', 'Tax Increase'
effectiveDate DATE,
description TEXT,
impactSummary TEXT,
createdAt TIMESTAMP(3) DEFAULT NOW(),
updatedAt TIMESTAMP(3) DEFAULT NOW()
);
-- User Preferences/Watchlist (Optional for MVP)
-- watchlist_items (
-- id SERIAL PRIMARY KEY,
-- userId TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
-- projectId INTEGER REFERENCES energy_projects(id),
-- dealId INTEGER REFERENCES government_deals(id),
-- policyId INTEGER REFERENCES policy_changes(id),
-- addedAt TIMESTAMP(3) DEFAULT NOW()
-- );
-- Indexes for performance
CREATE INDEX idx_projects_type ON energy_projects(projectType);
CREATE INDEX idx_projects_country ON energy_projects(country);
CREATE INDEX idx_deals_date ON government_deals(dealDate);
CREATE INDEX idx_policies_date ON policy_changes(effectiveDate);