-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 0dff6a1
Showing
127 changed files
with
18,777 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Since .env is gitignored, you can use .env.example to build a new `.env` file when you clone the repo. | ||
# Keep this file up-to-date when you add new variables to \`.env\`. | ||
|
||
# This file will be committed to version control, so make sure not to have any secrets in it. | ||
# If you are cloning this repo, create a copy of this file named `.env` and populate it with your secrets. | ||
|
||
# The Supavisor URL is used to connect to your Supabase database | ||
POSTGRES_URL="postgres://postgres.[USERNAME]:[PASSWORD]@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?workaround=supabase-pooler.vercel" | ||
|
||
NEXT_PUBLIC_SUPABASE_URL="https://YOUR_PROJECT_REF.supabase.co" | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY="YOUR_ANON_KEY" |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thank you for taking the time to file a feature request. Please fill out this form as completely as possible. | ||
- type: textarea | ||
attributes: | ||
label: Describe the feature you'd like to request | ||
description: Please describe the feature as clear and concise as possible. Remember to add context as to why you believe this feature is needed. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe the solution you'd like to see | ||
description: Please describe the solution you would like to see. Adding example usage is a good way to provide context. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Additional information | ||
description: Add any other information related to the feature here. If your feature request is related to any issues or discussions, link them here. |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
github: trevorpfiz |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: 🐞 Bug Report | ||
description: Create a bug report to help us improve | ||
title: "bug: " | ||
labels: ["🐞❔ unconfirmed bug"] | ||
body: | ||
- type: textarea | ||
attributes: | ||
label: Provide environment information | ||
description: | | ||
Run this command in your project root and paste the results in a code block: | ||
```bash | ||
npx envinfo --system --binaries | ||
``` | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe the bug | ||
description: A clear and concise description of the bug, as well as what you expected to happen when encountering it. | ||
validations: | ||
required: true | ||
- type: input | ||
attributes: | ||
label: Link to reproduction | ||
description: Please provide a link to a reproduction of the bug. Issues without a reproduction repo may be ignored. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: To reproduce | ||
description: Describe how to reproduce your bug. Steps, code snippets, reproduction repos etc. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Additional information | ||
description: Add any other information related to the bug here, screenshots if applicable. |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": ["config:base"], | ||
"packageRules": [ | ||
{ | ||
"matchPackagePatterns": ["^@wellchart/"], | ||
"enabled": false | ||
} | ||
], | ||
"updateInternalDeps": true, | ||
"rangeStrategy": "bump", | ||
"automerge": true | ||
} |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: ["*"] | ||
push: | ||
branches: ["main"] | ||
merge_group: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
||
# You can leverage Vercel Remote Caching with Turbo to speed up your builds | ||
# @link https://turborepo.org/docs/core-concepts/remote-caching#remote-caching-on-vercel-builds | ||
env: | ||
FORCE_COLOR: 3 | ||
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup | ||
uses: ./tooling/github/setup | ||
|
||
- name: Copy env | ||
shell: bash | ||
run: cp .env.example .env | ||
|
||
- name: Lint | ||
run: pnpm lint && pnpm lint:ws | ||
|
||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup | ||
uses: ./tooling/github/setup | ||
|
||
- name: Format | ||
run: pnpm format | ||
|
||
typecheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup | ||
uses: ./tooling/github/setup | ||
|
||
- name: Typecheck | ||
run: pnpm typecheck |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
|
||
# testing | ||
coverage | ||
|
||
# next.js | ||
.next/ | ||
out/ | ||
next-env.d.ts | ||
|
||
# nitro | ||
.nitro/ | ||
.output/ | ||
|
||
# expo | ||
.expo/ | ||
expo-env.d.ts | ||
apps/expo/.gitignore | ||
apps/expo/ios | ||
apps/expo/android | ||
|
||
# production | ||
build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
dist/ | ||
|
||
# turbo | ||
.turbo |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node-linker=hoisted |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
20.12 |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"recommendations": [ | ||
"bradlc.vscode-tailwindcss", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"expo.vscode-expo-tools", | ||
"yoavbls.pretty-ts-errors" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Next.js", | ||
"type": "node-terminal", | ||
"request": "launch", | ||
"command": "pnpm dev", | ||
"cwd": "${workspaceFolder}/apps/nextjs/", | ||
"skipFiles": ["<node_internals>/**"] | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }], | ||
"eslint.experimental.useFlatConfig": true, | ||
"eslint.workingDirectories": [ | ||
{ "pattern": "apps/*/" }, | ||
{ "pattern": "packages/*/" }, | ||
{ "pattern": "tooling/*/" } | ||
], | ||
"tailwindCSS.experimental.classRegex": [ | ||
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], | ||
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] | ||
], | ||
"tailwindCSS.experimental.configFile": "./tooling/tailwind/web.ts", | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"typescript.preferences.autoImportFileExcludePatterns": [ | ||
"next/router.d.ts", | ||
"next/dist/client/router.d.ts" | ||
], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# T3 Turbo x Supabase | ||
|
||
![CleanShot 2023-04-11 at 23 42 53@2x](https://user-images.githubusercontent.com/51714798/231294720-1c64b391-4ecf-42d2-aad2-8c486c5d6bf5.png) | ||
|
||
## About | ||
|
||
This is an extended version of [create-t3-turbo](https://github.com/t3-oss/create-t3-turbo) implementing authentication using [Supabase Auth](https://supabase.com/docs/guides/auth) on both the web and mobile applications. | ||
|
||
### Side note for mobile | ||
|
||
**iOS:** One of the requirements for Apple's review process requires you to implement native `Sign in with Apple` if you're providing any other third party authentication method. Read more in [Section 4.8 - Design: Sign in with Apple](https://developer.apple.com/app-store/review/guidelines/#sign-in-with-apple). | ||
|
||
We have preconfigured this for you which you can find [here](./apps/expo/src/utils/auth.ts). All you need to do is to enable the Apple Provider in your [Supabase dashboard](https://app.supabase.com) and fill in your information. | ||
|
||
> We currently only supports `Sign in with Apple` - support for more providers on mobile are being worked on! | ||
## Quick Start | ||
|
||
To get it running, follow the steps below: | ||
|
||
### Setup dependencies | ||
|
||
```diff | ||
# Install dependencies | ||
pnpm i | ||
|
||
# Configure environment variables. | ||
# There is an `.env.example` in the root directory you can use for reference | ||
cp .env.example .env | ||
|
||
# Push the Drizzle schema to your database (w/ drizzle-kit push) | ||
pnpm db:push | ||
|
||
# Or use migrations (w/ drizzle-kit generate and the migrate script) | ||
pnpm db:generate | ||
pnpm db:migrate | ||
``` | ||
|
||
> Migrations seem preferable for Supabase. Still figuring out the best way to do migrations for local development/branching. <https://twitter.com/plushdohn/status/1780126181490135371> | ||
### Setting up Supabase | ||
|
||
1. Go to [the Supabase dashboard](https://app.supabase.com/projects) and create a new project. | ||
2. Under project settings, retrieve the environment variables `reference id`, `project url` & `anon public key` and paste them into [.env](./.env.example) and [apps/expo/.env](./apps/expo/.env.example) in the necessary places. You'll also need the database password you set when creating the project. | ||
3. Under `Auth`, configure any auth provider(s) of your choice. This repo is using Github for Web and Apple for Mobile. | ||
4. Setup a trigger when a new user signs up: <https://supabase.com/docs/guides/auth/managing-user-data#using-triggers>. Can run this in the SQL Editor. | ||
|
||
```sql | ||
-- inserts a row into public.profile | ||
create function public.handle_new_user() | ||
returns trigger | ||
language plpgsql | ||
security definer set search_path = public | ||
as $$ | ||
begin | ||
insert into public.tut_profile (id, email, name, image) | ||
values ( | ||
new.id, | ||
new.raw_user_meta_data ->> 'email', | ||
COALESCE( | ||
new.raw_user_meta_data ->> 'name', | ||
new.raw_user_meta_data ->> 'full_name', | ||
new.raw_user_meta_data ->> 'user_name', | ||
'[redacted]' | ||
), | ||
new.raw_user_meta_data ->> 'avatar_url' | ||
); | ||
return new; | ||
end; | ||
$$; | ||
|
||
-- trigger the function every time a user is created | ||
create trigger on_auth_user_created | ||
after insert on auth.users | ||
for each row execute procedure public.handle_new_user(); | ||
``` | ||
|
||
5. Remove access to the `public` schema as we are only using the server | ||
|
||
By default, Supabase exposes the `public` schema to the PostgREST API to allow the `supabase-js` client query the database directly from the client. However, since we route all our requests through the Next.js application (through tRPC), we don't want our client to have this access. To disable this, execute the following SQL query in the SQL Editor on your Supabase dashboard: | ||
|
||
```sql | ||
REVOKE USAGE ON SCHEMA public FROM anon, authenticated; | ||
``` | ||
|
||
![disable public access](https://user-images.githubusercontent.com/51714798/231810706-88b1db82-0cfd-485f-9043-ef12a53dc62f.png) | ||
|
||
> Note: This means you also don't need to enable row-level security (RLS) on your database if you don't want to. | ||
### Configure Expo `dev`-script | ||
|
||
#### Use iOS Simulator | ||
|
||
1. Make sure you have XCode and XCommand Line Tools installed [as shown on expo docs](https://docs.expo.dev/workflow/ios-simulator/). | ||
> **NOTE:** If you just installed XCode, or if you have updated it, you need to open the simulator manually once. Run `npx expo start` in the root dir, and then enter `I` to launch Expo Go. After the manual launch, you can run `pnpm dev` in the root directory. | ||
```diff | ||
+ "dev": "expo start --ios", | ||
``` | ||
|
||
3. Run `pnpm dev` at the project root folder. | ||
|
||
> **TIP:** It might be easier to run each app in separate terminal windows so you get the logs from each app separately. This is also required if you want your terminals to be interactive, e.g. to access the Expo QR code. You can run `pnpm --filter expo dev` and `pnpm --filter nextjs dev` to run each app in a separate terminal window. | ||
#### For Android | ||
|
||
1. Install Android Studio tools [as shown on expo docs](https://docs.expo.dev/workflow/android-studio-emulator/). | ||
2. Change the `dev` script at `apps/expo/package.json` to open the Android emulator. | ||
|
||
```diff | ||
+ "dev": "expo start --android", | ||
``` | ||
|
||
3. Run `pnpm dev` at the project root folder. | ||
|
||
## References | ||
|
||
- For more useful information on how to deploy this stack, refer to [t3-oss/create-t3-turbo](https://github.com/t3-oss/create-t3-turbo). | ||
- [Supabase Documentation](https://supabase.com/docs) | ||
- This stack originates from [create-t3-app](https://github.com/t3-oss/create-t3-app). | ||
- A [blog post](https://jumr.dev/blog/t3-turbo) where I wrote how to migrate a T3 app into this. |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
EXPO_PUBLIC_SUPABASE_URL="https://YOUR_PROJECT_REF.supabase.co" | ||
EXPO_PUBLIC_SUPABASE_ANON_KEY="YOUR_ANON_KEY" |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, | ||
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true | ||
} |
Oops, something went wrong.