Documentation

Setup instructions and developer guide

Installation
Install project dependencies using npm

Clone the repository and install dependencies:

npm install
Environment Setup
Configure environment variables for your local environment

Create a .env file in the project root:

MONGODB_GLOBAL_DATA_URI=mongodb://localhost:27017/sah_global_data

Required environment variables:

  • MONGODB_GLOBAL_DATA_URI - MongoDB connection string
Database Setup
Connect to MongoDB and seed initial data

1. MongoDB Connection

Ensure MongoDB is running locally or update the connection string in your .env file to point to your MongoDB instance.

2. Seed the Database

Populate the database with 7 template Object Types (Truck, Trailer, Lane, Driver, Rate, Commodity, Tank Wash):

npm run seed

The seed script will create the initial Object Types and their first versions. If objects already exist, they will be skipped.

Running the Application
Start the development server

Development Mode

Start the Next.js development server on port 3001:

npm run dev

The application will be available at http://localhost:3001

Production Mode

Build and start the production server:

npm run build
npm run start
Building for Production
Create an optimized production build

Build the Next.js application for production:

npm run build

This creates an optimized production build in the .next directory.

Useful Commands
Common npm scripts and development commands
npm run devStart development server (port 3001)
npm run buildBuild for production
npm run startStart production server (port 3001)
npm run lintRun ESLint
npm run seedSeed database with template Object Types