Development Setup - ThriveSend B2B2G
Development Setup - ThriveSend B2B2G
Section titled “Development Setup - ThriveSend B2B2G”Last Updated: October 20, 2025
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have the following installed:
Required Software
Section titled “Required Software”| Software | Minimum Version | Recommended | Purpose |
|---|---|---|---|
| Node.js | 20.x LTS | 20.11+ | JavaScript runtime |
| pnpm | 8.x | Latest | Package manager |
| PostgreSQL | 16.x | 16.1+ | Database |
| Git | 2.x | Latest | Version control |
Optional Tools
Section titled “Optional Tools”- Prisma Studio: GUI for database (included with Prisma)
- VS Code: Recommended IDE with extensions
- Docker: For containerized PostgreSQL (optional)
Installation Steps
Section titled “Installation Steps”1. Clone the Repository
Section titled “1. Clone the Repository”# Clone via SSH (recommended)git clone git@github.com:gedeza/thrive-send-b2b2g.git
# Or via HTTPSgit clone https://github.com/gedeza/thrive-send-b2b2g.git
# Navigate to projectcd thrive-send-b2b2g2. Install pnpm (if not installed)
Section titled “2. Install pnpm (if not installed)”# Install pnpm globallynpm install -g pnpm
# Verify installationpnpm --version# Should output: 8.x or higher3. Install Dependencies
Section titled “3. Install Dependencies”# Install all project dependenciespnpm install
# This will install:# - Next.js 15.5.4# - TypeScript 5.x# - Prisma 6.x# - Clerk Auth# - Radix UI + shadcn/ui# - And 100+ other dependenciesScreenshot Placeholder:
4. Set Up PostgreSQL Database
Section titled “4. Set Up PostgreSQL Database”Option A: Local PostgreSQL
Section titled “Option A: Local PostgreSQL”# Install PostgreSQL 16 (Ubuntu/Debian)sudo apt updatesudo apt install postgresql-16 postgresql-contrib-16
# Start PostgreSQL servicesudo systemctl start postgresqlsudo systemctl enable postgresql
# Create database and usersudo -u postgres psql
-- In PostgreSQL shell:CREATE DATABASE thrivesend_dev;CREATE USER thrivesend WITH PASSWORD 'devpassword';GRANT ALL PRIVILEGES ON DATABASE thrivesend_dev TO thrivesend;\qOption B: Docker PostgreSQL
Section titled “Option B: Docker PostgreSQL”# Run PostgreSQL in Dockerdocker run --name thrivesend-postgres \ -e POSTGRES_DB=thrivesend_dev \ -e POSTGRES_USER=thrivesend \ -e POSTGRES_PASSWORD=devpassword \ -p 5432:5432 \ -d postgres:165. Configure Environment Variables
Section titled “5. Configure Environment Variables”Create .env.local file in the project root:
# Copy example environment filecp .env.example .env.localEdit .env.local with your values:
# DatabaseDATABASE_URL="postgresql://thrivesend:devpassword@localhost:5432/thrivesend_dev"
# Clerk AuthenticationNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_your-key-here"CLERK_SECRET_KEY="sk_test_your-key-here"
# Clerk URLsNEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-inNEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-upNEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboardNEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/onboarding/organization
# Resend Email (optional for local dev)RESEND_API_KEY="re_your-key-here"RESEND_FROM_EMAIL="noreply@yourdomain.com"
# Redis (optional for local dev)REDIS_URL="redis://localhost:6379"
# Sentry (optional for local dev)SENTRY_DSN="your-sentry-dsn"
# ApplicationNEXT_PUBLIC_APP_URL="http://localhost:3000"NODE_ENV="development"Screenshot Placeholder:
6. Set Up Clerk Authentication
Section titled “6. Set Up Clerk Authentication”- Go to https://clerk.com and create an account
- Create a new application
- Select “Next.js” as your framework
- Copy the API keys to your
.env.local - Configure organization settings:
- Enable “Organizations” feature
- Set organization roles
Screenshot Placeholder:
7. Initialize Database with Prisma
Section titled “7. Initialize Database with Prisma”# Generate Prisma Clientnpx prisma generate
# Run database migrationsnpx prisma migrate dev
# You'll see output like:# ✔ Generated Prisma Client# ✔ Applied 1 migration# Database schema is up to date!
# Seed the database with sample datanpx prisma db seed
# This creates:# - Sample organizations# - Test users# - Sample clients (government and business)# - Test campaignsScreenshot Placeholder:
8. Verify Installation
Section titled “8. Verify Installation”# Run the development serverpnpm dev
# You should see:# ▲ Next.js 15.5.4# - Local: http://localhost:3000# - Environments: .env.local# ✓ Ready in 2.5sOpen http://localhost:3000 in your browser.
Screenshot Placeholder:
VS Code Setup (Recommended)
Section titled “VS Code Setup (Recommended)”Install Recommended Extensions
Section titled “Install Recommended Extensions”Create .vscode/extensions.json:
{ "recommendations": [ "prisma.prisma", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "bradlc.vscode-tailwindcss", "ms-playwright.playwright", "github.copilot" ]}Configure VS Code Settings
Section titled “Configure VS Code Settings”Create .vscode/settings.json:
{ "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, "typescript.tsdk": "node_modules/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true, "tailwindCSS.experimental.classRegex": [ ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], ["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] ]}Verify Development Environment
Section titled “Verify Development Environment”Run the following commands to verify everything is set up correctly:
# 1. Check Node.js versionnode --version# Expected: v20.x.x
# 2. Check pnpm versionpnpm --version# Expected: 8.x.x
# 3. Check PostgreSQL connectionnpx prisma db execute --stdin <<< "SELECT 1;"# Expected: Query executed successfully
# 4. Check Prisma Clientnpx prisma generate# Expected: ✔ Generated Prisma Client
# 5. Run linterpnpm lint# Expected: No errors (or only warnings)
# 6. Run testspnpm test# Expected: Tests pass (may have some skipped)
# 7. Build the projectpnpm build# Expected: ✓ Compiled successfullyCommon Setup Issues
Section titled “Common Setup Issues”Issue: Port 3000 Already in Use
Section titled “Issue: Port 3000 Already in Use”# Find process using port 3000lsof -i :3000
# Kill the processkill -9 <PID>
# Or use a different portpnpm dev -- -p 3001Issue: Prisma Client Not Generated
Section titled “Issue: Prisma Client Not Generated”# Delete node_modules and reinstallrm -rf node_modulesrm pnpm-lock.yamlpnpm install
# Generate Prisma Clientnpx prisma generateIssue: Database Connection Failed
Section titled “Issue: Database Connection Failed”# Check PostgreSQL is runningsudo systemctl status postgresql
# Test connectionpsql -h localhost -U thrivesend -d thrivesend_dev
# Check DATABASE_URL in .env.localecho $DATABASE_URLIssue: Clerk Authentication Not Working
Section titled “Issue: Clerk Authentication Not Working”- Verify API keys in
.env.local - Check Clerk dashboard for application status
- Ensure organization feature is enabled
- Clear browser cookies and retry
Next Steps
Section titled “Next Steps”Now that your development environment is set up:
- Read Project Structure to understand the codebase
- Explore System Design for architecture overview
Getting Help
Section titled “Getting Help”- Setup Issues: Check Common Setup Issues above
- Clerk Issues: Clerk Documentation
- Prisma Issues: Prisma Documentation
- Next.js Issues: Next.js Documentation
Last Updated: October 20, 2025