-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1d7f56
commit 9aaeed7
Showing
1 changed file
with
107 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,118 @@ | ||
# Create T3 App | ||
<div align='center'><img src='https://github.com/d-ivashchuk/cascade/assets/29632358/19f1472d-073b-463d-b446-4547628fad04'> | ||
</div> | ||
|
||
This is a [T3 Stack](https://create.t3.gg/) project bootstrapped with `create-t3-app`. | ||
<div align="center"> | ||
<h2>Open source SaaS starter kit </h2> | ||
</div> | ||
|
||
## What's next? How do I make an app with this? | ||
## Quickstart guide | ||
|
||
We try to keep this project as simple as possible, so you can start with just the scaffolding we set up for you, and add additional things later when they become necessary. | ||
Clone the repo: | ||
|
||
If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help. | ||
```bash | ||
git clone https://github.com/d-ivashchuk/cascade.git | ||
``` | ||
Spin up Postgres in docker headless mode. (Skip this step if you have a managed DB and have a connection string) | ||
|
||
- [Next.js](https://nextjs.org) | ||
- [NextAuth.js](https://next-auth.js.org) | ||
- [Prisma](https://prisma.io) | ||
- [Drizzle](https://orm.drizzle.team) | ||
- [Tailwind CSS](https://tailwindcss.com) | ||
- [tRPC](https://trpc.io) | ||
```bash | ||
docker compose up -d | ||
``` | ||
|
||
## Learn More | ||
Copy env variables from the example: | ||
|
||
To learn more about the [T3 Stack](https://create.t3.gg/), take a look at the following resources: | ||
```bash | ||
cp .example.env .env | ||
``` | ||
|
||
Be sure to populate database urls, at this stage they are most important thing to get started locally: | ||
|
||
```.env | ||
POSTGRES_PRISMA_URL="postgresql://admin:admin@localhost:5432/cascade_db" | ||
POSTGRES_URL_NON_POOLING="postgresql://admin:admin@localhost:5432/cascade_db" | ||
``` | ||
|
||
Migrate Prisma & generate client: | ||
|
||
``` | ||
npx prisma migrate dev | ||
``` | ||
|
||
Install dependencies & run application | ||
|
||
``` | ||
pnpm install && pnpm run dev | ||
``` | ||
|
||
## Authentication | ||
|
||
Set up authentication providers for Next Auth to be able to sign in locally. | ||
|
||
[Discord guide](https://next-auth.js.org/providers/discord) | ||
[Google guide](https://next-auth.js.org/providers/google) | ||
|
||
```.env | ||
# Next Auth Google Provider | ||
NEXTAUTH_SECRET="super-secret" | ||
NEXTAUTH_URL="http://localhost:3000" | ||
# Next Auth Discord Provider | ||
DISCORD_CLIENT_ID="1221505542334320741" | ||
DISCORD_CLIENT_SECRET="svqvMp9XYtXDbmK3SDEjQFUKphOLc-wK" | ||
``` | ||
|
||
## Background jobs | ||
|
||
Setup trigger for the first time: | ||
|
||
[Trigger.dev guide](https://trigger.dev/docs/documentation/quickstarts/nextjs) | ||
|
||
Run `npx @trigger.dev/cli@latest dev` in the project directory after setup to establish the channel. You need to setup Slack integration with trigger for notifications to work. | ||
|
||
```.env | ||
#Trigger.dev | ||
TRIGGER_API_KEY=tr_dev_XXX | ||
TRIGGER_API_URL=https://api.trigger.dev | ||
NEXT_PUBLIC_TRIGGER_PUBLIC_API_KEY=pk_dev_2AO1S8wxhEG8kZSTphsw | ||
``` | ||
|
||
## Payments | ||
|
||
Once you have created an account and store on Lemon Squeezy, make sure you're in **Test mode**, then go to [Settings > API](https://app.lemonsqueezy.com/settings/api) and create a new API key. Copy the key and paste it into `.env` file where it says `LEMON_SQUEEZY_API_KEY=`. | ||
|
||
You will also need the store ID from Lemon Squeezy for `LEMON_SQUEEZY_STORE_ID`, which you can find in the list at [Settings > Stores](https://app.lemonsqueezy.com/settings/stores). | ||
|
||
Finally, you will need to add a random webhook secret in `LEMON_SQUEEZY_WEBHOOK_SECRET`. A webhook secret is a security key that ensures data received from a webhook is genuine and unaltered, safeguarding against unauthorized access. | ||
|
||
Create `LEMON_SQUEEZY_WEBHOOK_URL="https://cascade.loca.lt/api/lemon-squeezy/webhook"` env var | ||
|
||
Go to `http://localhost:3000/ls-setup` and click a button to create the webhook on Lemon Squeezy. You are ready to create test subscriptions | ||
|
||
```.env | ||
#Lemon Squeezy | ||
LEMON_SQUEEZY_API_KEY="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.XXX" | ||
LEMON_SQUEEZY_STORE_ID="XXX" | ||
LEMON_SQUEEZY_WEBHOOK_SECRET="secret" | ||
LEMON_SQUEEZY_WEBHOOK_URL="https://cascade.loca.lt/api/lemon-squeezy/webhook" | ||
``` | ||
|
||
## Transactional emails | ||
|
||
Register on Loops, get trough onboarding setup and get api key to onboarding emails working. | ||
|
||
```.env | ||
#Loops | ||
LOOPS_API_KEY="d22b8f8bdf8a57f41938d5780a444b8d" | ||
``` | ||
|
||
## Posthog analytics | ||
|
||
Register on Posthog, get trough onboarding and paste api keys: | ||
|
||
```.env | ||
NEXT_PUBLIC_POSTHOG_API_KEY="phc_eKxBLltchl3KHuezun4XR88arI8nOCiMDN4WcQ6KuN9" | ||
NEXT_PUBLIC_POSTHOG_HOST="https://app.posthog.com" | ||
``` | ||
|
||
- [Documentation](https://create.t3.gg/) | ||
- [Learn the T3 Stack](https://create.t3.gg/en/faq#what-learning-resources-are-currently-available) — Check out these awesome tutorials | ||
|
||
You can check out the [create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) — your feedback and contributions are welcome! | ||
|
||
## How do I deploy this? | ||
|
||
Follow our deployment guides for [Vercel](https://create.t3.gg/en/deployment/vercel), [Netlify](https://create.t3.gg/en/deployment/netlify) and [Docker](https://create.t3.gg/en/deployment/docker) for more information. |