Skip to content

Commit

Permalink
🔴 feat(auth): deprecate clerk because i18n errors
Browse files Browse the repository at this point in the history
Any implementation of internalization and the existence of Clerk in middleware.ts leads to strange problems, for example, PageSpeed Insights crashes with a 401 status code.
  • Loading branch information
blefnk committed Aug 26, 2023
1 parent 3a66fa8 commit 2d4ff94
Show file tree
Hide file tree
Showing 139 changed files with 5,345 additions and 421 deletions.
83 changes: 56 additions & 27 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
# ?? =======================================================================
# ** Install VS Code ext `aaron-bond.better-comments` for better experience.
# ** -----------------------------------------------------------------------
# Since the ".env" file is gitignored, you can use the ".env.example" file
# 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.
# ** -----------------------------------------------------------------------
# When adding additional environment variables, the schema in "/src/env.mjs"
# should be updated accordingly.
# ?? =======================================================================

# !! [DB] DRIZZLE: PLANETSCALE (https://planetscale.com)
# ?========================================================
# !! NEVER COMMIT .env FILE !! ONLY COMMIT .env.example !!
# Improve Your VS Code Experience with the `aaron-bond.better-comments` Extension.
# Default Environment Variable Values. Define default values for environment variables required to run the app.
# Overriding Defaults. These defaults can be overridden by environment-specific .env files, such as .env.development,
# and local .env files like .env.local and .env.development.local.
# Important: No Secrets Here. Never store secrets in this file. Store sensitive information in a .env.local file
# or an environment-specific local .env file, like .env.development.local or .env.test.local.
# Do not commit these local env files to source control.
# Getting Started. If you're new or cloning the repo, use the ".env.example" file as a template to create your ".env" file.
# Keep this file current when adding new variables to `.env`.
# Use Caution When Committing. Remember that this file will be committed to version control. Ensure it does not contain secrets.
# When cloning this repo, create a copy named ".env" and add your secrets.
# Schema Updates. When adding new environment variables, update the schema in "/src/env.mjs" accordingly.
# ?========================================================

# !! DRIZZLE: PLANETSCALE (https://planetscale.com)

# 1) Get the Database data from the "prisma" dropdown selector in PlanetScale.
# 2) Change the query params at the end of the URL to "?ssl={"rejectUnauthorized":true}"

# ?? [4] mysql://<...>?ssl={"rejectUnauthorized":true}
DATABASE_URL=""

# !! COMMON CREDENTIALS

# Default host for the app
# Use the production URL when deploying to production, e.g. https://example.com
NEXT_PUBLIC_APP_URL="http://localhost:3000"

# Google Analytics (for `nextjs-google-analytics`)
# e.g. G-UA-123456789-0
NEXT_PUBLIC_GA_MEASUREMENT_ID=""

# Authentication JWT Secret (`openssl rand -base64 32`)
NEXTAUTH_SECRET=""

# Temporary
NEXTAUTH_URL="http://localhost:3000"
VERCEL_URL=""
NEXT_PUBLIC_VERCEL_URL=""

# !! CLERK CREDENTIALS (https://clerk.com)

# pk_test, and sk_test are development keys
Expand All @@ -33,12 +52,6 @@ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=""
# ?? [7] sk_test_****
CLERK_SECRET_KEY=""

# !! RELIVATOR CREDENTIALS (https://relivator.bleverse.com)

# Use the production URL when deploying to production, e.g. https://example.com
# ?? [8] For dev env: http://localhost:3000
NEXT_PUBLIC_APP_URL="http://localhost:3000"

# !! FILE UPLOADING (https://uploadthing.com)

# ?? [10] sk_live_****
Expand All @@ -63,12 +76,12 @@ STRIPE_API_KEY=""
STRIPE_WEBHOOK_SECRET=""

# ?? [15] Store Item | price_****
# Stripe Product and Price IDs for your created products
# Stripe Product and Price IDs for your created products
# found at https://dashboard.stripe.com/test/products
STRIPE_STD_MONTHLY_PRICE_ID=""

# ?? [16] Subscription | price_****
# Stripe Product and Price IDs for your created products
# Stripe Product and Price IDs for your created products
# found at https://dashboard.stripe.com/test/products
STRIPE_PRO_MONTHLY_PRICE_ID=""

Expand All @@ -80,7 +93,7 @@ STRIPE_PRO_MONTHLY_PRICE_ID=""
# ?? [17] whsec_****
STRIPE_WEBHOOK_SECRET=""

# !! RESEND (REACT EMAIL BUILDER)
# !! RESEND (https://resend.com) (REACT EMAIL BUILDER)

# Resend API Key found at https://resend.com/api-keys

Expand All @@ -91,8 +104,8 @@ RESEND_API_KEY=""
# Or we can use this email provided by resend for only testing: "[email protected]"
# It is not recommended tho

# ?? [19] mail@example.com
EMAIL_FROM_ADDRESS=""
# ?? [19] e.g. "Relivator <hello@example.dev>"
EMAIL_FROM=""

# !! LOGLIB (https://loglib.io)
# ?? ***_***
Expand Down Expand Up @@ -143,3 +156,19 @@ GOOGLE_CLIENT_ID=""

# ?? [34]
GOOGLE_CLIENT_SECRET=""

# ============================================================================
# Default values for environment variables requried to run the app should be
# defined here.

