This guide will walk you through deploying this application using Supabase as the backend and your preferred hosting platform.
- A Supabase account
- A hosting platform account (Vercel, Netlify, Railway, etc.)
- Git repository with your project code.
- Go to supabase.com and sign in
- Click "New Project"
- 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
- Click "Create new project" and wait for provisioning to complete (1-2 minutes)
- In your Supabase dashboard, go to SQL Editor (left sidebar)
- Click "New query"
- 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;-
Click "Run" to execute
-
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();- Click "Run" to execute
For security, you should enable RLS on the profiles table:
- 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);- Click "Run" to execute
- Go to Project Settings → API
- 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
- Sign in to your hosting platform
- Create a new project and import your Git repository
- Select your repository from the list
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-hereHow to add them:
- In your project configuration, find the "Environment Variables" section
- Add each variable:
- Key: Variable name (e.g.,
NEXT_PUBLIC_SUPABASE_URL) - Value: Your actual value from Supabase
- Environment: Select all (Production, Preview, Development)
- Key: Variable name (e.g.,
- Save each variable
Important Notes:
- Variables starting with
NEXT_PUBLIC_are exposed to the browser SUPABASE_SERVICE_ROLE_KEYshould ONLY be used in API routes/server-side code, never in client components- Never commit these values to your Git repository
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 buildoryarn build - Output Directory:
.next(for Next.js) - Install Command:
npm installoryarn install
- Click "Deploy" or "Build"
- Wait for the build to complete (usually 1-3 minutes)
- Once deployed, your platform will provide you with a URL
- Go back to your Supabase dashboard
- Navigate to Authentication → URL Configuration
- Add your deployment URL to Site URL:
https://your-app.com - Add redirect URLs to Redirect URLs:
(The
https://your-app.com/** http://localhost:3000/****wildcard allows all paths under your domain)
In your hosting platform:
- Go to your project settings and find the domains section
- Add your custom domain
- Follow the DNS configuration instructions
- Once verified, update Supabase redirect URLs to include your custom domain
- Visit your deployed site
- Test authentication flow:
- Sign up with email
- Check if confirmation email arrives
- Verify email and log in
- Test profile creation and updates
- Verify that public profiles are viewable
For contributors to run the project locally:
git clone <repository-url>
cd <project-folder>npm install
# or
yarn installCreate 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-herenpm run dev
# or
yarn devVisit http://localhost:3000 to see the app running locally.
"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
- Never commit secrets: Use
.env.locallocally and environment variables in production - Use RLS: Always enable Row Level Security on Supabase tables
- Limit service role key usage: Only use server-side in API routes
- Regular updates: Keep dependencies updated for security patches
- Monitor logs: Regularly check Supabase and hosting platform logs for suspicious activity
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.