Prerequisites
Before starting, verify that your machine has the following tools installed:Step 1: Clone the Repository
Open your terminal (PowerShell on Windows, or Terminal on macOS/Linux) and clone the repository:Step 2: Install Monorepo Dependencies
Instance uses pnpm workspaces to coordinate dependencies across apps and shared packages. Run:Step 3: Prepare Environment Configuration
Create your local.env configuration file from the comprehensive template:
Copy-Item .env.example .env)
Step 4: Rapid Bootstrapping Setup (2 Minutes to Run)
To get the application running locally and sign into the dashboard immediately, configure these core connections in your.env file:
1. PostgreSQL Database
- Cloud Option (Recommended & Fastest): Sign up at neon.tech, create a new project named
instance, and copy the pooled and direct connection strings into your.env: - Local Option: If you have PostgreSQL running locally:
2. Redis Cache and Queue
- Cloud Option (Fastest): Create a free Redis instance on upstash.com and copy your connection URL:
- Local Option: If you have local Redis running (
redis-server):
3. Generate NextAuth Authentication Secret
Instance uses NextAuth to secure sessions and encrypt JWT tokens. You need a random 32-character secret. You can generate one in either of two ways:- Terminal: Run
openssl rand -hex 32in your command line (if you have OpenSSL or Git Bash installed). - Online Generator: Visit generate-secret.vercel.app/32 to generate a secure random 32-character hex secret instantly.
.env:
4. Configure Google OAuth Login
- Open Google Cloud Console.
- Create a project and navigate to APIs & Services -> Credentials.
- Click Create Credentials -> OAuth client ID (Application type: Web application).
- Set Authorized JavaScript origins:
http://localhost:3000. - Set Authorized redirect URIs:
http://localhost:3000/api/auth/callback/google. - Copy the credentials into your
.env:
Step 5: Initialize the Database Schema
Generate the Prisma Client types and synchronize all tables with your PostgreSQL database:Step 6: Start the Development Stack
Launch all services concurrently:- Web Dashboard:
pnpm dev:web(port 3000) - API Server:
pnpm dev:api(port 4000) - Background Workers:
pnpm dev:workers
http://localhost:3000 and sign in. You are now running the Instance workspace!
Step 7: Complete Feature Integrations (The Full Solution)
Once the core app is running, configure the remaining functional services in.env to unlock the full platform capabilities:
1. Meta and Instagram Credentials (Most Important)
This is the core foundation of Instance. To receive comments, story interactions, and direct messages in real time, you must connect your Meta Developer App and Instagram Professional account:- Follow the complete step-by-step Instagram Setup guide to obtain your
INSTAGRAM_APP_ID,INSTAGRAM_APP_SECRET, andMETA_WEBHOOK_VERIFY_TOKEN. - Configure the webhook endpoint and tunnel to start receiving live incoming customer events.
2. Cloudflare R2 Media Storage (S3-Compatible)
Used for storing voice notes, carousel images, and media attachments sent through DM automations:- Log in to Cloudflare Dashboard and navigate to R2 Object Storage.
- Click Create bucket (name it
instance-media). - Click Manage R2 API Tokens -> Create API Token with Object Read and Write permissions.
- In your bucket settings under Public Access, enable the Public
r2.devURL or connect a custom domain. - Add the keys to
.env:
3. Email Setup (Passwordless Magic Links and Notifications)
Configure SMTP to send passwordless login links and system alert emails:- Using Gmail: Create an App Password at myaccount.google.com/apppasswords. Copy your 16-character app password into
EMAIL_SERVER_PASSWORD. - Using Transactional Email (Resend, SendGrid, Amazon SES, Postmark):
4. Background Cron Security
Instance runs periodic background crons (such as hourly rate limit quota resets and paused account health checks). Generate a dedicated authorization key:- Terminal: Run
openssl rand -hex 32in your command line. - Online Generator: Visit generate-secret.vercel.app/32 to generate a random 32-character hex key.
.env:
5. Meta Instagram Rate Limits and Pacing Controls
Instance includes built-in token-bucket rate limits and thread pacing matching official Meta specifications. The defaults in.env.example are pre-tuned for safety, and you can expand them as your Meta app tier increases:
Common Troubleshooting
- Prisma Client Generation Fails: Run
pnpm postinstallto rebuild shared monorepo packages. - Port In Use (3000, 4000, or 6379): Check if other processes are occupying these ports before starting dev servers.
- Worker Jobs Not Executing: Ensure Redis is running and reachable via the
REDIS_URLin.env.