Skip to content

jimmexploit/Teamder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deployment Guide

This guide will walk you through deploying this application using Supabase as the backend and your preferred hosting platform.

Prerequisites

  • A Supabase account
  • A hosting platform account (Vercel, Netlify, Railway, etc.)
  • Git repository with your project code.

Part 1: Supabase Setup

1.1 Create a New Supabase Project

  1. Go to supabase.com and sign in
  2. Click "New Project"
  3. Fill in your project details:
    • Project Name: Choose a name for your project
    • Database Password: Create a strong password (save this securely)
    • Region: Select the region closest to your users
  4. Click "Create new project" and wait for provisioning to complete (1-2 minutes)

1.2 Set Up the Database Schema

  1. In your Supabase dashboard, go to SQL Editor (left sidebar)
  2. Click "New query"
  3. Copy and paste the following SQL to create the required function first:
-- Create the set_updated_at function
CREATE OR REPLACE FUNCTION set_updated_at()
RETURNS TRIGGER AS $$
BEGIN
  NEW.updated_at = now();
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;
  1. Click "Run" to execute

  2. Create a new query and paste the profiles table schema:

CREATE TABLE public.profiles (
  id uuid NOT NULL,
  username text NULL,
  email text NULL,
  name text NULL,
  role text NULL,
  technical_role text NULL,
  skills jsonb NULL DEFAULT '[]'::jsonb,
  looking_for jsonb NULL DEFAULT '[]'::jsonb,
  preferred_skills jsonb NULL DEFAULT '[]'::jsonb,
  preferred_roles jsonb NULL DEFAULT '[]'::jsonb,
  linkedin text NULL,
  whatsapp text NULL,
  is_public boolean NULL DEFAULT true,
  created_at timestamp with time zone NULL DEFAULT now(),
  updated_at timestamp with time zone NULL DEFAULT now(),
  CONSTRAINT profiles_pkey PRIMARY KEY (id),
  CONSTRAINT profiles_email_key UNIQUE (email),
  CONSTRAINT profiles_username_key UNIQUE (username),
  CONSTRAINT profiles_id_fkey FOREIGN KEY (id) REFERENCES auth.users (id) ON DELETE CASCADE
) TABLESPACE pg_default;

CREATE INDEX IF NOT EXISTS profiles_username_idx ON public.profiles USING btree (username) TABLESPACE pg_default;

CREATE INDEX IF NOT EXISTS profiles_email_idx ON public.profiles USING btree (email) TABLESPACE pg_default;

CREATE TRIGGER profiles_set_updated_at 
BEFORE UPDATE ON profiles 
FOR EACH ROW
EXECUTE FUNCTION set_updated_at();
  1. Click "Run" to execute

1.3 Configure Row Level Security (RLS)

For security, you should enable RLS on the profiles table:

  1. In SQL Editor, create a new query:
-- Enable RLS
ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY;

-- Policy: Users can view public profiles
CREATE POLICY "Public profiles are viewable by everyone"
ON public.profiles FOR SELECT
USING (is_public = true);

-- Policy: Users can view their own profile (even if not public)
CREATE POLICY "Users can view their own profile"
ON public.profiles FOR SELECT
USING (auth.uid() = id);

-- Policy: Users can update their own profile
CREATE POLICY "Users can update their own profile"
ON public.profiles FOR UPDATE
USING (auth.uid() = id);

-- Policy: Users can insert their own profile
CREATE POLICY "Users can insert their own profile"
ON public.profiles FOR INSERT
WITH CHECK (auth.uid() = id);
  1. Click "Run" to execute

1.4 Get Your API Credentials

  1. Go to Project SettingsAPI
  2. You'll need these values for deployment:
    • Project URL: Your unique Supabase project URL
    • anon/public key: Under "Project API keys"
    • service_role key: Keep this secret! Only use server-side

Part 2: Deploy to Your Hosting Platform

