npm install -g pnpm
pnpm install
pnpm drizzle-kit generate
pnpm db:migrate
pnpm db:seed # creates stripe products
Run vercel env pull .env.development.local to make the latest environment variables available to your project locally.
Once you have set up the environment variables and installed dependencies, run the development server:
pnpm dev
Then, also listen for Stripe webhooks locally through their CLI:
stripe listen --forward-to localhost:3000/api/stripe/webhook
Open http://localhost:3000 in your browser to see the app in action.
pnpm db:migrate
To test Stripe payments, use the following test card details:
- Card Number:
4242 4242 4242 4242
- Expiration: Any future date
- CVC: Any 3-digit number
When you're ready to deploy your SaaS application to production, follow these steps:
- Go to the Stripe Dashboard and create a new webhook for your production environment.
- Set the endpoint URL to your production API route (e.g.,
https://yourdomain.com/api/stripe/webhook
). - Select the events you want to listen for (e.g.,
checkout.session.completed
,customer.subscription.updated
).
- Push your code to a GitHub repository.
- Connect your repository to Vercel and deploy it.
- Follow the Vercel deployment process, which will guide you through setting up your project.
In your Vercel project settings (or during deployment), add all the necessary environment variables. Make sure to update the values for the production environment.
To run specs:
pnpm vitest