This example demonstrates how to build a modern web application using:
- Next.js - React framework for production
- Drizzle ORM - TypeScript ORM for SQL databases
- MySQL - Popular open-source relational database
- Protect.js - Data protection and encryption library
- Full-stack TypeScript application
- Database migrations and schema management with Drizzle
- Data protection and encryption with Protect.js
- Modern UI with Tailwind CSS
- Form handling with React Hook Form and Zod validation
- Docker-based MySQL database setup
- Node.js 18+
- Docker and Docker Compose
- MySQL (if running locally without Docker)
-
Clone the repository and install dependencies:
npm install
-
Set up your environment variables: Copy the
.env.example
file to.env.local
:cp .env.example .env.local
Then update the environment variables in
.env.local
with your Protect.js configuration values. -
Start the MySQL database using Docker:
docker-compose up -d
-
Run database migrations:
npm run db:generate npm run db:migrate
-
Start the development server:
npm run dev
The application will be available at http://localhost:3000
.
/src
- Application source code/drizzle
- Database migrations and schema/public
- Static assetsdrizzle.config.ts
- Drizzle ORM configurationdocker-compose.yml
- Docker configuration for MySQL
npm run dev
- Start development servernpm run build
- Build for productionnpm run start
- Start production servernpm run db:generate
- Generate database migrationsnpm run db:migrate
- Run database migrations