Please note that if you use the production app, the server is hosted on a free service, which causes it to spin down during periods of inactivity. As a result, the first request may experience a delay of up to 60 seconds as the server wakes up. Subsequent requests should be processed more quickly. This does not apply when running the backend server locally on localhost
.
git clone https://github.com/keremilhan/url-shortener.git
cd url-shortener
or
git clone [email protected]:keremilhan/url-shortener.git
cd url-shortener
Create .env
files in the server root directory and client root directory then add the following variables:
FRONTEND_URL_DEVELOPMENT=http://localhost:5000
FRONTEND_URL_PRODUCTION=https://url-shortener-kerem.vercel.app
PORT=3000
MONGO_URI=<your-mongodb-uri>
MONGO_URI_TEST_DB=<your-mongodb-test-uri>
JWT_SECRET=<your-jwt-secret>
JWT_LIFETIME=40d
VITE_BASE_URL=http://localhost:3000
You will receive the MongoDB URI and JWT secret via email.
Replace <your-mongodb-uri>
<your-mongodb-test-uri>
and <your-jwt-secret>
with the values you received in the email.
Navigate to both the server and client directories to install the necessary dependencies.
# Server
cd server
npm install
npm run dev
# Client
cd ../client
npm install
npm run dev
- The backend server will start on port 3000.
- The frontend server will start on port 5000.