# How to Run

## 📦 Requirements

* **.NET SDK**: .NET 9.0 SDK installed
* **Node.js & npm**: Node.js ≥16 with npm
* **Database**: Microsoft SQL Server (local or cloud)
* **Docker (optional)**: Docker Engine & Docker Compose installed

## 🔐 API Keys

### 💻 [OneCompiler](https://onecompiler.com/pricing) (for code execution)

OneCompiler is used to run code against test cases in problem-solving questions.

To obtain a free API key:

1. Sign up for a free account at [RapidAPI](https://rapidapi.com/)
2. Navigate to the [OneCompiler API Playground](https://rapidapi.com/onecompiler-onecompiler-default/api/onecompiler-apis/playground)
3. Copy your API key from the `X-RapidAPI-Key` section

### 🤖 [Gemini](https://ai.google.dev/gemini-api/docs/models) (for AI interaction)

Gemini is used to power AI-based features in the platform.

To obtain a free API key:

1. Visit [Google AI Studio](https://aistudio.google.com/apikey)
2. Generate and copy your Gemini API key

### 📧 Gmail SMTP

To use Gmail's SMTP server, you need to create an **App Password** because Gmail requires 2-Step Verification for enhanced security.

To generate an App Password:

1. Enable [2-step verification](https://myaccount.google.com/signinoptions/two-step-verification/enroll-welcome) on your Google account
2. Generate the 16-character app password from [app password](https://myaccount.google.com/apppasswords)

> ⚠️ **Important**: Use this App Password instead of your regular Gmail password when configuring SMTP settings.

## 🛠️ Steps to Run

### 🚀 Run Locally

1. Clone the repository

```powershell
git clone https://github.com/Learnathon-By-Geeky-Solutions/elite-programmers.git
cd elite-programmers
```

🔥Clone the latest version

```
git clone https://github.com/Raofin/TrueTest.git
cd TrueTest
```

2. Configure
   1. Backend

      Use the following Commands to store the credentials in user secrets 👇

      ```powershell
      cd src/api/ops.api
      dotnet user-secrets set "EmailSettings:Email" ""
      dotnet user-secrets set "EmailSettings:Password" ""
      dotnet user-secrets set "OneCompilerSettings:ApiKey" ""
      dotnet user-secrets set "GoogleCloudSettings:FolderId" ""
      dotnet user-secrets set "GeminiSettings:ApiKey" ""
      ```
   2. Frontend

      ```powershell
      cp .env.example .env.local
      ```
3. Build & Run
   1. Backend

      ```powershell
      dotnet restore
      dotnet run
      ```

      ✅ The project is configured to automatically apply migrations with some seed data on its **first run in the** [**default connection string**](https://github.com/Learnathon-By-Geeky-Solutions/elite-programmers/blob/main/src/Api/OPS.Api/appsettings.Development.json#L3). So you do not need to manually apply them.
   2. Frontend

      ```powershell
      cd src/client
      npm run build
      npm start
      ```

### 🐳 Run with Docker

1. Open the [docker-compose.yml](https://github.com/Learnathon-By-Geeky-Solutions/elite-programmers/blob/main/docker-compose.yml#L27) and under environment section, fill in the required values.
2. Build & start containers

   ```powershell
   docker-compose up --build
   ```
3. Access:
   1. Frontend: `https://localhost:9999`
   2. Backend: `https://localhost:9998`
   3. Database: `http://localhost:6666`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://truetest.gitbook.io/docs/how-to-run.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
