Next.js Prisma Azure MySQL Starter
Type: Code
Framework: Next.js
CSS: Tailwind
Database: Azure MySQL
- Project Overview: A Next.js application integrated with Prisma for database connections to an Azure MySQL database, styled with Tailwind CSS.
- Prerequisites:
- Installation of Node.js.
- Creation of an Azure database for MySQL Flexible Server, requiring a free Azure account if not already available.
- Database Setup:
- In the Azure portal, under MySQL Flexible Server resource, add a new database named
products
.
- In the Azure portal, under MySQL Flexible Server resource, add a new database named
- Starter App Setup:
- Utilize
create-next-app
via npm, Yarn, or pnpm to initialize the Next.js application.
- Utilize
- SSL Certificate:
- Download the DigiCertGlobalRootCA.crt.pem and place it in the Prisma folder for secure SSL authentication.
- MySQL Connection String:
- Formulate the connection string using the provided admin credentials and server details, ensuring
sslaccept=strict
is included for SSL.
- Formulate the connection string using the provided admin credentials and server details, ensuring
- Environment Configuration:
- Set the MySQL connection string as an environment variable in the Vercel project settings.
- Database Schema Deployment:
- Use Prisma to push the database schema to the Azure MySQL database named
products
.
- Use Prisma to push the database schema to the Azure MySQL database named
- Database Seeding:
- Execute the seed script to populate the database with initial data for Products and Categories.
- Running the App:
- Start the application locally using
npm run dev
and access it atlocalhost:3000
.
- Start the application locally using
- Deployment:
- With the application running locally, proceed to deploy it on Vercel for wider accessibility.