Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kazukinagata/next-amplify-template
Boilerplate for Nextjs x Amplify
https://github.com/kazukinagata/next-amplify-template
amplify next-js nextjs-boilerplate nextjs-starter nextjs-typescript
Last synced: about 2 months ago
JSON representation
Boilerplate for Nextjs x Amplify
- Host: GitHub
- URL: https://github.com/kazukinagata/next-amplify-template
- Owner: kazukinagata
- License: mit
- Created: 2021-03-12T05:48:55.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-13T04:30:40.000Z (almost 4 years ago)
- Last Synced: 2024-08-02T11:15:37.352Z (5 months ago)
- Topics: amplify, next-js, nextjs-boilerplate, nextjs-starter, nextjs-typescript
- Language: TypeScript
- Homepage:
- Size: 72.3 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-aws-amplify-ja - Next.js x Amplify boilerplate
README
This is a [Next.js](https://nextjs.org/) x [Amplify](https://docs.amplify.aws/) boilerplate that includes following;
- [material-ui](https://github.com/mui-org/material-ui) with ssr support
- [styled-components](https://github.com/styled-components/styled-components) with ssr support
- [react-toastify](https://github.com/fkhadra/react-toastify)
- [nprogress](https://github.com/rstacruz/nprogress)
- Configured Amplify auth context, use `useAuthCtx` to retrieve current user
- Convenience utilities such as `callGraphQL` and `checkAuth` to use with typescript
- Simple withSSRAuth hoc for SSR## Getting Started
First, install amplify CLI if have not installed yet:
```bash
npm install -g @aws-amplify/cli
```Then initialize amplify project
```bash
amplify init
```Next, install packages and run the development server:
```bash
npm install
# or
yarn
``````bash
npm run dev
# or
yarn dev
```Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## Utils
### useAuthCtx
```typescript
const {data, loading} = useAuthCtx()
// data: CognitoUser | null
// loading: boolean```
### withSSRAuth
```typescript
// pages/index.tsxexport const getServerSideProps = withSSRAuth(async (ctx) => {
return {
props: {}
}
})
```## Lisence
MIT