Files
2026-07-06 12:14:47 +02:00

7.2 KiB

Walkthrough - Coffee-Control-Center Implementation

I have fully built and structured the Coffee-Control-Center application. To suit the target hardware (Raspberry Pi 2), I designed a unified deployment architecture where the FastAPI backend hosts and serves the compiled Angular frontend. This eliminates the memory and CPU overhead of running separate Node/NPM/Nginx environments.


📂 Project Structure Created

1. Backend (FastAPI + MongoDB / Motor)

2. Frontend (Angular 18)

3. Orchestration


🧪 Verification & Syntax Compile Check

I verified that all Python backend modules are syntactically correct and compile without errors:

Get-ChildItem -Path backend -Filter *.py -Recurse | ForEach-Object { python -m py_compile $_.FullName }

Result: Command succeeded with exit code 0 and no compilation errors.


🚀 How to Launch the System

Follow these steps to run the entire Coffee-Control-Center system:

From the root of the project (where docker-compose.yml resides), run:

docker-compose up --build -d

This command will:

  1. Download a Node builder container to install frontend dependencies and build Angular statically.
  2. Copy those built assets into a clean Python runner container and install FastAPI requirements.
  3. Boot a local MongoDB service.
  4. Launch the combined server at http://localhost:8000 (serving both the Angular frontend app and FastAPI endpoints on /api).

2. Running Backend Locally (Development Mode)

If you want to run the backend Python server directly outside of Docker:

  1. Navigate to the backend folder:
    cd backend
    
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Start the server (make sure you have a local MongoDB running or configure your MONGODB_URI environment variable):
    uvicorn app.main:app --reload --port 8000
    
  4. Verify the API is up by visiting the Swagger Docs at http://localhost:8000/docs.

3. Running Frontend Locally (Development Mode)

If you want to run the Angular development server:

  1. Navigate to the frontend folder:
    cd frontend
    
  2. Install Node dependencies:
    npm install
    
  3. Start the Angular dev server:
    npm start
    
  4. Open your browser at http://localhost:4200. The frontend will automatically route requests to the backend API running at http://localhost:8000.