🚀 Installation & Configuration Guide
Welcome to the Enterprise OS. This guide is designed to help you set up the entire application from scratch, including how to obtain every single API key required.
✅ Prerequisites
- Node.js (v18.17.0+)
- Git
- Stripe CLI (Required for local payment testing)
# 1. Unzip the downloaded file
# Extract "Enterprise-OS-v3.0.zip" to your preferred folder.
# 2. Navigate to the project folder
cd my-saas-next
# 3. Install dependencies
npm install
🔑 Step 2: Environment Variables (The Important Part)
The application relies on several services. Rename .env.example to .env:
cp .env.example .env
Now, let's fill in each section.
1. Database (PostgreSQL)
We recommend Neon or Supabase for a managed Serverless Postgres.
- Provider: Neon.tech / Supabase.com
- Action: Create a new project.
- Get Key: Look for "Connection String". It looks like:
postgresql://user:password@host/dbname?sslmode=require - Set in .env:
DATABASE_URL
2. Authentication (Auth.js)
This secures your app.
- Action: Open your terminal inside the project folder.
- Run:
npx auth secret - Set in .env:
AUTH_SECRET(Copy the generated string)
3. Google OAuth & AI (Gemini)
Used for "Login with Google" and AI features.
- Provider: Google Cloud Console
- Action:
- Create a New Project.
- Go to APIs & Services > Credentials.
- Click Create Credentials > OAuth Client ID.
- Application Type: Web Application.
- Authorized Javascript Origins:
http://localhost:3000 - Authorized Redirect URIs:
http://localhost:3000/api/auth/google/callback
- Set in .env:
GOOGLE_CLIENT_ID&GOOGLE_CLIENT_SECRET
For AI (Gemini):
- Provider: Google AI Studio
- Action: "Get API Key" -> Create key in new project.
- Set in .env:
GEMINI_API_KEY
4. Stripe (Payments)
- Provider: Stripe Dashboard
- Get Keys: Go to Developers > API keys.
- Set in .env:
STRIPE_SECRET_KEY(starts withsk_test_...)NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY(starts withpk_test_...)
Setup Webhook (Crucial for testing):
- Open a new terminal.
- Run
stripe login. - Run
stripe listen --forward-to localhost:3000/api/webhooks/stripe. - Copy the
whsec_...key shown in the terminal. - Set in .env:
STRIPE_WEBHOOK_SECRET
Setup Price IDs:
- Go to Product Catalog in Stripe.
- Create two products: "Pro Plan" and "Enterprise Plan".
- Add a price for each (e.g., $29/month).
- Copy the Price ID (starts with
price_...). - Set in .env:
NEXT_PUBLIC_STRIPE_PRO_PRICE_ID&NEXT_PUBLIC_STRIPE_ENTERPRISE_PRICE_ID.
5. Email (Resend)
Used for sending magic links and notifications.
- Provider: Resend.com
- Action: Create API Key.
- Set in .env:
RESEND_API_KEY
6. Upstash (Rate Limiting)
Protects your API from spam.
- Provider: Upstash Console
- Action: Create Redis Database.
- Get Keys: Scroll to "REST API" section.
- Set in .env:
UPSTASH_REDIS_REST_URL&UPSTASH_REDIS_REST_TOKEN.
🗄️ Step 3: Database Migration
Sync your local code schema with your remote database.
npx drizzle-kit push
🚀 Step 4: Run the App
npm run dev
Visit http://localhost:3000. You are ready to go!