Rolando Andrade
Back to projects

Built in 2018

Mappy

Package Delivery and Tracking System

Mappy preview

Package delivery and tracking system created for Software Engineering course.

In 2018, many local delivery services still ran on phone calls, paper forms and manual status updates. A customer sent a package and then waited. Nobody could tell them where it was.

Shipping a package should be simple. You enter a pickup address and a delivery address, add your items, and follow the package until it arrives.

For my Software Engineering course at UCAB, I built Mappy to do exactly that. Mappy is a web application. Users create delivery orders, manage addresses and track packages through a REST API. A REST API is a set of web addresses an app calls to read or change data. The project taught me how to structure a real application with user login, input checks and automated tests.

From signup to delivery

Mappy covers the whole life of a delivery. Users register with their email and create an account.

Once logged in, they save two kinds of addresses. Collection addresses are where packages get picked up. Delivery addresses are where packages go. Each address stores street lines, city, country and zip code. Delivery addresses can also store GPS coordinates for maps.

To create an order, a user picks a pickup location and a destination, then adds the recipient’s details. One order can hold many packages. Each package has its own weight and description. The system records which user created each order and keeps the links between orders, packages and addresses.

The frontend talks to the REST API for every operation. Users see their orders, check package details and edit their saved addresses. Staff use an admin panel that shows all the data in the system.

One Django app per domain

I built Mappy with Django and Django REST Framework. Django is a Python framework for web applications. Django REST Framework adds tools to build APIs on top of it.

The backend is split into separate Django apps, one for each domain. There is one for users, one for packages, one for collection addresses, one for delivery addresses and one for collection orders.

Orders tie everything together

The data has four main entities. Users extend Django’s built in login system with extra profile fields: birth date, names and a profile image.

Collection addresses and delivery addresses store location data. Each one points to its user with a foreign key, which is a field that links one record to another.

Collection orders connect everything. Each order points to a user, a pickup address, a delivery address and the recipient’s information. Packages point to their order with foreign keys.

This design lets users save addresses and reuse them. A user can keep several pickup and delivery locations. When they create an order, they pick a saved address or add a new one.

Tokens protect each request

The REST API has endpoints for each resource. Users can register, log in and manage their profiles. Each address type has endpoints to create and read addresses. Orders support full CRUD, which means create, read, update and delete. Users can also list all of their own orders.

Login gives the user a token. A token is a secret string the app sends with every later request to prove who it is. This protects user data. People only see their own orders and addresses.

I used django-rest-auth for the login flows. It handles registration, login, logout and password changes out of the box. Together with django-allauth, it lets people log in with an email instead of a username.

Bad input gets rejected

The API checks all input data. Address fields have a maximum length. GPS coordinates must stay inside valid ranges. Recipient names cannot be longer than 35 characters. Package weights use decimal fields with a fixed precision.

A bad request returns a detailed error message. For example, an address with too many decimal places in its coordinates returns a 400 error. The tests check that each of these rules works.

Tests on a throwaway database

I wrote API tests with the test tools in Django REST Framework. The suite covers creating orders with valid addresses, missing addresses, null values and wrong data types. It checks the length limits on text fields and the number limits on coordinates.

The tests run against a separate PostgreSQL database. It is created at the start of each test run and destroyed at the end. That keeps every run isolated and repeatable. Each test case creates its own users, addresses and orders.

Three problems worth solving

Coordinates without rounding errors

GPS coordinates needed careful handling of precision. I used decimal fields with 20 total digits and 12 decimal places. That is precise enough for accurate maps, and it avoids floating point errors (small rounding mistakes that happen with normal computer numbers).

The django-geoposition library connects address entry with Google Maps. Users pick a spot on a map, and the system reads the coordinates for them.

Email instead of username

Django logs people in with a username by default. Switching to email meant changing settings in more than one library. I set django-allauth to make email required and username optional. A custom login serializer checks the credentials against the email address. A serializer is the code that turns request data into Python objects and back.

Settings for Heroku

Mappy deploys to Heroku, and django-heroku handles the settings there. WhiteNoise serves the static files, like stylesheets and scripts. CORS headers let frontend clients on other domains call the API. In production, the database address comes from environment variables. In development, it falls back to a local PostgreSQL database.

Structure makes it reliable

Mappy showed me how real applications separate concerns. Each Django app owns one domain: users, addresses or orders. The REST API is a clear border between frontend and backend.

Automated tests made me think about edge cases. What happens with a null value, a string that is too long, or a bad coordinate? The suite caught bugs early, and it let me change code without fear.

Token login taught me how to protect API endpoints. I learned the full flow, from login to storing the token to sending it with each request. That prepared me to build secure applications later.

Clean data models, checked inputs, tests and modular code are what made Mappy work reliably.

Interested in working together? Check out my services and pricing to see how we can collaborate on your next project. Let's Build