This application is designed to handle fleet maintenance management for Company A. The project is built within a Dockerized environment.
- Django Rest Framework (backend)
- Vue 3 Typescript with Vite (frontend)
- SQLite (database)
- Docker
- Docker Compose
- Node or NVM (for frontend development)
- Yarn (for frontend development)
- Python 3 (for backend development)
The Docker Compose configuration defines the following services:
-
db-sqlite: SQLite lightweight db to persist database data
-
backend-dj: Django backend, on port
8000
-
frontend-vite: TypeScript Vue 3 TypeScript with Vite frontend, on port
3000
. -
nginx: Nginx server to act as a reverse proxy, routing requests to the backend and frontend.
git clone https://github.com/kychok98/courier-maintenance-app.git
cd courier-maintenance-app
Use Docker Compose to build and run the entire stack (backend, frontend, database, and Nginx).
docker-compose up --build
This will:
- Launch the SQLite database in a container.
- Build the Django backend and Vite frontend.
- Expose the backend at port
8000
and frontend at port3000
, both accessible through Nginx on port80
.
Once the containers are up, run the following command to apply migrations in the backend:
docker exec fma-backend make migration-apply
Note:
fma-backend
is the container-name indocker-compose.yml
for backend
Once everything is set up, you can access the application by visiting:
Django apply migrations
docker exec fma-backend make migration-apply
Start the application:
docker-compose up
Start in detached mode (run in the background):
docker-compose up -d
Build and start the application:
docker-compose up --build
Stop all services:
docker-compose down
For more information, refer to the Docker Compose Documentation
If you prefer to run the frontend and backend locally (without Docker), follow these steps:
- Navigate to the frontend directory:
cd frontend
- Install dependencies using Yarn:
yarn install
- To run the frontend locally:
yarn dev
- (Optional) Set Proxy in
vite-config.ts
:
If you need to set up a proxy to redirect API requests during local development, update the following:
vite-config.ts
server: {
proxy: {
"/api": {
target: "http://127.0.0.1:8000", // Point to your local Django backend
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, "")
}
}
}
This ensures that API calls to
/api
on the frontend will be correctly proxied to your local Django backend.
- Navigate to the
backend
directory:
cd backend
- Set up a Python virtual environment:
python3 -m venv env
source env/bin/activate
- Install required dependencies:
pip3 install -r requirements.txt
- To run the Django development server locally:
make run-server
This will start the backend on http://127.0.0.1:8000
.