nextjs-authentication-using-strapi-and-next-auth
nextjs-authentication-using-strapi-and-next-auth copied to clipboard
Application show how Next.js can be authenticated using Strapi and NextAuth.
Packages
1. Frontend: Next.js application
This application is the primary user-facing application. Once it’s up and running (see Development section), it’s available on http://localhost:3000/.
2. Backend: Dockerized Strapi application
Strapi is the leading open-source headless CMS. It’s 100% Javascript, fully customizable and developer-first.
Installation
1. Clone the application
git clone https://github.com/ghoshnirmalya/nextjs-authentication-using-strapi-and-next-auth
2. Install necessary dependencies for the frontend application
cd frontend && yarn install
3. Create a .env file and copy the contents from .env.example (present in frontend directory)
We might need to run the following command:
source .env
4. Create and copy the Google client credentials
Create a new Google OAuth Client and copy the credentials (Client ID and Client Secret) in your .env file.
5. Start the frontend application
From the frontend directory, we can run the following command to start our Next.js frontend application:
yarn dev
The above command will start the frontend application on http://localhost:3000/.
6. Go inside the directory of the backend package on another terminal window
cd backend
7. Start docker-compose
docker-compose up
We need to start Docker and then run the above command which will change the current directory to the backend package’s directory and then start the backend package. If everything goes well, it’ll be up and running on http://localhost:1337/graphql.
Other interesting repositories
- Strapi Next.js Boilerplate
- Hasura Next.js Boilerplate
- Hasura Next.js Trello Clone
- React Search Box
- LinkedIn Clone using Create React App
License
This project is licensed under the MIT License.