Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ALEJ4NDRO2025/urban-store/llms.txt

Use this file to discover all available pages before exploring further.

Urban Store ships with a docker-compose.yml at the repository root that orchestrates the entire stack in a single command. Three services are defined — the Django REST API backend, the Next.js storefront frontend, and a local MongoDB 7 instance — along with one named volume that persists your database across restarts.

Services Overview

ServicePortDescription
backend8000Django REST API (Python 3.13, python manage.py runserver)
frontend3000Next.js storefront (Node 20, npm run dev)
mongo27017MongoDB 7 — local development only

docker-compose.yml

version: '3.8'
services:
  backend:
    build: ./backend
    ports:
      - "8000:8000"
    volumes:
      - ./backend:/app
    env_file:
      - ./backend/.env
    depends_on:
      - mongo

  frontend:
    build: ./frontend
    ports:
      - "3000:3000"
    volumes:
      - ./frontend:/app
    env_file:
      - ./frontend/.env.local
    depends_on:
      - backend

  mongo:
    image: mongo:7
    ports:
      - "27017:27017"
    volumes:
      - mongo_data:/data/db

volumes:
  mongo_data:

Building and Starting

Build images and start all services

The first time you run the stack, or after any change to a Dockerfile or requirements.txt, build the images before starting:
docker-compose up --build

Start without rebuilding

For subsequent runs where the images are already built:
docker-compose up

Stop all services

docker-compose down
This stops and removes containers but preserves the mongo_data volume. To also delete the volume (and all local MongoDB data), add the -v flag:
docker-compose down -v

Viewing Logs

Stream live logs from a specific service:
# Backend logs
docker-compose logs -f backend

# Frontend logs
docker-compose logs -f frontend

# All services at once
docker-compose logs -f

Volume Mounts and Live Reload

Both application services mount their local source directories into the container so that code changes are reflected immediately without a rebuild:
  • Backend./backend is mounted to /app inside the container. Django’s development server (runserver) reloads automatically when Python files change.
  • Frontend./frontend is mounted to /app inside the container. Next.js development mode (npm run dev) supports hot module replacement out of the box.
  • mongo_data — a named Docker volume mounted at /data/db inside the mongo container. MongoDB data persists across docker-compose down and docker-compose up cycles.

Dockerfiles

Backend (backend/Dockerfile)

FROM python:3.13-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

Frontend (frontend/Dockerfile)

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "run", "dev"]

Production Considerations

In production you would typically use MongoDB Atlas instead of the local mongo service. Update MONGODB_URI in backend/.env to your Atlas connection string and remove (or comment out) the mongo service and mongo_data volume from docker-compose.yml. The backend already uses mongoengine.connect() with TLS via certifi, so Atlas connections work without any code changes.
Before going live, make the following adjustments:
  • Set DEBUG = False in config/settings.py to disable the Django debug page and prevent internal error details from being exposed.
  • Add your production domain to ALLOWED_HOSTS in config/settings.py, for example ALLOWED_HOSTS = ["yourdomain.com"].
  • Place a reverse proxy such as nginx in front of both services. nginx handles TLS termination, static file serving, and forwards requests to the backend on port 8000 and the frontend on port 3000.
  • Replace the CMD in both Dockerfiles with production-grade servers: Gunicorn for the Django backend and next start (after next build) for the Next.js frontend.

Build docs developers (and LLMs) love