Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 36 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,81 +29,66 @@
## Project Setup Guide

### Backend Configuration
### Prerequisites
- Go (version 1.20 or later)
- MongoDB (local instance or MongoDB Atlas)

1. Create a file named `config.prod.yml` in the `backend/config/` directory.
---

Paste the following configuration:
### 1. Create the Backend Config File

```
server:
port: 1313 # The port number your backend server will run on
The backend expects a `config.prod.yml` file at runtime.
Only a sample config file is provided in the repository.

database:
uri: "mongodb+srv://<username>:<password>@<cluster-url>/<database-name>"
# Replace with your MongoDB Atlas connection string
# Get this from your MongoDB Atlas dashboard after creating a cluster and database
Create the required config file by copying the sample:

gemini:
apiKey: "<YOUR_GEMINI_API_KEY>"
# API key for OpenAI / Gemini model access
# Obtain from your OpenRouter.ai or OpenAI account dashboard
```bash
cd backend/config
cp config.prod.sample.yml config.prod.yml
```

jwt:
secret: "<YOUR_JWT_SECRET>"
# A secret string used to sign JWT tokens
# Generate a strong random string (e.g. use `openssl rand -hex 32`)
---

expiry: 1440
# Token expiry time in minutes (e.g. 1440 = 24 hours)
### 2. Configure MongoDB

smtp:
host: "smtp.gmail.com"
# SMTP server host for sending emails (example is Gmail SMTP)
Update `backend/config/config.prod.yml` with a valid MongoDB connection string:

port: 587
# SMTP server port (587 for TLS)
```yaml
database:
uri: "<YOUR_MONGODB_URI>"
```

username: "<YOUR_EMAIL_ADDRESS>"
# Email username (your email address)
Without a valid MongoDB URI, the backend will fail to start.

password: "<YOUR_EMAIL_PASSWORD_OR_APP_PASSWORD>"
# Password for the email or app-specific password if 2FA is enabled
---

senderEmail: "<YOUR_EMAIL_ADDRESS>"
# The 'from' email address used when sending mails
### 3. (Optional) Gemini API Configuration

senderName: "DebateAI Team"
If the Gemini API key is not configured, the backend will still run, but AI-related features will be disabled.

googleOAuth:
clientID: "<YOUR_GOOGLE_OAUTH_CLIENT_ID>"
# Google OAuth Client ID for OAuth login
# Obtain from Google Cloud Console (APIs & Services > Credentials > OAuth 2.0 Client IDs)
```yaml
gemini:
apiKey: "<YOUR_GEMINI_API_KEY>"
```

> **Note**: Do **not** commit this file to a public repository. Use `.gitignore`.

---

### Running the Backend (Go)
### 4. Run the Backend Server

1. Navigate to the backend folder:
From the `backend` directory, start the server:

```
cd backend
```
```bash
go run cmd/server/main.go
```

2. Initialize Go modules (if not already done):
The server will start on the port defined in the config file (default: `1313`).

```
go mod tidy
```
---

3. Run the server:
```
go run cmd/server/main.go
```
### Notes
- Do **not** commit `config.prod.yml` to version control.
- Only `config.prod.sample.yml` should remain committed.

---

### Frontend Configuration

Expand Down