Before running the project, ensure you have the following installed:
- Python (v3.8 or higher)
- Node.js (v16 or higher)
- PostgreSQL (Database)
- Open your PostgreSQL tool (pgAdmin or command line).
- Create a new database named
elearning.CREATE DATABASE elearning;
- Ensure you have a user (e.g.,
postgres) with a password. You will need these credentials for the backend setup.
-
Navigate to the
backendfolder:cd backend -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows:
.\venv\Scripts\activate - Mac/Linux:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
-
Configure Database:
- Open
app/database.py(or set an environment variableDATABASE_URL). - The default connection string is:
postgresql://postgres:zain1234@localhost:5432/elearning - If your PostgreSQL password or username is different, update it in
app/database.pyor create a.envfile with:DATABASE_URL=postgresql://YOUR_USER:YOUR_PASSWORD@localhost:5432/elearning
- Open
-
Run the Server:
uvicorn app.main:app --reload
- The backend will start at
http://localhost:8000. - It will automatically create the necessary database tables on the first run.
- The backend will start at
-
Open a new terminal and navigate to the
frontendfolder:cd frontend -
Install dependencies:
npm install
-
Run the Application:
npm run dev
- The frontend will start at
http://localhost:5173(or similar).
- The frontend will start at
- Open your browser and go to the frontend URL.
- Register a new account (since the database is fresh, there are no users).
- You can register as a student or instructor and start creating/viewing courses.