This guide will help you set up Ticketr locally for development or testing.
Before you begin, ensure you have the following installed:
- Node.js 18+ - Download here
- npm, yarn, or pnpm - Package manager of your choice
- Git - For version control
You'll also need accounts with:
- Convex - For the real-time backend
- Stripe - For payment processing
- Google Cloud Console (optional) - For Google OAuth
- GitHub (optional) - For GitHub OAuth
git clone https://github.com/heyitsadityaa/ticketr.git
cd ticketrnpm install
# or
yarn install
# or
pnpm installCopy the example environment file:
cp .env.example .env.localYour .env.local file should look like this:
# Convex Configuration
CONVEX_DEPLOYMENT=your_convex_deployment_name
NEXT_PUBLIC_CONVEX_URL=https://your_convex_deployment.convex.cloud
# Authentication (OAuth) - At least one is required
AUTH_GITHUB_ID=your_github_oauth_client_id
AUTH_GITHUB_SECRET=your_github_oauth_client_secret
AUTH_GOOGLE_ID=your_google_oauth_client_id
AUTH_GOOGLE_SECRET=your_google_oauth_client_secret
# Stripe Configuration
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# Application URL
NEXT_PUBLIC_APP_URL=http://localhost:3000-
Create a Convex account: Visit convex.dev and sign up
-
Create a new project in the Convex dashboard
-
Install Convex CLI (if not already installed):
npm install convex
-
Initialize Convex in your project:
npx convex init
Follow the prompts to connect your project to your Convex deployment.
-
Copy your deployment URL from the Convex dashboard and add it to your
.env.localfile -
Deploy your functions:
npx convex dev
Important: Keep the npx convex dev command running while developing. It automatically syncs your backend functions and database schema.
You need at least one OAuth provider. Here's how to set up both:
For local development:
stripe listen --forward-to http://localhost:3000/api/webhooks/stripeFor your deployed Vercel app:
stripe listen --forward-to https://ticketr-gilt.vercel.app/api/webhooks/stripe- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Configure consent screen if prompted
- Choose "Web application" as application type
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/google(for development)https://yourdomain.com/api/auth/callback/google(for production)
- Copy the Client ID and Client Secret to your
.env.localfile
- Go to GitHub Developer Settings
- Click "New OAuth App"
- Fill in the application details:
- Application name: Ticketr (or your preferred name)
- Homepage URL:
http://localhost:3000(for development) - Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Click "Register application"
- Copy the Client ID and generate a Client Secret
- Add both to your
.env.localfile
-
Create a Stripe account: Visit stripe.com and sign up
-
Enable Stripe Connect:
- Go to your Stripe dashboard
- Navigate to "Connect" in the sidebar
- Follow the setup process for your platform
-
Get your API keys:
- Go to "Developers" > "API keys" in your Stripe dashboard
- Copy your "Secret key" (starts with
sk_test_for test mode) - Add it to your
.env.localfile
-
Set up webhooks (see next section)
-
Install the Stripe CLI:
macOS (using Homebrew):
brew install stripe/stripe-cli/stripe
Windows (using Scoop):
scoop install stripe
Linux:
curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | sudo tee -a /etc/apt/sources.list.d/stripe.list sudo apt update sudo apt install stripe
-
Login to Stripe CLI:
stripe login
-
Start webhook forwarding:
stripe listen --forward-to localhost:3000/api/webhooks/stripe
-
Copy the webhook signing secret displayed in the terminal and add it to your
.env.local:STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxx
Note: Keep the webhook forwarding command running while testing payments locally.
- In your Stripe dashboard, go to "Developers" > "Webhooks"
- Click "Add endpoint"
- Set the endpoint URL to:
https://yourdomain.com/api/webhooks/stripe - Select the following events to listen for:
checkout.session.completedpayment_intent.succeededaccount.updatedpayout.paid
- Create the endpoint and copy the signing secret
- Add the signing secret to your production environment variables
Once everything is configured:
-
Start the development server:
npm run dev
-
In a separate terminal, start Convex:
npx convex dev
-
If testing payments, start Stripe webhook forwarding (in another terminal):
stripe listen --forward-to localhost:3000/api/webhooks/stripe
-
Open your browser and navigate to http://localhost:3000
To verify everything is working:
- Check the homepage loads without errors
- Test authentication by signing in with Google or GitHub
- Create a test event (you'll need to complete Stripe Connect onboarding)
- Test the queue system by creating an event with limited tickets
"Convex functions not found"
- Make sure
npx convex devis running - Check that your
NEXT_PUBLIC_CONVEX_URLis correct
"Authentication not working"
- Verify your OAuth credentials are correct
- Check that redirect URIs match exactly
- Ensure you're using the correct domain (localhost:3000 for development)
"Stripe payments failing"
- Confirm webhook forwarding is active with
stripe listen - Check that your
STRIPE_WEBHOOK_SECRETmatches the CLI output - Verify your
STRIPE_SECRET_KEYis correct
"Environment variables not loading"
- Ensure your file is named
.env.local(not.env) - Restart your development server after changing environment variables
- Check for any typos in variable names
- Check the Development Guide for advanced setup
- Review the Convex documentation
- Visit the Stripe documentation
- Create an issue on our GitHub repository
Once you have Ticketr running locally:
- Explore the codebase structure in the Development Guide
- Learn about the backend functions in the Convex README
- Try creating your first event and testing the queue system
- Consider contributing to the project!
Happy coding! 🎟️