A simple, open-source Transport Management System built with TypeScript, featuring a Fastify backend, React frontend, and comprehensive CRUD operations. Perfect for managing shipments, customers, and locations with a beautiful Material Design 3 interface.
Under development at the moment. I have really made this as a demo to show off our data platform capabilities at System Loco, we develop IoT devices and the supporting data and intelligence platform. We integrate with real time visibility platforms and TMS systems to provide a complete end to end solution.
Please feel free to contribute to the project, ideally with feature requests, bug reports, or documentation improvements.
I'm outlining a roadmap. It's high level. It can be ticketed up as it goes along as issues Roadmap
π Live Demo: Try it now! | π API Docs: View API
Note: The demo URLs above are for the project maintainer's deployment. Deploy your own instance using the Quick Demo Guide.
- Customer Management - Create, edit, and manage customer information
- Location Management - Handle warehouses, distribution centers, and retail locations
- Shipment Tracking - Complete shipment lifecycle management with status tracking
- Real-time Updates - Live data synchronization across the application
- Interactive Maps - OpenStreetMap integration for shipment visualization
- Material Design 3 - Beautiful, consistent design system
- Responsive Design - Works perfectly on desktop, tablet, and mobile
- Dark/Light Themes - Automatic theme switching based on system preferences
- Loading States - Smooth user experience with proper feedback
- Error Handling - Graceful error management and user notifications
- TypeScript - Full type safety across frontend and backend
- RESTful API - Well-documented API with Swagger/OpenAPI
- Database Migrations - Prisma-powered database management
- Repository Pattern - Clean data access layer with interface-based design
- Dependency Injection - Testable, loosely-coupled architecture
- DTO Pattern - Type-safe data transfer with validation
- Soft Delete - Data preservation with archive functionality
- Validation - Comprehensive input validation and error handling
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β Database β
β React + Vite βββββΊβ Fastify API βββββΊβ PostgreSQL β
β TypeScript β β TypeScript β β Prisma ORM β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
The backend follows a clean, layered architecture with:
- Routes Layer - HTTP endpoints and request/response handling
- Repository Layer - Data access abstraction using the Repository Pattern
- Dependency Injection - Custom DI container for loose coupling and testability
- Type Safety - TypeScript interfaces (DTOs) for all data structures
Routes (HTTP)
β (uses interfaces)
Repositories (Data Access)
β (uses Prisma)
Database (PostgreSQL)
Key Patterns:
- Repository Pattern - All database operations abstracted into repository classes
- Dependency Injection - Interface-based DI container for testability
- DTO Pattern - Type-safe data transfer objects for API contracts
- Interface Segregation - Each repository has a corresponding interface
- Node.js 20+
- Docker & Docker Compose
- npm or yarn
Use the provided run script to start everything automatically:
git clone https://github.com/DominicFinn/open_tms.git
cd open_tms
npm install
./run.shThis script will:
- β Start the database in Docker
- β Apply any pending database migrations
- β Generate Prisma client
- β Start the backend server
- β Start the frontend development server
If you prefer to start services manually:
- Clone and install dependencies:
git clone https://github.com/DominicFinn/open_tms.git
cd open_tms
npm install- Start the database:
docker compose up -d db- Apply database migrations:
cd backend
npx prisma migrate deploy
npm run prisma:generate
cd ..- Start development servers:
npm run dev- Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3001
- API Documentation: http://localhost:3001/docs
- Seed the database with sample data:
curl -X POST http://localhost:3001/api/v1/seed- Explore the features:
- Navigate through Customers, Locations, and Shipments
- Create, edit, and delete records
- View shipment details with interactive maps
The demo deployment includes built-in rate limiting to protect against abuse:
- 50 requests per minute per IP address
- Automatic reset every 60 seconds
- 429 status code when limit exceeded
- Clear error messages with retry information
IMPORTANT: If you are using the demo, please do not abuse the rate limit. If you need to make more requests, please contact me.
Rate limiting is implemented in the demo backend (backend/src/index-demo.ts) and configured via the Docker container. See the Dockerfile and TypeScript configuration for implementation details.
Perfect for showcasing the system to stakeholders:
π Hosting a Demo on GCP β
Complete production setup with monitoring and security:
π Production Deployment Guide β
Simple containerized deployment:
# Build and run with Docker Compose
docker compose up --build -d
# Or build individual services
docker build -t open-tms-backend ./backend
docker build -t open-tms-frontend ./frontendGET /api/v1/customers- List all customersPOST /api/v1/customers- Create new customerGET /api/v1/customers/:id- Get customer detailsPUT /api/v1/customers/:id- Update customerDELETE /api/v1/customers/:id- Archive customer
GET /api/v1/locations- List all locationsPOST /api/v1/locations- Create new locationGET /api/v1/locations/:id- Get location detailsPUT /api/v1/locations/:id- Update locationDELETE /api/v1/locations/:id- Archive location
GET /api/v1/shipments- List all shipmentsPOST /api/v1/shipments- Create new shipmentGET /api/v1/shipments/:id- Get shipment detailsPUT /api/v1/shipments/:id- Update shipmentDELETE /api/v1/shipments/:id- Archive shipment
Visit http://localhost:3001/docs for the complete Swagger/OpenAPI documentation.
- React 18 - Modern React with hooks
- TypeScript - Type-safe development
- Vite - Fast build tool and dev server
- React Router - Client-side routing
- Leaflet - Interactive maps
- Material Icons - Icon system
- Fastify - Fast and efficient web framework
- TypeScript - Type-safe server development
- Prisma - Modern database ORM
- PostgreSQL - Robust relational database
- Zod - Schema validation
- Swagger - API documentation
- Repository Pattern - Data access abstraction layer
- Dependency Injection - Custom DI container for loose coupling
- DTO Pattern - Type-safe data transfer objects
- Interface Segregation - Interface-based repository contracts
- Layered Architecture - Clear separation of routes, repositories, and services
- ESLint - Code linting
- Prettier - Code formatting
- Docker - Containerization
- GitHub Actions - CI/CD pipeline
open_tms/
βββ backend/ # Fastify API server
β βββ src/
β β βββ index.ts # Main server file
β β βββ routes/ # HTTP route handlers
β β βββ repositories/ # Data access layer (Repository Pattern)
β β βββ di/ # Dependency Injection container
β β β βββ container.ts # DI container implementation
β β β βββ tokens.ts # Dependency tokens
β β β βββ registry.ts # Dependency registration
β β βββ services/ # Business logic services
β β βββ plugins/ # Fastify plugins
β βββ prisma/ # Database schema and migrations
β βββ Dockerfile # Backend container
βββ frontend/ # React application
β βββ src/
β β βββ pages/ # Page components
β β βββ layout.tsx # App layout
β β βββ theme.css # Material Design styles
β βββ Dockerfile # Frontend container
βββ packages/
β βββ shared/ # Shared TypeScript types
βββ terraform/ # Infrastructure as Code
βββ .github/workflows/ # CI/CD pipelines
βββ docs/ # Documentation
The backend follows a modular architecture with clear separation of concerns:
- HTTP endpoint definitions
- Request/response handling
- Validation using Zod schemas
- Depends on repository interfaces (not implementations)
Each repository provides:
- Interface - Contract definition (e.g.,
ICustomersRepository) - DTOs - Data Transfer Objects (e.g.,
CreateCustomerDTO,UpdateCustomerDTO) - Implementation - Concrete class with Prisma database operations
Example:
// Interface defines the contract
export interface ICustomersRepository {
all(): Promise<Customer[]>;
findById(id: string): Promise<Customer | null>;
create(data: CreateCustomerDTO): Promise<Customer>;
// ...
}
// Implementation uses Prisma
export class CustomersRepository implements ICustomersRepository {
constructor(private prisma: PrismaClient) {}
// ... method implementations
}- Container - Simple DI container for managing dependencies
- Tokens - Symbol-based identifiers for each dependency
- Registry - Central registration of all application dependencies
Usage in routes:
const customersRepo = container.resolve<ICustomersRepository>(
TOKENS.ICustomersRepository
);This architecture enables:
- β Testability - Easy to inject mock repositories
- β Loose Coupling - Routes depend on interfaces, not concrete classes
- β Flexibility - Swap implementations without changing routes
- β Type Safety - Full TypeScript support with generics
The DI container makes testing straightforward:
import { container, TOKENS } from '../di';
import { ICustomersRepository } from '../repositories/CustomersRepository';
// Create a mock repository
const mockCustomersRepo: ICustomersRepository = {
all: jest.fn().mockResolvedValue([]),
findById: jest.fn(),
create: jest.fn(),
update: jest.fn(),
archive: jest.fn(),
};
// Replace the binding for testing
container.singleton(TOKENS.ICustomersRepository)
.toFactory(() => mockCustomersRepo);
// Now your routes will use the mock!- Complete CRUD operations with inline editing
- Email validation and contact management
- Soft delete with archive functionality
- Real-time updates across the interface
- Comprehensive address handling with coordinates
- Geographic data support for mapping
- Warehouse and retail location management
- Address validation and formatting
- Full lifecycle management from draft to delivery
- Status tracking with visual indicators
- Interactive maps showing shipment routes
- Item management with SKU tracking
- Date management for pickup and delivery
- Material Design 3 implementation
- Responsive grid layouts that adapt to screen size
- Floating labels and smooth animations
- Loading states and error handling
- Confirmation dialogs for destructive actions
- Input validation with Zod schemas
- SQL injection protection via Prisma ORM
- CORS configuration for secure cross-origin requests
- Rate limiting for demo protection (50 requests/minute per IP)
- Environment variable management
- Soft delete for data preservation
- Fastify for high-performance API responses
- Vite for lightning-fast development and builds
- Prisma for optimized database queries
- React with efficient re-rendering
- Docker for consistent deployment environments
We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or helping with project management, your contributions make this project better for everyone.
- Fork the repository and clone your fork
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test them thoroughly
- Add tests if you're adding new functionality
- Commit your changes:
git commit -m 'Add amazing feature' - Push to your branch:
git push origin feature/amazing-feature - Open a Pull Request with a clear description of your changes
- π Bug Reports: Found a bug? Open an issue with detailed steps to reproduce
- β¨ Feature Requests: Have an idea? Start a discussion or open an issue
- π Documentation: Help improve docs, add examples, or fix typos
- π¨ UI/UX: Improve the design, add animations, or enhance user experience
- π§ Backend: Add new API endpoints, improve performance, or add features
- π§ͺ Testing: Add unit tests, integration tests, or help improve test coverage
- π Project Management: Help triage issues, review PRs, or organize milestones
- Follow the existing code style and patterns
- Write clear, descriptive commit messages
- Update documentation for any new features
- Ensure all tests pass before submitting a PR
- Be respectful and constructive in discussions
- π¬ Discussions: GitHub Discussions for questions and ideas
- π Issues: GitHub Issues for bug reports and feature requests
- π Documentation: Check the deployment guide and API docs
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check the deployment guide
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Material Design for the beautiful design system
- Fastify team for the excellent web framework
- Prisma team for the amazing database ORM
- React team for the powerful UI library
Ready to get started? Check out the Quick Start section or deploy a demo in 5 minutes! π