Local Setup & Installation
Relevant source files
The following files were used as context for generating this wiki page:
This guide provides comprehensive instructions for setting up the Outmanage Backend API in a local development environment. Outmanage is an outbound logistics management system built with Node.js, Express, TypeScript, and MySQL, using Prisma as the ORM.
The system handles core logistics operations including warehouse management, product inventory, delivery orders, and fleet (armada) tracking. It features AI-powered vehicle plate verification and automated PDF generation for logistics documentation.
Sources: README.md:1-5, CLAUDE.md:15-25
Prerequisites
Before starting the installation, ensure the following software is installed on your local machine:
- Node.js: The runtime environment for the API.
- npm: The package manager included with Node.js.
- MySQL: The primary database engine.
- TypeScript: The project is written in TypeScript and requires compilation.
Sources: package.json:20-55, README.md:10-15
Installation Steps
1. Clone and Dependency Installation
First, clone the repository and install the required Node.js packages.
npm install
Sources: README.md:7-9
2. Environment Configuration
Create a .env file in the root directory and configure the database connection string. The system uses a MySQL database.
DATABASE_URL="mysql://user:password@localhost:3306/db_name"
TZ="Asia/Jakarta"
PORT=3000
GEMINI_API_KEY="your_api_key_here"
Sources: README.md:11-15, src/index.ts:15-17, CLAUDE.md:75-80
3. Database Initialization
Initialize the database schema using Prisma migrations, generate the Prisma client, and seed the initial administrative data.
# Run migrations to create schema
npx prisma migrate dev
# Generate Prisma client
npx prisma generate
# Seed the database
npm run seed
Sources: README.md:17-30, CLAUDE.md:11-13
Component Architecture
The following diagram illustrates the high-level architecture of the local setup, showing the flow from the client through the Express server to the MySQL database.
The system utilizes a standard layered architecture where requests are validated by Joi schemas and processed through dedicated service layers.
Sources: CLAUDE.md:15-45, src/index.ts:40-100
Development Workflow
Available Scripts
The project includes several npm scripts to manage the development lifecycle.
| Script | Command | Description |
|---|---|---|
dev | npm run dev | Starts development server with hot reload using ts-node-dev. |
build | npm run build | Compiles TypeScript code into JavaScript in the dist/ folder. |
start | npm start | Runs the compiled production server. |
lint | npm run lint | Runs ESLint to check for code quality issues. |
seed | npm run seed | Executes the database seeding script. |
Sources: package.json:6-12, README.md:85-95
Database Management
Prisma provides tools for interacting with the database during development.
- Prisma Studio:
npx prisma studioopens a GUI to view and edit database data. - Prisma Generate:
npx prisma generateupdates the client after schema changes.
Sources: CLAUDE.md:9-13
Initial Data Seeding
The npm run seed command populates the database with essential initial data. This includes the core RBAC (Role-Based Access Control) structure.
Seed Logic Flow
The seeding process clears existing data before creating the primary administrative user.
Default Credentials
After seeding, the following account is available for initial login:
- Email:
jeffrey@gmail.com - Password:
Password123! - Role: Pemilik (Owner - Full Access)
Sources: prisma/seed.ts:10-250
Documentation and Testing
Once the local server is running (usually at http://localhost:3000), you can access the following documentation endpoints:
- Comprehensive API Docs:
http://localhost:3000/api-docs(Swagger UI) - Health Check:
http://localhost:3000/health(Returns status and Jakarta timestamp)
Sources: src/index.ts:50-85
Summary
Setting up Outmanage locally involves installing Node.js dependencies, configuring a MySQL database via Prisma, and initializing the system state with the provided seeding script. The development environment is configured to operate in the Asia/Jakarta timezone by default to ensure consistency in logistics timestamps.
Sources: CLAUDE.md:75-80, package.json:7-12