Complete setup instructions for local development and production deployment.
- Python 3.10+
- Node.js 18+ & npm
- Google Cloud Platform Account
- Go to Google Cloud Console
- Create a new project (e.g.,
sheety-crm) - Enable these APIs:
- Google Sheets API
- Google Drive API
- Google Picker API
- Go to APIs & Services > OAuth consent screen
- Select External user type
- Fill in required fields:
- App name:
Sheety CRM - User support email: your email
- Developer contact: your email
- App name:
- Add scopes:
emailprofileopenidhttps://www.googleapis.com/auth/spreadsheetshttps://www.googleapis.com/auth/drive.file
- Add test users (your email) for development
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Select Web application
- Configure URIs:
Authorized JavaScript Origins:
| Environment | URI |
|---|---|
| Local | http://localhost:3026 |
| Production | https://sheety.site |
| Production | http://sheety.site |
| Cloudflare | https://sheety-crm.pages.dev |
| Cloudflare | http://sheety-crm.pages.dev |
Authorized Redirect URIs:
| Environment | URI |
|---|---|
| Local | http://localhost:3026/api/auth/callback/google |
| Production | https://sheety.site/api/auth/callback/google |
| Cloudflare | https://sheety-crm.pages.dev/api/auth/callback/google |
- Copy the Client ID and Client Secret
PostHog is integrated for product analytics and can be enabled by configuring the following environment variables.
- Sign up at PostHog
- Create a new project or use an existing one
- Navigate to Project Settings in your PostHog dashboard
- Copy your Project API Key
- Note your PostHog host URL (default:
https://us.i.posthog.comfor US cloud, orhttps://eu.i.posthog.comfor EU cloud)
You can use PostHog's AI setup wizard for automated installation:
cd crm-dashboard
npx -y @posthog/wizard@latestFollow the wizard's instructions to automatically configure PostHog in your Next.js app.
Note: PostHog is optional. If you don't configure the environment variables, the app will work without analytics.
# API Connection
NEXT_PUBLIC_API_URL=http://localhost:8026
# NextAuth Configuration
NEXTAUTH_URL=http://localhost:3026
AUTH_SECRET=your_secret_here # Generate: openssl rand -base64 32
AUTH_TRUST_HOST=true
# Google OAuth
GOOGLE_CLIENT_ID=your_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_client_secret
# PostHog Analytics (Optional)
NEXT_PUBLIC_POSTHOG_KEY=<your_posthog_project_api_key>
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.comFor production deployments (Vercel, Cloudflare, etc.):
# Update URLs to production domain
NEXT_PUBLIC_API_URL=https://api.your-domain.com
NEXTAUTH_URL=https://your-domain.com
AUTH_SECRET=your_production_secret
AUTH_TRUST_HOST=true
# Same Google credentials (ensure production URIs are added in GCP)
GOOGLE_CLIENT_ID=your_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your_client_secret
# PostHog Analytics (Optional)
NEXT_PUBLIC_POSTHOG_KEY=<your_posthog_project_api_key>
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
⚠️ Important: Add your production domain to the OAuth consent screen's authorized domains in Google Cloud Console.
# Install all dependencies
make installThis creates a Python venv and installs both backend and frontend dependencies.
# Start both servers
make crm-dev| Service | URL |
|---|---|
| Frontend | http://localhost:3026 |
| Backend API | http://localhost:8026 |
| API Docs | http://localhost:8026/docs |
- Connect your GitHub repo
- Set build command:
npm run build - Set output directory:
.next - Add environment variables from section 3
- Create a new Web Service
- Set build command:
pip install -r requirements.txt - Set start command:
uvicorn src.main:app --host 0.0.0.0 --port $PORT - Configure environment variables as needed
- Verify Domain Ownership:
- Go to Google Search Console.
- Add
https://sheety.site(and any other domains). - Verify ownership via DNS TXT record (recommended) or HTML file.
- Crucial: Use the same Google Account as your Cloud Project.
- Return to GCP > APIs & Services > Domain verification and click "Add domain".
- Add production domain to OAuth consent screen.
- Add production redirect URIs to OAuth credentials.
- Publish OAuth consent screen (move from Testing to Production).
- Request verification if using sensitive scopes.
- Open your app URL
- Click Sign in with Google
- Grant permissions (Sheets/Drive access)
- Select or create a spreadsheet on the Setup page
| Issue | Solution |
|---|---|
| OAuth redirect error | Verify redirect URIs match exactly in GCP |
| "Access blocked" | Add yourself as test user or publish consent screen |
| API connection failed | Check NEXT_PUBLIC_API_URL and backend status |
| Port already in use | Kill existing process or change port in Makefile |