This repository is a supply chain tracking system, consisting of a backend API built with TypeScript and Express, and a frontend web app built with Next.js. The system allows users to track and trace supply chain items by creating, updating, and querying orders and their associated events.
- API: Node.js, Express, TypeScript, MongoDB, Mongoose
- Frontend: Next.js, React, Bootstrap
- Deployment: Vercel for the frontend, Docker for containerization
-
Clone the repository:
git clone <repository-url> cd <repository-directory>/logistics-backend
-
Install dependencies:
npm install
-
Create a
.env
file in thelogistics-api
directory and add the following environment variables:PORT=8080 DB_URL=mongodb://localhost:27017/logistics-api
-
Run the API server:
npm run dev
The API server should now be running at
http://localhost:8080
.
-
Navigate to the
logistics-frontend
directory:cd ../logistics-frontend
-
Install dependencies:
npm install
-
Create a
.env.local
file in thelogistics-frontend
directory and add the following environment variable:NEXT_PUBLIC_API_URL=http://localhost:3000
-
Run the frontend application:
npm run dev
The frontend application should now be running at
http://localhost:3000
.
You can deploy the backend & frontend to any cloud service provider or use Docker for containerization.
-
Navigate to the root directory:
cd ..
-
Build and run the Docker container for both frontend and backend:
docker-compose up --build
-
To Build and run the Docker container for the backend alone:
docker build -t logistics-backend . docker run -p 8080:8080 logistics-backend
Ensure your MongoDB instance is accessible from the deployed backend.
-
Install Vercel CLI:
npm install -g vercel
-
Login to Vercel:
vercel login
-
Deploy the frontend:
cd frontend vercel
-
Set Environment Variables on Vercel:
Go to your project’s dashboard on Vercel, navigate to the "Settings" tab, and add your environment variables, such as
NEXT_PUBLIC_API_URL
.
By following these instructions, you should be able to set up and deploy your Supply Chain Tracking System successfully.