$ cd ../projects

~/projects/atlas/README.md

LIVEINTERNALDEMO# Full-Stack

Project ATLAS

Engineering Trip Management & Trip Ticket Platform. A full-stack enterprise workflow platform designed to digitize engineering trip requests, multi-stage approvals, employee authentication, trip management, and automated trip-ticket document generation.

Next.jsReactNestJSTypeScriptPostgreSQLDockerREST APIPDF GenerationRBACn8nTelegram Bot API
workflow stages
6
database schemas
5
send attempts per approval
1 + 3
missed-approval sweep
Hourly

cat architecture.flow

System Architecture

ATLAS follows a layered web application architecture separating the presentation layer, business logic, workflow processing, authentication, document generation, and persistent data storage.

atlas-architecture.png

Project ATLAS system architecture diagram

Presentation Layer

Next.js and React provide the responsive web dashboard used by employees, approvers, accounting personnel, and administrators.

Application Layer

NestJS provides REST APIs for authentication, trip requests, approval workflows, employee management, and document generation.

Data Layer

PostgreSQL stores master data, trip transactions, workflow information, audit records, and application configuration.

cat problem.md

Business Problem

Engineering field trips require coordination between employees, supervisors, approvers, accounting personnel, drivers, and administrative staff. When these activities are handled through manual forms, email, spreadsheets, and disconnected documents, tracking the status of requests becomes difficult.

Manual processes also make it difficult to maintain a consistent approval history and ensure that the correct personnel review a request before a trip is authorized.

The objective of ATLAS was to create a centralized system that provides a structured workflow from the initial trip request through approval and final trip-ticket generation.

cat solution.md

Solution

I designed and developed ATLAS as a full-stack enterprise web application using Next.js for the user interface, NestJS for the application API, and PostgreSQL for persistent data storage.

The platform provides authenticated users with role-based access to the functions appropriate to their responsibilities. Employees can create and submit trip requests while authorized personnel can review and process requests through the approval workflow.

Approved requests can be converted into standardized PDF trip-ticket documents, creating a consistent digital record that can be used during the actual engineering trip.

./run --trace

Trip Request Workflow

ATLAS models the operational approval process as a controlled workflow rather than treating a trip request as a simple form.

  1. 01

    Create Request

    The employee creates a trip request containing the destination, purpose, vehicle, driver, travel date, departure time, expected return, and remarks.

  2. 02

    Submit Request

    The completed request is submitted for processing and becomes part of the controlled approval workflow.

  3. 03

    Supervisor Review

    Authorized supervisors and approvers review the request before it can proceed.

  4. 04

    Accounting Approval

    Accounting review is incorporated into the approval process before final authorization.

  5. 05

    Final Approval

    Once the required approvals are completed, the request reaches the approved state.

  6. 06

    Trip Ticket

    An approved trip request can be used to generate the standardized trip-ticket PDF document.

journalctl -u atlas-bot --since today

Telegram Approvals & Reliability

Approvers act on trip requests directly in Telegram. When a request needs approval, the ATLAS API calls an n8n workflow that sends each approver an approve / reject prompt, and a dedicated bot service handles their reply.

The first version sent each prompt once. When Telegram's API timed out, the request simply sat unapproved until someone noticed hours later. The notification path was rebuilt as a chain where every failure is either retried, swept up later, or reported.

Shared error workflow

Every production n8n workflow, including both ATLAS workflows, reports failures to one shared error-alert workflow that names the workflow, the failed node and the error.

Supervised bot service

The approval bot runs as a systemd service under a non-root user. It starts after the API, restarts on failure, and logs to the journal.

Approvals only in Telegram

The dashboard deliberately has no approve button. Approval happens only through the allow-listed approvers' Telegram accounts.

  1. 01

    Send with retries

    Each approval prompt is attempted once and retried up to three more times before it counts as failed.

  2. 02

    Record delivery

    A successful send is written to a de-duplication table keyed by trip and approver, so nobody is notified twice.

  3. 03

    Alert on failure

    A final failure triggers an alert through a separate, dedicated alerting bot, with email as the last-resort fallback.

  4. 04

    Hourly safety-net sweep

    Every hour a second workflow reads pending approvals from the database and re-sends anything not yet recorded as delivered.

  5. 05

    Least-privilege reads

    The sweep connects with a read-only database role that has column-level SELECT grants only. Credential columns are never readable.