# These variables will be overwritten by any environment-specific .env files,
# such as .env.development, and by and local .env files, such as .env.local and
# .env.development.local.
#
# This file should NOT contain any secrets. Secrets should be placed in a
# .env.local file, or in an environment-specific local .env file, such as
# .env.development.local or .env.test.local. Local env files should not be
# committed to source control.
#
# See https://nextjs.org/docs/basic-features/environment-variables
# ============================================================================
148 changes: 124 additions & 24 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,173 @@
const { defineConfig } = require("eslint-define-config");

const config = defineConfig({
env: { es2023: true, browser: true, node: true },
// ==============================================
// | Global: TypeScript + JavaScript + Jest |
// ==============================================

root: true,
env: {
es2023: true,
browser: true,
node: true
},
settings: {
"import/resolver": { typescript: { project: ["./tsconfig.json"] } },
tailwindcss: { callees: ["cn"], config: "./tailwind.config.ts" }
"import/resolver": {
typescript: {
project: ["./tsconfig.json"]
}
},
tailwindcss: {
callees: ["classNames", "clsx", "cls", "cva", "cn"],
config: "./tailwind.config.ts"
}
},
extends: [
"plugin:tailwindcss/recommended",
"next/core-web-vitals",
"eslint:recommended",
"prettier"
],

overrides: [
//! =========================================
//! | TypeScript EsLint Configuration Rules |
//! =========================================
// ============================================
// | Override: TypeScript |
// ============================================

{
files: ["*.ts", "*.tsx", "*.mts", "*.cts"],
files: ["*.ts", "*.tsx", "*.mts", "*.cts", "*.d.ts"],
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
ecmaVersion: "latest",
sourceType: "module"
},
plugins: ["@tanstack/query"],
extends: [
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:tailwindcss/recommended",
"next/core-web-vitals",
"prettier"
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:@typescript-eslint/strict-type-checked"
],
rules: {
// !! We are incrementally moving towards full and strict type safety.
// !! Accordingly, disabled rules will be eliminated in the future.
"@typescript-eslint/consistent-type-imports": [
"off"
// "warn",
// {
// prefer: "type-imports",
// fixStyle: "inline-type-imports"
// fixStyle: "inline-type-imports" // "separate-type-imports"
// }
],
"@typescript-eslint/no-unused-vars": [
"off"
// "warn",
// {
// argsIgnorePattern: "^_",
// caughtErrors: "none",
// varsIgnorePattern: "^_"
// }
],
// "@typescript-eslint/no-unused-vars": [
// "warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/consistent-type-definitions": [
/* "error", "type" */
"off"
],
"@tanstack/query/exhaustive-deps": "error",
"@tanstack/query/prefer-query-object-syntax": "error",
// !! Turn Back on When Things are Stable !!
"no-case-declarations": "off",
"@typescript-eslint/no-unnecessary-type-arguments": "off",
"@typescript-eslint/consistent-indexed-object-style": "off",
"no-constant-condition": "off",
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/no-meaningless-void-operator": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"@tanstack/query/prefer-query-object-syntax": "error",
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/require-await": "off",
"react-hooks/exhaustive-deps": "off",
"react/display-name": "off",
"react/no-unescaped-entities": "off",
"tailwindcss/classnames-order": "off",
"tailwindcss/enforces-shorthand": "off",
"tailwindcss/migration-from-tailwind-2": "off",
"tailwindcss/no-custom-classname": "off"
"tailwindcss/no-custom-classname": "off",
"import/order": [
"off"
// "error",
// {
// "newlines-between": "always",
// groups: [
// ["builtin", "external"],
// "internal",
// ["sibling", "parent"],
// "index",
// "object",
// "type"
// ],
// alphabetize: {
// order: "asc"
// }
// }
],
"sort-imports": [
"off"
// "error",
// {
// ignoreDeclarationSort: true
// }
]
}
},
//! =========================================
//! | JavaScript EsLint Configuration Rules |
//! =========================================

// ============================================
// | Override: JavaScript |
// ============================================

{
files: ["*.js", "*.jsx", "*.mjs", "*.cjs"],
extends: ["next/core-web-vitals"]
files: ["*.js", "*.jsx", "*.mjs", "*.cjs"]
},

// ============================================
// | Override: Jest (JavaScript) |
// ============================================

{
files: ["**/__tests__/**/*.{ts,tsx}", "**/*.test.{ts,tsx}"],
env: { "jest/globals": true },
plugins: ["jest"],
extends: [
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:jest-extended/all",
"plugin:jest/style",
"plugin:jest/all"
],
rules: {
// !! We are incrementally moving towards full and strict type safety.
// !! Accordingly, disabled rules will be eliminated in the future.
"@typescript-eslint/no-non-null-assertion": "off",
"jest/prefer-expect-assertions": "off",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
"jest/require-top-level-describe": "off"
}
}
]
});
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: ^8.6.0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- run: pnpm run setup
- run: pnpm run check
2 changes: 1 addition & 1 deletion .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: "fake"
CLERK_SECRET_KEY: "fake"
RESEND_API_KEY: "fake"
EMAIL_FROM_ADDRESS: "[email protected]"
EMAIL_FROM: "[email protected]"
UPLOADTHING_SECRET: "fake"
UPLOADTHING_APP_ID: "fake"
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: "fake"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ robots.txt
sitemap.xml
sitemap-*.xml

/src/data/db/dm/
# another files
/src/data/db/drizzle/
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"streetsidesoftware.code-spell-checker",
"yoavbls.pretty-ts-errors",
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint"
"davidanson.vscode-markdownlint",
"unifiedjs.vscode-mdx"
]
}
Loading

0 comments on commit 2d4ff94

Please sign in to comment.