2.1 Connect Your Repository

  1. Sign in to your hosting platform
  2. Create a new project and import your Git repository
  3. Select your repository from the list

2.2 Configure Environment Variables

Before deploying, add these environment variables in your hosting platform's dashboard:

Required Variables:

# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here

# Optional: For server-side operations only
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key-here

How to add them:

  1. In your project configuration, find the "Environment Variables" section
  2. Add each variable:
    • Key: Variable name (e.g., NEXT_PUBLIC_SUPABASE_URL)
    • Value: Your actual value from Supabase
    • Environment: Select all (Production, Preview, Development)
  3. Save each variable

Important Notes:

  • Variables starting with NEXT_PUBLIC_ are exposed to the browser
  • SUPABASE_SERVICE_ROLE_KEY should ONLY be used in API routes/server-side code, never in client components
  • Never commit these values to your Git repository

2.3 Configure Build Settings

If you're using Next.js (most common), your platform will likely auto-detect it. Verify these settings:

  • Framework Preset: Next.js (or your framework)
  • Build Command: npm run build or yarn build
  • Output Directory: .next (for Next.js)
  • Install Command: npm install or yarn install

2.4 Deploy

  1. Click "Deploy" or "Build"
  2. Wait for the build to complete (usually 1-3 minutes)
  3. Once deployed, your platform will provide you with a URL

Part 3: Post-Deployment Configuration

3.1 Configure Supabase Redirect URLs

  1. Go back to your Supabase dashboard
  2. Navigate to AuthenticationURL Configuration
  3. Add your deployment URL to Site URL: https://your-app.com
  4. Add redirect URLs to Redirect URLs:
    https://your-app.com/**
    http://localhost:3000/**
    
    (The ** wildcard allows all paths under your domain)

3.2 Set Up Custom Domain (Optional)

In your hosting platform:

  1. Go to your project settings and find the domains section
  2. Add your custom domain
  3. Follow the DNS configuration instructions
  4. Once verified, update Supabase redirect URLs to include your custom domain

3.3 Test the Deployment

  1. Visit your deployed site
  2. Test authentication flow:
    • Sign up with email
    • Check if confirmation email arrives
    • Verify email and log in
  3. Test profile creation and updates
  4. Verify that public profiles are viewable

Part 4: Local Development Setup

For contributors to run the project locally:

4.1 Clone the Repository

git clone <repository-url>
cd <project-folder>

4.2 Install Dependencies

npm install
# or
yarn install

4.3 Create .env.local File

Create a .env.local file in the root directory:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key-here

4.4 Run Development Server

npm run dev
# or
yarn dev

Visit http://localhost:3000 to see the app running locally.

Troubleshooting

Common Issues

"Invalid API key" errors:

  • Double-check environment variables in your hosting platform
  • Ensure no extra spaces in the keys
  • Redeploy after changing environment variables

Database connection issues:

  • Verify Supabase project is active
  • Check that RLS policies aren't blocking legitimate requests
  • Use Supabase logs to debug (go to Logs → Postgres Logs)

Build failures:

  • Check build logs for specific errors
  • Ensure all dependencies are in package.json
  • Verify Node.js version compatibility

Authentication redirect issues:

  • Verify redirect URLs are configured correctly in Supabase
  • Ensure your deployment URL matches exactly (including https://)
  • Check browser console for authentication errors

Security Best Practices

  1. Never commit secrets: Use .env.local locally and environment variables in production
  2. Use RLS: Always enable Row Level Security on Supabase tables
  3. Limit service role key usage: Only use server-side in API routes
  4. Regular updates: Keep dependencies updated for security patches
  5. Monitor logs: Regularly check Supabase and hosting platform logs for suspicious activity

Additional Resources

Support

For issues or questions:

  • Open an issue on the GitHub repository
  • Check existing issues for solutions
  • Refer to official documentation

That's it! Your application should now be deployed and running. Contributors can follow the local development setup to start contributing to the project.

About

Graduation Project teams matching

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors