Skip to content

Latest commit

 

History

History
178 lines (124 loc) · 4.5 KB

File metadata and controls

178 lines (124 loc) · 4.5 KB

Local Setup Guide

This guide will help you set up Supavec locally for development.

Prerequisites

Initial Setup

  1. Clone the repository
git clone https://github.com/taishikato/supavec.git
cd supavec
  1. Install dependencies
bun install
  1. Set up environment variables

For the web app (apps/web):

  • Copy .env.sample to .env.local
cp apps/web/.env.sample apps/web/.env.local

For the API (packages/api):

  • Copy .env.sample to .env
cp packages/api/.env.sample packages/api/.env

For the Supabase (supabase):

  • Copy .env.sample to .env
cp supabase/.env.sample supabase/.env
  1. Configure environment variables:

Web app environment variables (apps/web/.env.local):

  • NEXT_PUBLIC_SUPABASE_URL: Your Supabase project URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY: Your Supabase anonymous key
  • NEXT_PUBLIC_SUPABASE_PROJECT_ID: Your Supabase project ID
  • SUPABASE_SERVICE_ROLE_KEY: Your Supabase service role key
  • NEXT_PUBLIC_API_URL: Local API URL (default: http://localhost:3001)
  • POSTHOG_API_KEY: Your PostHog API key
  • NEXT_PUBLIC_POSTHOG_KEY: Your PostHog API key
  • NEXT_PUBLIC_POSTHOG_HOST: PostHog API host (default: https://app.posthog.com)
  • DEMO_SUPA_API_KEY: Your demo Supa API key
  • LOOPS_API_KEY: Your Loops API key
  • STRIPE_SECRET_KEY: Your Stripe secret key
  • STRIPE_SIGNATURE_SECRET: Your Stripe signature secret
  • NEXT_PUBLIC_STRIPE_KEY: Your public Stripe key
  • NEXT_PUBLIC_STRIPE_PRICE_BASIC_MONTHLY: Stripe price ID for the basic monthly plan
  • NEXT_PUBLIC_STRIPE_PRICE_BASIC_YEARLY: Stripe price ID for the basic yearly plan
  • NEXT_PUBLIC_STRIPE_PRICE_ENTERPRISE_MONTHLY: Stripe price ID for the enterprise monthly plan
  • NEXT_PUBLIC_STRIPE_PRICE_ENTERPRISE_YEARLY: Stripe price ID for the enterprise yearly plan
  • NEXT_PUBLIC_STRIPE_PRODUCT_BASIC: Stripe product ID for the basic plan
  • NEXT_PUBLIC_STRIPE_PRODUCT_ENTERPRISE: Stripe product ID for the enterprise plan
  • API_ROUTE_SECRET: API route secret key
  • NEXT_PUBLIC_GOOGLE_ANALYTICS: Your Google Analytics key
  • NEXT_PUBLIC_APP_URL: Local app URL (default: http://localhost:3000)

API environment variables (packages/api/.env):

  • OPENAI_API_KEY: Your OpenAI API key
  • SUPABASE_URL: Your Supabase project URL
  • SUPABASE_SERVICE_ROLE_KEY: Your Supabase service role key
  • UPSTASH_REDIS_REST_URL: Your Upstash Redis REST URL
  • UPSTASH_REDIS_REST_TOKEN: Your Upstash Redis REST token
  • POSTHOG_API_KEY: Your PostHog API key (optional)
  • POSTHOG_HOST: Your PostHog host URL (optional)

Running the Development Environment

  1. Start the Supabase local development environment:
cd supabase
supabase start
  1. Start the development servers:

In one terminal, start the API server:

cd packages/api
bun run dev

In another terminal, start the web server:

cd apps/web
bun run dev

The application should now be running at:

Development Workflow

  1. Create a new branch for your feature/fix:
git checkout -b feature/your-feature-name
  1. Make your changes and commit them:
git add .
git commit -m "feat: your feature description"
  1. Push your changes and create a pull request:
git push origin feature/your-feature-name

Available Scripts

From the root directory:

  • bun run dev: Start all development servers
  • bun run build: Build all packages
  • bun run build:api: Build only the API package
  • bun run lint: Run linting
  • bun run format: Format code using Prettier

Troubleshooting

  1. If you encounter dependency issues:
bun install --force
  1. If the development server isn't working:
  • Check if all environment variables are properly set
  • Ensure Supabase is running locally
  • Verify that ports 3000 and 3001 are available

Need Help?

If you need help or have questions:

  1. Check the existing issues
  2. Create a new issue if your problem hasn't been addressed

Contributing

  1. Ensure your code follows the project's coding standards
  2. Add tests for new features when applicable
  3. Update documentation as needed
  4. Follow the conventional commits specification for commit messages