Before you begin, ensure you have the following installed on your machine:
Create a .env
file in the root directory of your project and add the following environment variables:
PORT=3000
MONGO_URI=mongodb://<your-mongo-uri>
SESSION_SECRET=your-session-secret
CLOUDINARY_CLOUD_NAME=your-cloudinary-cloud-name
HOST=domain-your-website
CLOUDINARY_API_KEY=your-cloudinary-api-key
CLOUDINARY_API_SECRET=your-cloudinary-api-secret
MOMO_PARTNER_CODE=your-momo-partner-code
MOMO_ACCESS_KEY=your-momo-access-key
MOMO_SECRET_KEY=your-momo-secret-key
MOMO_REDIRECT_URL=your-momo-redirect-url
MOMO_IPN_URL=your-momo-ipn-url
VNPAY_TMN_CODE=your-vnpay-tmn-code
VNPAY_HASH_SECRET=your-vnpay-hash-secret
VNPAY_URL=your-vnpay-url
VNPAY_RETURN_URL=your-vnpay-return-url
- Clone the repository:
git clone https://github.com/Keruedu/WEB-FinalProject-2024
cd your-repository
- Install the dependencies:
npm install
- Build the CSS:
npm run build-css
Run the migration scripts to set up the database:
node database/migrations/dropDatabase.js
node database/seed_data/seed.js
- Run the migration scripts to set up the database:
npm start
- Open your browser and navigate to http://localhost:3000.
To deploy the application on Render, follow these steps:
-
Create a Render Account:
- Go to Render and sign up for an account.
-
Create a New Web Service:
- Click on the "New" button and select "Web Service".
- Connect your GitHub repository to Render.
- Select the repository you want to deploy.
-
Configure the Web Service:
- Name: Choose a name for your service.
- Region: Select the region closest to your users.
- Branch: Select the branch you want to deploy (e.g.,
main
). - Build Command: Set the build command to:
npm install && npm run build-css
- Start Command: Set the start command to:
npm start
-
Set Environment Variables:
- Add the environment variables listed in your .env file to the Render environment variables section. This includes:
PORT=3000 MONGO_URI=mongodb://<your-mongo-uri> SESSION_SECRET=your-session-secret CLOUDINARY_CLOUD_NAME=your-cloudinary-cloud-name HOST=domain-your-website CLOUDINARY_API_KEY=your-cloudinary-api-key CLOUDINARY_API_SECRET=your-cloudinary-api-secret MOMO_PARTNER_CODE=your-momo-partner-code MOMO_ACCESS_KEY=your-momo-access-key MOMO_SECRET_KEY=your-momo-secret-key MOMO_REDIRECT_URL=your-momo-redirect-url MOMO_IPN_URL=your-momo-ipn-url VNPAY_TMN_CODE=your-vnpay-tmn-code VNPAY_HASH_SECRET=your-vnpay-hash-secret VNPAY_URL=your-vnpay-url VNPAY_RETURN_URL=your-vnpay-return-url
- Add the environment variables listed in your .env file to the Render environment variables section. This includes:
-
Deploy the Service:
- Click on the "Create Web Service" button to start the deployment process.
- Render will automatically build and deploy your application.
-
Monitor the Deployment:
- You can monitor the deployment logs in the Render dashboard.
- Once the deployment is complete, Render will provide a URL where your application is accessible.
-
Database Setup:
- Ensure your MongoDB instance is accessible from Render.
- If using a managed MongoDB service like MongoDB Atlas, whitelist Render's IP addresses.
-
Additional Configuration:
- Configure your domain and SSL (if applicable) in the Render dashboard.
The source code for this project is available on GitHub:
This project uses the Tailgrid Play template for the frontend. You can find more information about the template here:
For any issues or questions, please refer to the Render documentation or the issue tracker on GitHub.