diff --git a/README.md b/README.md index 7e6b071..78d1ea0 100644 --- a/README.md +++ b/README.md @@ -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://:@/" - # 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: "" - # 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: "" - # 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: "" +``` - username: "" - # Email username (your email address) +Without a valid MongoDB URI, the backend will fail to start. - password: "" - # Password for the email or app-specific password if 2FA is enabled +--- - senderEmail: "" - # 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: "" - # Google OAuth Client ID for OAuth login - # Obtain from Google Cloud Console (APIs & Services > Credentials > OAuth 2.0 Client IDs) +```yaml +gemini: + apiKey: "" ``` -> **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