Installation
Install Dependencies
Using pnpm
:
pnpm install
Or using npm
:
npm install
Or using Yarn
:
yarn install
Environment Variables
Create a .env.local
file in the root directory by copying the example:
cp .env.dist .env.local
Generate Auth Secret
- Generate the
AUTH_SECRET
variable using the following command:
npx auth secret
It should automatically add the secret to your .env.local
file:
AUTH_SECRET=your_generated_auth_secret
Generate Encryption Key for Passwords
- Run the following command to generate an encryption key:
openssl rand -base64 32
- Add the generated key to your
.env
file:
ENCRYPTION_KEY=your_generated_key
Configure Password Salt Rounds
-
Choose a Salt Rounds Value: Decide on the number of salt rounds for hashing passwords. A minimum of 10 is recommended for security.
-
Add to Environment File: Add the chosen number of salt rounds to your
.env.local
file:
PASSWORD_SALT_ROUNDS=your_chosen_number
Database Setup
- Configure Database URL
Ensure your .env.local
file has the correct DATABASE_URL
. For example:
DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
- Run Migrations
Apply database migrations in development:
pnpm migrate:dev
- Run Seeds (Optional)
After running migrations, you can optionally run seeds to populate your database with initial data:
pnpm db:seed
- Update Prisma Client
Whenever you make changes to schema.prisma
, regenerate the Prisma Client with:
npx prisma generate
What It Does:
- Reads Your Prisma Schema: The command looks at your
schema.prisma
file. - Generates Prisma Client: Based on the schema, it generates the Prisma Client code.
- Type-Safety and Autocompletion: The generated client is fully typed based on your schema.
Running the Project
Start the development server:
pnpm dev
Or using npm
:
npm run dev
Or using Yarn
:
yarn dev
Open http://localhost:3000 in your browser to see the application.