Giter Site home page Giter Site logo

pbteja1998 / nextjs-starter Goto Github PK

View Code? Open in Web Editor NEW
442.0 10.0 48.0 4.79 MB

A starter project for next js with authentication - Contains React 17 + Typescript + Tailwind CSS 2 + React Query 3 + GitHub Auth + LinkedIn Auth + Password-less Auth + Fauna DB + ESLint + Prettier + Husky

Home Page: https://next-starter.bhanuteja.dev

License: MIT License

JavaScript 49.73% TypeScript 46.16% CSS 1.68% Shell 2.42%
vercel nextjs nextjs-starter nextjs-boilerplate authentication next-auth github-authentication github-auth passwordless-authentication passwordless-login

nextjs-starter's Introduction

nextjs-starter

A Next.js starter kit template with React 17 + Typescript + Tailwind CSS 2 + React Query 3 + NextAuth.js (with GitHub Auth + Passwordless Auth) + Fauna DB

MIT License

styled with prettier

Demo

Run Locally

  • Clone the project

      git clone https://github.com/pbteja1998/nextjs-starter.git
  • Go to the project directory

      cd nextjs-starter
  • Install dependencies

      yarn
  • Create .env.local and change env variables as per the instructions.

      cp .env.example .env.local
  • Setup the database by running the following command and pasting the Fauna Secret key when prompted. More details at fauna-schema-migrate.

      yarn setup-db
  • Start the server

      yarn dev

Environment Variables

To run this project, you will need to add the following environment variables to your .env.local file

  • NEXTAUTH_URL
    • This is the your application URL. Locally, you can set this to http://localhost:3000
  • SECRET
    • Set this to any randomly generated string
  • EMAIL_SERVER
    • This is the email server string. It's in the format of smtp://username:[email protected]:587. Replace username, password and smtp.example.com with your own credentials.
  • EMAIL_FROM
    • Your email address from which you are sending emails.
  • GITHUB_ID
  • GITHUB_SECRET
    • You need to create a GitHub OAuth App, and get the GITHUB_ID AND GITHUB_SECRET from that app.
    • You can follow these instructions.
    • When creating an oauth app for local development, you can set the Homepage URL to http://localhost:3000 and Authorization Callback URL to http://localhost:3000/api/auth/callback/github
  • LINKEDIN_ID
  • LINKEDIN_SECRET
    • You need to create an oauth app for LINKEDIN. You can set the callback URL to http://localhost:3000/api/auth/callback/linkedin
  • FAUNADB_SECRET
    • Create a new fauna server key and set this variable to that key

FAQ

How to run Fauna locally?

Please note that this is completely optional. You can directly create your database in Fauna cloud and directly use the secret you generate there.

We are using Fauna Dev docker container to run Fauna instance locally.

These are the instructions to setup Fauna container locally.

# Pull the latest Docker container:
docker pull fauna/faunadb:latest

# Verify that the container executes correctly:
docker run fauna/faunadb --help

After you installed this, you can start the container using the following command

docker run --rm --name faunadb -p 8443:8443 -p 8084:8084 fauna/faunadb

Please note that this will create a new instance of Fauna everytime you run it, and all the data will be cleared when you stop this container. For other config options and approaches, go through the documentation.

Changes you need to do in the template:

  • You have to set USE_FAUNA_DOCKER=true in your .env.local file
  • Everytime you start the docker container, you need to first apply the migrations. You can do it by running yarn setup-docker-db.
  • More details at fauna-schema-migrate and Fauna Dev.

Feedback & Support

For feedback and support, please open an issue in this repo.

License

MIT

Roadmap

TBD

Contributing

TBD

Deploying

Vercel

TBD

Netlify

TBD

nextjs-starter's People

Contributors

pbteja1998 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nextjs-starter's Issues

FQL + NextJS serializing JSON errors

@pbteja1998 great work on this starter! There are many examples out there with GraphQL and Fauna, but there is so much more one can do with FQL directly, so it is great to see some examples with NextJS and FQL ๐Ÿ‘

It may be slightly outside the goals of a starter, but I'm very curious to see some examples of working with React Query + FQL + getStaticProps. I really run into a lot of pain points at this step in the process because fauna document expressions like Ref and Time get me into Error serializing .dehydratedState.queries hell. It is frustrating to have to reformat the fauna response just I can pass it through as props. Would love to see how you proceed here, perhaps some basic examples added to the readme?

Docker file

I really enjoyed looking around this starter! I can imagine that many could benefit from having a Dockerfile present here.

fails at faunadb setup

good work i am trying to setup db and i am asked to input the provide a FaunaDB admin key or set the FAUNA_ADMIN_KEY environment and restart the tool.

how do i set the admin key? i created a key for the database but that doesn't seem to work.

Why React Query?

Just wanted to ask out of curiosity, why React Query instead of useSWR?

Error while installing dependencies

tabler-icons has peer-dependency on react 16.3 while this repo is using react 17. Hence this gives an error while trying to install dependencies. Can you please remove tabler-icons from dependencies?

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.