This project consists of a Next.js frontend deployed on Vercel and an Express backend deployed on Render.
/
- Next.js frontend/server
- Express backend
-
Install dependencies:
npm install
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
-
Navigate to the server directory:
cd server
-
Install dependencies:
npm install
-
Run the development server:
npm run dev
-
Push your code to a Git repository (GitHub, GitLab, etc.).
-
Connect your repository to Vercel.
-
Configure the following environment variables in Vercel:
NEXT_PUBLIC_SITE_URL
: Your Vercel deployment URL (e.g., https://co3pe.vercel.app)NEXT_PUBLIC_API_URL
: Your Render deployment URL (e.g., https://co3pe.onrender.com)- Other environment variables as needed
-
Deploy your application.
-
Push your code to a Git repository (GitHub, GitLab, etc.).
-
Connect your repository to Render.
-
Configure the following environment variables in Render:
MONGODB_URI
: Your MongoDB connection stringPORT
: 5000 (or the port provided by Render)NEXT_PUBLIC_SITE_URL
: Your Vercel deployment URL (e.g., https://co3pe.vercel.app)- Other environment variables as needed
-
Set the build command:
npm install && npm run build
-
Set the start command:
npm run start:prod
-
Deploy your application.
- Make sure to update the CORS configuration in the server to include your Vercel deployment URL.
- Update the API URL in the frontend environment variables to point to your Render deployment URL.
- The server's
uploads
directory is not persisted in Render by default. Consider using a cloud storage service like AWS S3 or Google Cloud Storage for file uploads in production.