This project is a full-stack web application with an Expo (React Native) frontend and a Python FastAPI backend. The application is containerized using Distroless images for enhanced security and minimized footprint.
Before you begin, ensure you have the following installed on your system:
- Docker
- Docker Compose
- Bun (Recommended for frontend speed) or Node.js.
- Python 3.11+ for local backend development.
To test the mobile app on a physical device, download the Expo Go app:
- Android: Get it on Google Play
- iOS: Download on the App Store
The application is structured around three main user roles: Sender, Transporter, and Receiver, each accessible via a dedicated tab in the bottom navigation bar.
- Sender: Manage your outgoing shipments. This is where you can initiate new shipments via the "Send New" button.
- Transporter: View assigned tasks and transport details.
- Receiver: View incoming shipments.
This project uses a Production-Grade containerization strategy:
- Frontend (Web): Built using
expo exportand served statically usingbun x serve. It runs as a Single Page Application (SPA). - Backend (API): Built using a multi-stage Docker process. The final image is based on Google's Distroless Python image, containing only the application and necessary runtime dependencies (no shell, no package managers) for maximum security.
Note: This mode runs the optimized, static build of the application. Hot-reloading is disabled. If you make code changes, you must rebuild the containers.
- Open a terminal in the root directory.
- Run the following command:
docker-compose up --build -d cd frontend npm run start / bun web - Access the application:
- Frontend:
http://localhost:3000(Served via Bun) - Backend:
http://localhost:8000(Served via Uvicorn/Distroless)
- Frontend:
To stop the application, press Ctrl + C.
Use this method if you are actively writing code and need Hot Reloading.
- Navigate to the
backenddirectory:cd backend - Create and activate a virtual environment (recommended):
python -m venv venv # Windows: .\venv\Scripts\activate # macOS/Linux: source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Start the server with reload enabled:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
- API Docs:
http://localhost:8000/docs
- API Docs:
- Open a new terminal and navigate to the
frontenddirectory:cd frontend - Install dependencies:
bun install # or npm install - Start the Expo development server:
bun start # or npm start - Launch on Device:
- Press
wto open in the web browser. - Scan the QR code printed in the terminal using the Expo Go app on your Android or iOS device.
- Press
- API URL: The frontend automatically attempts to detect the host IP address using
expo-constantsto communicate with the backend. - Docker Networking: In Docker Compose, the services communicate via internal networking, but ports
3000and8000are exposed to your host machine for access.
https://vimeo.com/1152638130?fl=ip&fe=ec
frontend/: Expo/React Native application.Dockerfile: Usesoven/bunto build and serve static files.app/(tabs)/: Main screens (Sender, Transporter, Receiver).app/add-shipment.tsx: Form for creating shipments and calculating price estimates.
backend/: FastAPI application.Dockerfile: Multi-stage build usingpython:slim(builder) andgcr.io/distroless/python3(runtime).
docker-compose.yml: Orchestrates the services. Volumes are disabled to ensure the Distroless environment is used correctly.
- "Command not found" inside Docker:
Because the backend uses Distroless images, there is no
/bin/shorbash. You cannotdocker execinto the backend container to run shell commands. This is a security feature. - Frontend 404 on Refresh:
The Docker container uses
bun x serve -s. The-sflag ensures that refreshing a sub-route (e.g.,/sender) redirects toindex.htmlcorrectly, allowing React Navigation to handle the route.