Skip to content

About

No description, website, or topics provided.

Resources

Stars

10 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

Minimal Monorepo Chat Demo

This project is a guided demonstration of using GitHub Copilot and prompt-driven workflows to build a working chat bot application from an existing chat UI reference image (chat.png). The goal is to show how a sequence of prompts can generate and evolve a full-stack chat app from scaffold to frontend and backend behavior.

Sample Chat UI

Prerequisites

Before starting, make sure the requirements below are installed and configured.

1. Required Tools and Access

  1. Git (for cloning the repository and committing changes)
  2. VS Code (with GitHub Copilot extensions)
  3. Node.js LTS (for React/Vite)
  4. Python 3.10+ (if using a Python backend) or a Node.js backend runtime
  5. Ollama (for running a local LLM), supported on macOS, Windows, and Linux
  6. GitHub Copilot access (organization license or GitHub Education)

2. Local Tooling Setup (Windows)

2.1 Option 1: Install with winget (Recommended)

Run the following commands in PowerShell or Command Prompt:

# 1) Git
winget install Git.Git

# 2) VS Code
winget install Microsoft.VisualStudioCode

# 3) Node.js (LTS)
winget install OpenJS.NodeJS.LTS

# 4) Python 3.10+
winget install Python.Python.3.11

# 5) Ollama
winget install Ollama.Ollama

After VS Code is installed, add GitHub Copilot:

  1. Open VS Code.
  2. Press Ctrl+Shift+X.
  3. Search for GitHub Copilot.
  4. Install the extension published by GitHub.
  5. Sign in with your GitHub account.

2.2 Option 2: Install with Chocolatey

Install Chocolatey first (run as Administrator):

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Then install required tools:

choco install git -y
choco install vscode -y
choco install nodejs-lts -y
choco install python311 -y
choco install ollama -y

2.3 Option 3: One-line winget setup

winget install Git.Git; winget install Microsoft.VisualStudioCode; winget install OpenJS.NodeJS.LTS; winget install Python.Python.3.11; winget install Ollama.Ollama

2.4 Post-install verification commands

git --version
node --version
npm --version
python --version
ollama --version
code --version

3. GitHub and Copilot Access

  1. You need a GitHub account and active GitHub Copilot access (organization license or GitHub Education).
  2. GitHub Education provides student and teacher programs.
  3. Introductory video reference: https://www.youtube.com/watch?v=taIzqrUTiJk

4. Ollama Setup and Quick Validation (Before Class)

  1. Install Ollama.
    • Use the official quickstart for macOS/Windows/Linux and follow the Download Ollama steps.
  2. Verify installation:
    • Run ollama --version and confirm a version is returned.
  3. Pull a small model (suitable for 8 GB RAM):
    • Recommended: ollama pull gemma2:2b (about 1.6 GB)
    • Alternative: ollama pull phi3 (about 2.2 GB)
  4. Run a quick model test:
    • Execute ollama run gemma2:2b, type Hello, and confirm you get a response.

Project Overview

This repository contains a minimal monorepo setup with:

  • frontend: React + Vite (port 5173)
  • backend: Node.js + Express (port 3001)

Scope:

  • No database
  • No authentication
  • Simple chat demo only

Folder Structure

.
├─ backend/
│  ├─ src/
│  │  └─ index.js
│  └─ package.json
├─ frontend/
│  ├─ src/
│  │  ├─ App.css
│  │  ├─ App.jsx
│  │  └─ main.jsx
│  ├─ index.html
│  ├─ package.json
│  └─ vite.config.js
├─ package.json
└─ README.md

package.json Scripts

Root (package.json):

  • npm run dev: Run backend and frontend together.
  • npm run dev:backend: Run only backend.
  • npm run dev:frontend: Run only frontend.
  • npm run build: Build frontend.
  • npm run start: Start backend in non-watch mode.

Backend (backend/package.json):

  • npm run dev --workspace backend: Start backend with watch mode.
  • npm run start --workspace backend: Start backend once.

Frontend (frontend/package.json):

  • npm run dev --workspace frontend: Start Vite dev server on 5173.
  • npm run build --workspace frontend: Build frontend.
  • npm run preview --workspace frontend: Preview built frontend.

Run Instructions

  1. Install dependencies from the repo root:
npm install
  1. Start both apps:
npm run dev
  1. Open the frontend:
  1. Backend health endpoint:

Chat flow:

  • Frontend sends POST /api/chat to backend.
  • Backend returns a simple echo response.

Prompt Execution Order

Run the following prompts in order. Each prompt builds on the output of the previous one.

Step 1. .github/prompts/01-mono-repo.prompt.md

Creates the monorepo skeleton and base configuration.

Expected Output:

  • frontend/ and backend/ directories are created.
  • backend/src/index.js is set up with an Express server (port 3001).
  • frontend/src/App.jsx, main.jsx, and App.css are set up as a base React app.
  • Root package.json defines npm run dev, npm run build, and npm run start scripts.
  • README.md is updated with folder structure and run instructions.

Step 2. .github/prompts/02-frontend.prompt.md

Adds React chat UI components and styling.

Expected Output:

  • ChatPage, MessageList, MessageBubble, and MessageInput components are created.
  • Messages are stored in component state, and POST http://localhost:3001/chat is called when sending.
  • CSS styling approximates the layout shown in chat.png (bubbles, colors, spacing).
  • No UI library is used, and the layout remains responsive.

Step 3. .github/prompts/03-backend-with-ollama.prompt.md

Adds Ollama integration to the backend.

Expected Output:

  • backend/src/index.js is updated so the POST /chat endpoint forwards requests to Ollama at http://localhost:11434/api/chat (model: gemma2:2b).
  • The message "merhaba" always returns the fixed response: "merhaba nasılsınız?".
  • If Ollama is unavailable, the same fixed response is used as fallback and the app does not crash.

About

No description, website, or topics provided.

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages