GithubHelp home page GithubHelp logo

ryunishimura / nextjs-prisma Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 1.53 MB

Example of an application that integrates Prisma and Next.js 🔥

License: MIT License

Shell 0.48% JavaScript 2.94% TypeScript 96.08% CSS 0.50%

nextjs-prisma's Introduction

⚡️ Fullstack App with Next.js and Prisma

Next.js と Prisma を使用して、フルスタックアプリケーションを構築します。

構成

  • フロントエンド: Next.js(Vercel)
  • バックエンド: Next.js API
  • データベース: PostgreSQL(Heroku)
  • 認証: NextAuth

機能

  • 認証(NextAuth)
    • Google認証
    • 退会機能

開発環境

データベースのみDockerを使用します。

環境変数を設定してください。

cp .env.example .env.local

PostgreSQL(Docker)

docker-compose up # 👈 Dockerイメージのビルド
docker-compose build # 👈 Dockerの起動

Next.js(ローカル)

yarn install # 👈 依存関係のインストール
npx prisma generate # 👈 Prismaの設定の読み込み
npx prisma migrate dev # 👈 Migration
npx prisma migrate reset  # ⚠️ DB Reset
yarn dev # 👈 Next.jsアプリケーションの起動

環境変数

Key 解説
GOOGLE_CLIENT_ID xxxxx Google認証で使用する
GOOGLE_CLIENT_SECRET xxxxx Google認証で使用する
DATABASE_URL mysql://root:password@localhost:3306/db Prismaで接続するデータベース
NEXTAUTH_URL http://localhost:3000 NextAuthで使用するURL

Google認証の設定は、OAuth 同意画面 – APIとサービスからできます。

  • 承認済みJavaScriptの生成元: http://localhost:3000
  • 承認済みのリダイレクトURL: http://localhost:3000/api/auth/callback/google

🔥 More...

このプロジェクトでは、VercelのServerless Functionsを使用していますが、 APIサーバとして、機能な壁にぶつかった場合は、ExpressやNest.jsへの切り替えを検討してください。

nextjs-prisma's People

Contributors

dependabot[bot] avatar ryunishimura avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.