Welcome to the ProjectPlannerAI StarterKit boilerplate! This is a github template which contains the following technology we feel is a great starting point for any new SaaS product.
Built with the Next.js 14 App Router, TypeScript, Drizzle ORM, Stripe, Shadcn & Tailwind CSS.
- 🔒 Authentication (Next-Auth)
- 🚨 Authorization
- 💳 Subscription Management (Stripe)
- 💵 Stripe Integration / Webhooks
- 🗂️ Todo Management
- 🌧️ Drizzle ORM
- 😎 Light / Dark Mode
- 🌟 Tailwind CSS & ShadCN
- ✅ Account Management
- 🔁 Changelog
- 📈 Analytics
- 💬 Feedback
We kept this project pretty simple but with enough functionality to allow you to start adding on new features as needed.
Start by clicking the "Use this template" button on the github repo. We suggest creating a new repository so you can track your code changes. After, clone your own repository down to your computer and start working on it.
This starter kit uses Docker and Docker Compose to run a postgres database, so you will need to either have those installed, or modify the project to point to a hosted database solution.
cp .env.sample .env
npm i
npm run dev
docker compose up
npm run db:push
This starter kit depends on a few external services, such as google oauth, stripe, etc. You'll need to following the steps below and make sure everything is setup and copy the necessary values into your .env file:
This starter kit assumes you will use the docker postgres locally, but if you'd rather use a third party database host, simply change your .env DATABASE_URL to point to your preferred postgres host.
This starter kit uses stripe which means you'll need to setup a stripe account at https://stripe.com. After creating an account and a project, you'll need to set the following env variables:
- STRIPE_API_KEY
- NEXT_PUBLIC_STRIPE_KEY
- STRIPE_WEBHOOK_SECRET
- PRICE_ID
- NEXT_PUBLIC_STRIPE_MANAGE_URL
How you can find these are outlined below:
You need to define both NEXT_PUBLIC_STRIPE_KEY and STRIPE_API_KEY inside of .env. These can get found here:
Depending on if you are developing locally or deploying to prod, there are two paths you need to take for getting a webhook key:
We provided an npm alias stripe:listen
you can run if you want to setup your locally running application to listen for any stripe events. Run this command and copy the webhook secret it prints to the console into your .env file.
When going to production, you'll need to create a webhook endpoint and copy your webhook secret into STRIPE_WEBHOOK_SECRET:
- https://dashboard.stripe.com/test/webhooks
- create an endpoint pointing to https://your-domain.com/api/webhooks/stripe
- listen for events invoice.payment_succeeded and checkout.session.completed
- find your stripe secret key and copy into your projects
You'll need to create a subscription product in stripe:
- https://dashboard.stripe.com/products/create
- Make your recurring product
- Copy the price id
- paste price id into .env of PRICE_ID
Stripe has a built in way for customers to cancel their subscriptions. You'll need to enable this feature:
- https://dashboard.stripe.com/settings/billing/portal
- Click activate portal link button
- Copy your portal link
- Paste as env variable as NEXT_PUBLIC_STRIPE_MANAGE_URL
After you create your project inside of https://projectplannerai.com, copy your project id from your url and set in:
- NEXT_PUBLIC_PROJECT_PLANNER_ID
When deplying to production, you want to set HOSTNAME to your FQDN, such as https://you-domain.com
We use Next-Auth for our authentication library. In order to get this start kit setup correctly, you need to setup a google provider.
By default, this starter only comes with the google provider which you'll need to setup:
- https://console.cloud.google.com/apis/credentials
- create a new project
- setup oauth consent screen
- create credentials - oauth client id
- for authorized javascript origins
- Authorized redirect URIs
- Set your google id and secret inside of .env
- GOOGLE_CLIENT_ID
- GOOGLE_CLIENT_SECRET
- run
openssl rand -base64 32
and set NEXTAUTH_SECRET (this is used for signing the jwt)
Everyone is welcome to contribute to this project. Feel free to open an issue if you have question or found a bug. We want to keep this starter simple with the core technology picked, so we don't recommend trying to add in various things without prior approval.