An open API service indexing awesome lists of open source software.

https://github.com/code4mk/nextjs-friend

nextjs friend will be your nextjs boilerplate friend.
https://github.com/code4mk/nextjs-friend

nextjs nextjs-boilerplate

Last synced: 10 months ago
JSON representation

nextjs friend will be your nextjs boilerplate friend.

Awesome Lists containing this project

README

          

# Nextjs-Friend
nextjs friend is a nextjs boilerplate.

# Features
* layout system
* middleware (hoc)
* redux
* organize folder structure

## layout
All layouts will live inside layout folder. Then register your layout `./utils/nextjs-friend.tsx`

```tsx
let LayoutEnum: any = {
'base': Base,
}
```

* usages of layout

```tsx
import type { NextPage } from 'next'
import FriendHoc from '@utils/nextjs-friend'

const YourPageName: NextPage = () => {
return (


// your code

)
}

export default FriendHoc(YourPageName, {
layout: 'base',
})
```

# middleware

Auth middleware.

```tsx
export default FriendHoc(YourPageName, {
middleware: ['auth'],
})
```

# redux

redux (redux-toolkit) code will live inside `store` folder

* how to use redux toolkit with nextjs-friend.

```tsx
import { useAppSelector, useAppDispatch } from '@utils/redux-friend'

function YourPage() {
const dispatch = useAppDispatch()
const getReduxState = useAppSelector((state: any) => state.name.data)
}
export default YourPage
```

# Run project

* clone the project.

```bash
yarn install
yarn dev
# with ssr
yarn dev-server
```