Skip to content

Installation

This guide will walk you through setting up Learnify on your local machine.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 18.0 or higher
  • npm or yarn or pnpm
  • Git

You'll also need accounts for:

  • PostgreSQL Database - Neon (recommended) or local PostgreSQL
  • Stripe - For payment processing
  • Cloudinary - For media storage

Step 1: Clone the Repository

git clone https://github.com/alfredang/Learnify.git
cd Learnify

Step 2: Install Dependencies

npm install

Or if you prefer yarn:

yarn install

Step 3: Set Up Environment Variables

Copy the example environment file:

cp .env.example .env

Open .env and fill in your credentials. See the Configuration guide for details on each variable.

Step 4: Set Up the Database

Generate the Prisma client:

npx prisma generate

Push the schema to your database:

npm run db:push

Seed the database with sample data:

npm run db:seed

Step 5: Start the Development Server

npm run dev

The application will be available at http://localhost:3000.

Troubleshooting

Database Connection Issues

If you're having trouble connecting to your database:

  1. Verify your DATABASE_URL is correct
  2. Ensure your database server is running
  3. Check that your IP is allowlisted (for cloud databases)

Prisma Issues

If you encounter Prisma-related errors:

# Reset the Prisma client
npx prisma generate

# Reset the database (warning: deletes all data)
npx prisma db push --force-reset

Node.js Version

Ensure you're using Node.js 18 or higher:

node --version

If needed, use nvm to manage Node.js versions:

nvm install 18
nvm use 18