cat auth.md

Authentication & Role-Based Access

ATLAS includes an authentication layer that associates application accounts with employee records. Employee numbers provide a controlled relationship between the identity of a user and the organization's master employee data.

Role-based permissions allow the system to distinguish between requesters, approvers, drivers, supervisors, and administrators. This prevents every user from having unrestricted access to workflow functions.

\dn

Database Architecture

PostgreSQL provides the transactional foundation of ATLAS. The database is organized into logical schemas to separate operational data from supporting master, workflow, audit, and configuration data.

master

Employee, location, vehicle, driver, and other reference information.

operations

Core operational records including engineering trip requests.

workflow

Approval and workflow-related information supporting controlled processing.

audit

Records supporting traceability and accountability of system activity.

config

Application configuration and system-level settings.

Migration-Based Design

Database changes are managed through versioned SQL migrations rather than ad-hoc schema modifications.

cat trip-tickets.md

Automated Trip-Ticket Generation

One of the key capabilities of ATLAS is automated generation of standardized trip-ticket documents from approved trip requests.

The backend PDF service retrieves the relevant trip information, approval data, driver information, and passenger details before producing the final trip-ticket document.

PDF files are stored in the application storage area and can be accessed through the authenticated application workflow.

docker compose ps

Deployment Architecture

ATLAS is deployed as a containerized application environment on Linux infrastructure. The dashboard, backend API, and PostgreSQL database operate as separate application components.

Docker provides isolation between services while simplifying deployment, upgrades, backups, and operational maintenance.

tail -f incidents.log

Engineering Challenges

Modelling the approval process

Fix
Designing ATLAS required translating an operational approval process into explicit application states and controlled transitions while maintaining a clean separation between frontend presentation, backend business logic, and database persistence.

Trustworthy trip tickets

Fix
Another challenge was ensuring that generated trip-ticket documents reflected the approved operational data while keeping document generation inside the backend service rather than duplicating business logic in the frontend.

Silent approval failures

Symptom
A Telegram send timed out and no alert fired. The request waited hours for a manual retry.
Root cause
Approval prompts were sent once with no error handling wired up.
Fix
Added retries, a de-duplicated delivery log, an hourly sweep, a dedicated alerting bot and an email fallback.

Bot silenced by a shared token

Symptom
The approval bot stopped responding and crash-looped with "409 Conflict" for three days.
Root cause
An unrelated workflow had been configured with the same bot token and registered a webhook. Telegram allows only one delivery mode per token.
Fix
Gave every bot and workflow its own token, and recorded "check getWebhookInfo first" as the first runbook step when a bot goes quiet.

Debugging across the stack

Fix
The project also required iterative debugging across multiple layers of the stack, including authentication, database migrations, API endpoints, dashboard routing, PDF generation, and containerized deployment.

cat package.json | jq .stack

Technology Stack

Frontend

Next.jsReactTypeScriptTailwind CSS

Backend

NestJSREST APIPDFKitRBAC

Data & Platform

PostgreSQLDockerLinuxsystemd

Notifications

n8nTelegram Bot APITelegrafEmail fallback

curl -I demotripticket.melardenio.com

Try Project ATLAS

demo.env

DEMO

Explore the live demonstration environment and experience the trip request, approval workflow, trip management, and authentication features of Project ATLAS.

launch demo ↗

This environment uses demo data and credentials intended for portfolio evaluation and application testing.

Demo URL
demotripticket.melardenio.com
Password
password123

echo $EXIT_STATUS

Project Outcome

outcome.log

Project ATLAS demonstrates how a real operational process can be transformed into a structured enterprise application. The system combines authentication, role-based access, workflow processing, relational data management, and automated document generation into a single platform.

The project represents my approach to engineering software around actual operational requirements rather than building isolated technical demonstrations.