├── .all-contributorsrc ├── .env.example ├── .github ├── FUNDING.yml └── workflows │ ├── code-quality.yml │ ├── codeql-analysis.yml │ ├── codesee-arch-diagram.yml │ ├── pr-check.yml │ ├── pre-commit.yml │ └── review-dog.yml ├── .gitignore ├── .nvmrc ├── .pre-commit-config.yaml ├── .storybook ├── main.js └── preview.js ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── SECURITY.md ├── app └── layout.tsx ├── biome.json ├── bun.lockb ├── components.json ├── components ├── Button │ └── index.tsx ├── Counter │ └── index.tsx ├── Header │ ├── header.module.css │ ├── index.tsx │ └── types.ts ├── Layout │ └── index.tsx ├── ui │ └── card.tsx └── utils.ts ├── cspell-tool.txt ├── cspell.json ├── logger.ts ├── mocks ├── browser.ts ├── handlers.ts └── server.ts ├── next-env.d.ts ├── next.config.js ├── package.json ├── pages ├── _app.tsx ├── api │ ├── auth │ │ └── [...nextauth].ts │ └── hello.ts ├── contact.tsx ├── index.tsx └── ssr.tsx ├── postcss.config.js ├── prisma ├── migrations │ ├── 20221223143416_add_next_auth_schema │ │ └── migration.sql │ └── migration_lock.toml └── schema.prisma ├── public ├── favicon.ico ├── logo.svg └── mockServiceWorker.js ├── renovate.json ├── sandbox.config.json ├── screenshot.png ├── store ├── counter.ts └── index.ts ├── stories ├── Button.stories.tsx └── Header.stories.tsx ├── styles ├── Home.module.css └── globals.css ├── tests ├── Button.test.tsx └── Header.test.tsx ├── tsconfig.json ├── types └── next-auth.d.ts └── vitest.config.ts /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": ["README.md"], 3 | "imageSize": 100, 4 | "commit": false, 5 | "commitType": "docs", 6 | "commitConvention": "angular", 7 | "contributors": [ 8 | { 9 | "login": "jellydn", 10 | "name": "Dung Duc Huynh (Kaka)", 11 | "avatar_url": "https://avatars.githubusercontent.com/u/870029?v=4", 12 | "profile": "https://productsway.com/", 13 | "contributions": ["code", "doc"] 14 | }, 15 | { 16 | "login": "mikah13", 17 | "name": "Mike Hoang", 18 | "avatar_url": "https://avatars.githubusercontent.com/u/25890552?v=4", 19 | "profile": "https://mike-hoang-dev.vercel.app/", 20 | "contributions": ["code"] 21 | }, 22 | { 23 | "login": "salmansheri", 24 | "name": "Salman Sheriff", 25 | "avatar_url": "https://avatars.githubusercontent.com/u/95226945?v=4", 26 | "profile": "https://github.com/salmansheri", 27 | "contributions": ["code"] 28 | } 29 | ], 30 | "contributorsPerLine": 7, 31 | "skipCi": true, 32 | "repoType": "github", 33 | "repoHost": "https://github.com", 34 | "projectName": "next-app-starter", 35 | "projectOwner": "jellydn" 36 | } 37 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_API_MOCKING=yes/no 2 | NEXTAUTH_URL=http://localhost:3000 3 | EMAIL_SERVER= 4 | EMAIL_FROM= 5 | DATABASE_URL='postgresql://' 6 | SHADOW_DATABASE_URL='postgresql://' 7 | # Used to encrypt the NextAuth.js JWT, and to hash email verification tokens. This is the default value for the secret option in NextAuth and Middleware. 8 | NEXTAUTH_SECRET=JWT_SECRET_KEY 9 | 10 | # Github NextAuth Credentials 11 | GITHUB_ID= 12 | GITHUB_SECRET= 13 | 14 | 15 | # Google NextAuth Credentials 16 | GOOGLE_CLIENT_ID= 17 | GOOGLE_CLIENT_SECRET= -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [jellydn] 2 | ko_fi: dunghd 3 | -------------------------------------------------------------------------------- /.github/workflows/code-quality.yml: -------------------------------------------------------------------------------- 1 | name: Code quality 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | quality: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | # Give the default GITHUB_TOKEN write permission to commit and push the 12 | # added or changed files to the repository. 13 | contents: write 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | - name: Setup Biome 18 | uses: biomejs/setup-biome@v2 19 | with: 20 | version: latest 21 | - name: Run Biome 22 | run: biome ci . 23 | continue-on-error: true # Continue even if biome fails 24 | 25 | # Commit all changed files back to the repository 26 | - uses: stefanzweifel/git-auto-commit-action@v5 27 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ "main" ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ "main" ] 20 | schedule: 21 | - cron: '41 13 * * 6' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v4 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v3 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | 52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 53 | # queries: security-extended,security-and-quality 54 | 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v3 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 63 | 64 | # If the Autobuild fails above, remove it and uncomment the following three lines. 65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. 66 | 67 | # - run: | 68 | # echo "Run, Build Application using script" 69 | # ./location_of_script_within_repo/buildscript.sh 70 | 71 | - name: Perform CodeQL Analysis 72 | uses: github/codeql-action/analyze@v3 73 | -------------------------------------------------------------------------------- /.github/workflows/codesee-arch-diagram.yml: -------------------------------------------------------------------------------- 1 | # This workflow was added by CodeSee. Learn more at https://codesee.io/ 2 | # This is v2.0 of this workflow file 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request_target: 8 | types: [opened, synchronize, reopened] 9 | 10 | name: CodeSee 11 | 12 | permissions: read-all 13 | 14 | jobs: 15 | codesee: 16 | runs-on: ubuntu-latest 17 | continue-on-error: true 18 | name: Analyze the repo with CodeSee 19 | steps: 20 | - uses: Codesee-io/codesee-action@v2 21 | with: 22 | codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} 23 | -------------------------------------------------------------------------------- /.github/workflows/pr-check.yml: -------------------------------------------------------------------------------- 1 | name: Linter & Typecheck 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | workflow_dispatch: 10 | jobs: 11 | typecheck: 12 | runs-on: ubuntu-latest 13 | continue-on-error: true 14 | steps: 15 | - name: 🛑 Cancel Previous Runs 16 | uses: styfle/cancel-workflow-action@0.12.1 17 | - id: checkout 18 | name: Checkout 19 | uses: actions/checkout@v4 20 | - name: Install bun 21 | uses: oven-sh/setup-bun@v2 22 | - name: Install dependencies 23 | run: bun install 24 | - id: Typecheck 25 | name: Checking Typescript Error 26 | run: | 27 | bun run typecheck 28 | linter: 29 | runs-on: ubuntu-latest 30 | continue-on-error: true 31 | steps: 32 | - name: 🛑 Cancel Previous Runs 33 | uses: styfle/cancel-workflow-action@0.12.1 34 | - id: checkout 35 | name: Checkout 36 | uses: actions/checkout@v4 37 | - name: Install bun 38 | uses: oven-sh/setup-bun@v2 39 | - name: Install dependencies 40 | run: bun install 41 | - id: linter 42 | name: Linter check 43 | run: | 44 | bun run lint 45 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: pre-commit 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: [main] 7 | 8 | jobs: 9 | pre-commit: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | # Give the default GITHUB_TOKEN write permission to commit and push the 13 | # added or changed files to the repository. 14 | contents: write 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: actions/setup-python@v5 18 | - name: Install pre-commit 19 | run: pip install pre-commit 20 | 21 | - name: Run pre-commit 22 | run: pre-commit run --all-files 23 | continue-on-error: true # Continue even if pre-commit fails 24 | 25 | # Commit all changed files back to the repository 26 | - uses: stefanzweifel/git-auto-commit-action@v5 27 | -------------------------------------------------------------------------------- /.github/workflows/review-dog.yml: -------------------------------------------------------------------------------- 1 | name: reviewdog 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | review: 8 | name: Biome 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: read 12 | pull-requests: write 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: mongolyy/reviewdog-action-biome@v1 16 | with: 17 | github_token: ${{ secrets.github_token }} 18 | reporter: github-pr-review 19 | 20 | misspell: 21 | name: Misspell 22 | runs-on: ubuntu-latest 23 | permissions: 24 | contents: read 25 | pull-requests: write 26 | steps: 27 | - uses: actions/checkout@v4 28 | - name: misspell 29 | uses: reviewdog/action-misspell@v1 30 | with: 31 | github_token: ${{ secrets.github_token }} 32 | locale: "US" 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env 29 | .env.local 30 | .env.development.local 31 | .env.test.local 32 | .env.production.local 33 | 34 | # vercel 35 | .vercel 36 | 37 | .husky 38 | 39 | .eslintcache 40 | .vscode 41 | .yarn 42 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | lts/* 2 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/jellydn/sort-package-json 3 | rev: "1686d9d2ddfb065c4514c637ee4b9985dfbf01dd" # Use the sha / tag you want to point at 4 | hooks: 5 | - id: sort-package-json 6 | 7 | - repo: https://github.com/pre-commit/mirrors-prettier 8 | rev: "v4.0.0-alpha.8" # Use the sha or tag you want to point at 9 | hooks: 10 | - id: prettier 11 | # Those are not supported by biomejs yet, refer https://biomejs.dev/internals/language-support/ 12 | types_or: [html, css, markdown] 13 | - repo: https://github.com/biomejs/pre-commit 14 | rev: "v2.0.0-beta.1" # Use the sha / tag you want to point at 15 | hooks: 16 | - id: biome-check 17 | exclude: "package.json" 18 | additional_dependencies: ["@biomejs/biome@1.9.4"] 19 | -------------------------------------------------------------------------------- /.storybook/main.js: -------------------------------------------------------------------------------- 1 | import { mergeConfig } from 'vite'; 2 | 3 | export default { 4 | stories: [ 5 | '../stories/**/*.stories.mdx', 6 | '../stories/**/*.stories.@(js|jsx|ts|tsx)', 7 | ], 8 | addons: ['@storybook/addon-essentials', 'storybook-addon-designs'], 9 | framework: '@storybook/nextjs', 10 | async viteFinal(config) { 11 | // Merge custom configuration into the default config 12 | return mergeConfig(config, { 13 | // Add storybook-specific dependencies to pre-optimization 14 | optimizeDeps: { 15 | include: ['storybook-addon-designs'], 16 | }, 17 | }); 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /.storybook/preview.js: -------------------------------------------------------------------------------- 1 | export const parameters = { 2 | actions: { argTypesRegex: '^on[A-Z].*' }, 3 | controls: { 4 | matchers: { 5 | color: /(background|color)$/i, 6 | date: /Date$/, 7 | }, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib", 3 | "typescript.enablePromptUseWorkspaceTsdk": true 4 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Huynh Duc Dung 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to next-app-starter 👋 2 | 3 | 4 | 5 | [![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) 6 | 7 | 8 | 9 | ![Version](https://img.shields.io/badge/version-0.1.0-blue.svg?cacheSeconds=2592000) 10 | [![Twitter: jellydn](https://img.shields.io/twitter/follow/jellydn.svg?style=social)](https://twitter.com/jellydn) 11 | 12 | > Another awesome starter for your app 13 | 14 | [![ITMan - NextJs Course!](https://i.ytimg.com/vi/CwjySicuyGQ/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLB1EtLZ4uPu5V_IEKBZ4jQQsDlIzg")](https://www.youtube-nocookie.com/embed/videoseries?list=PLOdXIcVPTyB_2IiS36upNkEw2fLhyb5D6) 15 | 16 | ## 🏠 [Homepage](https://github.com/jellydn/next-app-starter) 17 | 18 | ### ✨ [Demo](https://next-app-starter.vercel.app) 19 | 20 | ![screenshot](./screenshot.png) 21 | 22 | ## Pre-requirements 23 | 24 | - [Bun — A fast all-in-one JavaScript runtime](https://bun.sh/) 25 | - [Biome, toolchain of the web](https://biomejs.dev/) 26 | 27 | ## 💻 Stack 28 | 29 | - [NextJS: the React Framework for Production](https://nextjs.org/docs) 30 | - [Tailwindcss: rapidly build modern websites without ever leaving your HTML](https://tailwindcss.com/) 31 | - [shadcn/ui: Beautifully designed components built with Radix UI and Tailwind CSS.](https://github.com/shadcn/ui) 32 | - [Jotai: primitive and flexible state management for React.](https://docs.pmnd.rs/jotai/introduction) 33 | - [Prisma: next-generation ORM for Node.js and TypeScrip](https://www.prisma.io/) 34 | - [NextAuth.js: Authentication for Next.js](https://next-auth.js.org/v3/getting-started/introduction) 35 | - [next-validations: NextJS API Validations, support Yup, Fastest-Validator, Joi, and more](https://next-validations.productsway.com/) 36 | - [zod: TypeScript-first schema validation with static type inference](https://github.com/colinhacks/zod) 37 | - [consola: Elegant Console Logger for Node.js and Browser 🐨](https://github.com/unjs/consola) 38 | - [Storybook: build bulletproof UI components faster](https://storybook.js.org) 39 | - [React-hook-form: performance, flexible and extensible forms with easy-to-use validation](https://www.react-hook-form.com/) 40 | - [react-testing: simple and complete testing utilities that encourage good testing practices](https://testing-library.com/) 41 | - [React-query: performant and powerful data synchronization for React](https://react-query.tanstack.com/) 42 | 43 | ## 📝 Project Summary 44 | 45 | - [**app**](app): Main application logic and entry point. 46 | - [**components**](components): Reusable UI components. 47 | - [**pages**](pages): Individual pages/views of the application. 48 | - [**prisma**](prisma): Database ORM and migration scripts. 49 | - [**public**](public): Static assets accessible to the public. 50 | - [**store**](store): State management for the application. 51 | - [**tests**](tests): Unit and integration tests. 52 | - [**types**](types): Custom TypeScript types and interfaces. 53 | - [**storybook**](storybook): Component library and documentation. 54 | - [**.github/workflows**](.github/workflows): CI/CD workflows for GitHub Actions. 55 | 56 | ## Install 57 | 58 | ```sh 59 | bun install 60 | ``` 61 | 62 | ## Usage 63 | 64 | Create .env file base on .env.example then run below command 65 | 66 | ```sh 67 | bun run dev 68 | ``` 69 | 70 | ## Run tests 71 | 72 | ```sh 73 | bun run test 74 | ``` 75 | 76 | ## Run storybook 77 | 78 | ```sh 79 | bun run storybook 80 | ``` 81 | 82 | ## Pre-commit 83 | 84 | This project uses [pre-commit](https://pre-commit.com/) to enforce code quality and consistency. To install pre-commit hooks, run: 85 | 86 | ```sh 87 | pre-commit install 88 | ``` 89 | 90 | ## 📄 License 91 | 92 | This project is licensed under the **MIT License** - see the [**MIT License**](https://github.com/jellydn/next-app-starter/blob/main/LICENSE) file for details. 93 | 94 | ## Author 95 | 96 | - Website: https://productsway.com/ 97 | - Twitter: [@jellydn](https://twitter.com/jellydn) 98 | - Github: [@jellydn](https://github.com/jellydn) 99 | 100 | ## Start History 🌟 101 | 102 | [![Star History Chart](https://api.star-history.com/svg?repos=jellydn/next-app-starter&type=Date)](https://star-history.com/#jellydn/next-app-starter) 103 | 104 | ## Show your support 105 | 106 | [![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/dunghd) 107 | [![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/dunghd) 108 | [![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/dunghd) 109 | 110 | Give a ⭐️ if this project helped you! 111 | 112 | ## Contributors ✨ 113 | 114 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
Dung Duc Huynh (Kaka)
Dung Duc Huynh (Kaka)

💻 📖
Mike Hoang
Mike Hoang

💻
Salman Sheriff
Salman Sheriff

💻
128 | 129 | 130 | 131 | 132 | 133 | 134 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 135 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /app/layout.tsx: -------------------------------------------------------------------------------- 1 | import Script from 'next/script'; 2 | import { ReactNode } from 'react'; 3 | 4 | function RootLayout({ 5 | // Layouts must accept a children prop. 6 | // This will be populated with nested layouts or pages 7 | children, 8 | }: { 9 | readonly children: ReactNode; 10 | }) { 11 | return ( 12 | 13 | 14 |