This is a Reddit Clone project.
Follow these steps to get your development environment running:
-
Clone the repository:
git clone https://example.com/your-repository cd your-repository -
Install NPM packages:
npm install
-
Create a
.envfile in the root directory of the project and update it with your credentials:PORT=3000 MONGODB_URI=<Your MongoDB URI> JWT_SECRET=<Your JWT Secret> EMAIL=<Your Email> APP_PASSWORD=<Your App Password> GOOGLE_CLIENT_ID=<Your Google Client ID> GOOGLE_CLIENT_SECRET=<Your Google Client Secret> VITE_SERVER_HOST=http://localhost:3000 VITE_FRONTEND_HOST=http://localhost:5173 BUCKET_NAME=<Your Bucket Name> BUCKET_REGION=<Your Bucket Region> ACCESS_KEY=<Your Access Key> SECRET_ACCESS_KEY=<Your Secret Access Key>
To run the application, follow these steps:
-
Start the server:
npm start
This command will connect to your MongoDB database and start the server on the defined
PORT. The console will logServer running on port <PORT>when the server is running. -
Access the application at
http://localhost:<PORT>or as defined in your.envfile'sVITE_SERVER_HOST.
If you need to seed your database with initial data:
-
Run the server with the seeding option:
npm start --seed
Make sure your
.envfile hasSEED_DB=trueto enable database seeding.
- PORT: Specify the port number that the server will listen to.
- MONGODB_URI: The URI for connecting to MongoDB.
- JWT_SECRET: Secret key used for JSON Web Token (JWT) encryption.
- EMAIL: Email address used for sending notifications or alerts.
- APP_PASSWORD: Password or access token for the specified email account.
- GOOGLE_CLIENT_ID: Client ID for Google OAuth authentication.
- GOOGLE_CLIENT_SECRET: Client secret for Google OAuth authentication.
- npm test: Run all unit tests.
- npm run dev: Run the project using Nodemon for automatic reloading during development.
- npm start: Run the project using Node.js. Use this command in production or when Nodemon is not needed.