Giter Site home page Giter Site logo

santospatrick / nextjs-boilerplate-advanced Goto Github PK

View Code? Open in Web Editor NEW
43.0 3.0 8.0 3.42 MB

Next.js boilerplate made with Chakra-UI + Typescript + React-table + React-hook-form

Home Page: https://sample-nextjs-app.santospatrick.com

License: MIT License

JavaScript 2.27% TypeScript 95.22% Shell 0.09% Handlebars 2.42%
boilerplate chakra-ui chakra-ui-react nextjs react react-hook-form react-table storybook typescript netlify

nextjs-boilerplate-advanced's Introduction

santospatrick/nextjs-boilerplate-advanced

Next.js boilerplate made with Chakra-UI + Typescript + React-table + React-hook-form

Netlify Status eslint prettier typescript vscode

DigitalOcean Referral Badge SonarCloud

Usage

  1. Initialize your project with this command:
yarn create next-app -e https://github.com/santospatrick/nextjs-boilerplate-advanced
  1. Duplicate .env.example to .env.local fulfilling variables as needed
cp .env.example .env.local
  1. Run the following commands:
yarn install
yarn dev # start development server
  1. Done ๐ŸŽ‰

Deployment

  • Run the following commands:
yarn build # this command will fail if there is any Typescript or Lint errors
yarn start
  • Or, deploy on Netlify, Vercel (don't forget about environment variables):
Netlify Vercel
Deploy to Netlify Deploy with Vercel

Instructions

How to get the most out of this boilerplate ๐Ÿš€

Slides.com template presentation

Features

v1

  • Authentication screens pre-built
  • Server side rendering
  • Forms (compatible with react-hook-form)
    • Text Input (masked/normalized)
    • Date Input
    • Upload Input
    • Autocomplete/Select Input
    • Number Input
    • Phone Input
    • Textarea Input
    • Schema validation with yup
  • Data table with inline editing
  • Layouts
  • CRUD example
  • Modal with fullscreen option
  • Email templates for authentication flow
  • VSCode workspace recommendations
  • Profile page for user editing
  • Collapsable & nested menu
  • Code Generator (component, form, and page)
  • VSCode debug setup

v2

  • Advanced filter for data tables (like Notion)
  • Form builder

Technologies

  • Next.js
  • Typescript
  • Chakra UI
  • Next SEO
  • React Table
  • Eslint/Prettier
  • React Toastify
  • React Query
  • React Hook Form
  • NProgress
  • Git hooks
  • Perfect scrollbar
  • Mjml
  • useHooks Typescript
  • Utility Types
  • Storybook
  • Plop (Template Generator)

Storybook

In order to see storybook, run development server with following command:

yarn install # if you didn't yet :)
yarn storybook # start server at http://localhost:6006

Contributors

Patrick
Patrick Santos Bitonti Teixeira
Lincoln
Lincoln M. Costa

nextjs-boilerplate-advanced's People

Contributors

github-actions[bot] avatar lincolncosta avatar santospatrick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nextjs-boilerplate-advanced's Issues

`<ModalFullscreen />`: add `defaultSize` prop

Is your feature request related to a problem? Please describe.
A way of setting a size to <ModalFullscreen /> component

Describe the solution you'd like
Add a new prop called defaultSize

Describe alternatives you've considered
Accept all chakra-ui modal props

Additional context
No.

Logout user from all tabs

Describe the bug
User is not logged out until it refreshes all browser tabs that had the app opened.

To Reproduce
Steps to reproduce the behavior:

  1. Log in into the app
  2. Open more than one tab at the same time
  3. Choose one of the tabs to log out
  4. Other tabs won't log out the user

Expected behavior
User should log out immediately from all tabs.

Screenshots
โŒ

Desktop (please complete the following information):

  • Yes

Smartphone (please complete the following information):

  • Yes

Additional context
โŒ

Table duplication

Is your feature request related to a problem? Please describe.
Yes. Implementing one table for each entity can cause serious code duplication issues due to the tables having more lines than other type of files.

Describe the solution you'd like
Just one component for every table, for any entity.

Describe alternatives you've considered
Implementing a "Standard Table" that doesn't limits the current features of the current table system.

Change browser tab title

Describe the bug
When using any layout (example <PrivatePage />) change browser tab title

To Reproduce
Steps to reproduce the behavior:

  1. Use component's prop title
  2. Browser tab title won't change

Expected behavior
Expect browser tab title to change.

Screenshots
โŒ

Desktop (please complete the following information):

  • Yes

Smartphone (please complete the following information):

  • Yes

Additional context
โŒ

Storybook for `<DataTable />` component

Is your feature request related to a problem? Please describe.
No, just a lack of documentation.

Describe the solution you'd like
Document the <DataTable /> component in Storybook, just like other components.

Describe alternatives you've considered
None.

Additional context
No.

Set table filters in URL

Is your feature request related to a problem? Please describe.
Currently, table filters are cleared on page refresh.

Describe the solution you'd like
Add filters as query params in URL after form submit.

https://sample-nextjs-app.santospatrick.com/users?[email protected]

Describe alternatives you've considered
No.

Additional context
No.

Ask for "page layout" on page generator

Is your feature request related to a problem? Please describe.
No, it just adds more functionality and automation

Describe the solution you'd like
When generating new pages through script yarn generate, ask for which page layout a new page should use

Describe alternatives you've considered
Adding a new question to be asked inside nextjs-boilerplate-advanced/generators/plopfile.js file

Additional context
Something like this:

Screen Shot 2022-09-02 at 21 08 19

New hook `usePermissions()`

Is your feature request related to a problem? Please describe.
Getting user permissions require some coding, which may duplicate code with time.

Describe the solution you'd like
Create a hook usePermissions() which should return an array of logged in user permissions.

// to avoid this
const { user } = useContext(AuthContext);
const { data } = useQuery(
  "user-profiles",
  () => api.get(`users/${user?.id}`),
  {
    enabled: !!user?.id,
  }
);
console.log("profiles ==> ", data?.data.profiles);

Describe alternatives you've considered
Solution would be:

// ๐Ÿš€
const permissions = usePermissions();
console.log("profiles ==> ", permissions);

Additional context
No.

"How to use" mjml in readme

Is your feature request related to a problem? Please describe.
Currently it is not documented how to use mjml scripts in package.json for development

Describe the solution you'd like
Add tutorials on readme.

Describe alternatives you've considered
No.

Additional context
No.

Filter menu items by permission

Is your feature request related to a problem? Please describe.
Filter menu items based on user profiles.

Describe the solution you'd like
Create an attribute in menu items to set which profiles can/cannot see:

export const menu: MenuItem[] = [
  {
    icon: MdDashboard,
    text: "Dashboard",
    href: "/",
    profiles: ["ADMIN"] // <=====
  },
  // ...
]

Describe alternatives you've considered
No.

Additional context
No.

Use state managers to prevent 100x contexts

Is your feature request related to a problem? Please describe.
As the app grows, it is very common to create more and more React Contexts, which will make app slower.

Describe the solution you'd like
We could use something like RecoilJS (First announced in 2020)

Describe alternatives you've considered
No, please no Redux ๐ŸŒž

Additional context
No.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.