Skip to content
项目

关于

带身份验证功能的 Next.js 起始项目,包含 React 17、TypeScript、Tailwind CSS 2、React Query 3、GitHub 身份验证、LinkedIn 身份验证、无密码身份验证、FaunaDB、ESLint、Prettier 和 Husky。

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
-1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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

探索相关项目

加载中…