Skip to content

Frankva/next-mysql-crud

Repository files navigation

Next.js + MySQL + modif

This is a Next.js project that uses Prisma

Demo

https://next-mysql.vercel.app

Prerequisites

Set up the database

Create a new database with the following command:

Set up the starter Next.js app

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-mysql nextjs-mysql

Next, you'll need to create a database username and password through the CLI to connect to your application. If you'd prefer to use the dashboard for this step, you can find those instructions in the Connection Strings documentation and then come back here to finish setup.

First, create your .env file by renaming the .env.example file to .env:

cp .env.example .env

Next, using the PlanetScale CLI, create a new username and password for the branch of your database:

to put in .env

mysql://<USERNAME>:<PLAIN_TEXT_PASSWORD>@<ACCESS_HOST_URL>/<DATABASE_NAME>?sslaccept=strict

exemple with the database of xampp on windows11 (here the databae names db20230815)

DATABASE_URL=mysql://root@localhost/db20230815

Push the database schema = php spark migrate --all

npx prisma db push

Run the seed script to populate your database with Product and Category data.

npm run seed

Run the App

Run the app with following command:

npm run dev

Open your browser at localhost:3000 to see the running application.

perso

winget install --id OpenJS.NodeJS.LTS
npm install bootstrap

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published