ugig.net is deployed using:
- Railway - Next.js application hosting
- Supabase Cloud - Database, Auth, Storage, Realtime
- Stripe - Payment processing
-
Accounts Required:
-
Domain (optional but recommended):
- Custom domain for production (ugig.net)
- Go to Supabase Dashboard
- Click "New Project"
- Select organization
- Enter project details:
- Name:
ugig-net - Database Password: (save securely)
- Region: Choose closest to your users
- Name:
- Click "Create new project"
-
Go to Authentication > Providers
-
Enable providers:
- Email: Enable, configure templates
- Google (optional): Add OAuth credentials
- GitHub (optional): Add OAuth credentials
-
Go to Authentication > URL Configuration
- Site URL:
https://ugig.net(or your domain) - Redirect URLs: Add your app URLs
- Site URL:
- Go to SQL Editor
- Run the schema from database-schema.md
- Or use Supabase CLI:
# Install CLI
npm install -g supabase
# Login
supabase login
# Link project
supabase link --project-ref YOUR_PROJECT_REF
# Run migrations
supabase db push- Go to Storage
- Create buckets:
avatars- Public bucket for profile imagesattachments- Private bucket for chat attachments
-- Storage policies
INSERT INTO storage.buckets (id, name, public)
VALUES ('avatars', 'avatars', true);
INSERT INTO storage.buckets (id, name, public)
VALUES ('attachments', 'attachments', false);
-- Avatar upload policy
CREATE POLICY "Users can upload own avatar"
ON storage.objects FOR INSERT
WITH CHECK (
bucket_id = 'avatars' AND
auth.uid()::text = (storage.foldername(name))[1]
);
-- Attachment policies
CREATE POLICY "Users can upload attachments"
ON storage.objects FOR INSERT
WITH CHECK (
bucket_id = 'attachments' AND
auth.uid() IS NOT NULL
);
CREATE POLICY "Conversation participants can view attachments"
ON storage.objects FOR SELECT
USING (
bucket_id = 'attachments' AND
auth.uid() IS NOT NULL
);- Go to Settings > API
- Copy:
Project URL→NEXT_PUBLIC_SUPABASE_URLanon publickey →NEXT_PUBLIC_SUPABASE_ANON_KEYservice_rolekey →SUPABASE_SERVICE_ROLE_KEY
- Go to Stripe Dashboard
- Get API keys from Developers > API keys:
- Publishable key →
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY - Secret key →
STRIPE_SECRET_KEY
- Publishable key →
- Go to Products
- Create product: "ugig Pro"
- Add price:
- Amount: $5.99
- Billing period: Monthly
- Copy Price ID for checkout
- Go to Developers > Webhooks
- Add endpoint:
- URL:
https://ugig.net/api/webhooks/stripe - Events to listen:
checkout.session.completedcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_failed
- URL:
- Copy Signing secret →
STRIPE_WEBHOOK_SECRET
- Go to Settings > Billing > Customer portal
- Enable portal
- Configure allowed actions
- Go to Railway
- Click "New Project"
- Select "Deploy from GitHub repo"
- Connect your GitHub account
- Select the
ugig.netrepository
In Railway project settings, add:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...
# Stripe
STRIPE_SECRET_KEY=sk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_...
STRIPE_PRO_PRICE_ID=price_...
# Jitsi
NEXT_PUBLIC_JITSI_DOMAIN=meet.jit.si
# App
NEXT_PUBLIC_APP_URL=https://ugig.net
NODE_ENV=production
Railway auto-detects Next.js, but verify:
- Build Command:
npm run build - Start Command:
npm start - Install Command:
npm install
- Push to main branch triggers deploy
- Or manually deploy from Railway dashboard
- In Railway, go to Settings > Domains
- Add custom domain:
ugig.net - Configure DNS:
- Add CNAME record pointing to Railway
- SSL is automatic
| Variable | Description | Where to get |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Supabase project URL | Supabase Settings > API |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Supabase anon key | Supabase Settings > API |
SUPABASE_SERVICE_ROLE_KEY |
Supabase service role | Supabase Settings > API |
STRIPE_SECRET_KEY |
Stripe secret key | Stripe Developers > API keys |
STRIPE_WEBHOOK_SECRET |
Stripe webhook secret | Stripe Developers > Webhooks |
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY |
Stripe public key | Stripe Developers > API keys |
STRIPE_PRO_PRICE_ID |
Pro plan price ID | Stripe Products |
NEXT_PUBLIC_JITSI_DOMAIN |
Jitsi server domain | Use meet.jit.si or self-hosted |
NEXT_PUBLIC_APP_URL |
Your app URL | Your domain |
git clone https://github.com/your-org/ugig.net.git
cd ugig.net
npm install# Copy example env
cp .env.example .env.local
# Fill in your development keysnpm run dev# Install Stripe CLI
brew install stripe/stripe-cli/stripe
# Login
stripe login
# Forward webhooks to local
stripe listen --forward-to localhost:3000/api/webhooks/stripeRailway automatically deploys on push to main. For additional CI:
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run type-check
- run: npm run testConsider adding:
- Sentry for error tracking
- Railway logs for server logs
Supabase Pro includes automatic backups. For additional:
- Enable Point-in-Time Recovery
- Set up manual backup schedule
- Railway provides basic metrics
- Consider Vercel Analytics compatible tools
- Supabase dashboard for database metrics
- Database: Supabase Pro when approaching limits
- Application: Railway horizontal scaling
- Storage: CDN for static assets
- Database: 500MB
- Storage: 1GB
- Auth users: 50,000 MAU
- Realtime: 200 concurrent connections
- Memory: Configurable per service
- CPU: Shared by default, dedicated available
- Bandwidth: Pay per GB
Deployment fails on Railway
- Check build logs
- Verify environment variables
- Ensure all dependencies in package.json
Supabase connection issues
- Verify API keys
- Check RLS policies
- Ensure database is not paused (free tier)
Stripe webhooks not working
- Verify webhook URL is correct
- Check webhook secret
- Verify events are selected
Auth not working
- Check redirect URLs in Supabase
- Verify Site URL configuration
- Check OAuth provider setup