|
1 | 1 | # 02: JavaScript Frontend Development |
2 | 2 |
|
3 | | -## 시나리오 |
| 3 | +## Scenario |
4 | 4 |
|
5 | | -Contoso 아웃도어 컴파니의 마케팅 팀에서는 제품 홍보를 위한 마이크로 소셜 미디어 웹사이트를 빠르게 론칭하고 싶어 합니다. 개발팀의 JavaScript 개발자인 당신은 GitHub Codespaces 안에서 GitHub Copilot을 이용해 간단한 프론트엔드 웹 UI를 React 기반으로 만들어 달라는 요청을 받았습니다. |
| 5 | +Contoso is a company that sells products for various outdoor activities. A marketing department of Contoso would like to launch a micro social media website to promote their products for existing and potential customers. |
6 | 6 |
|
7 | | -## 사전 준비사항 |
| 7 | +As a JavaScript developer, you're going to build a JavaScript frontend app using React communicating to the Python backend API app. |
8 | 8 |
|
9 | | -[README](../README.md) 문서를 참조하여 개발 환경을 준비합니다. |
| 9 | +## Prerequisites |
10 | 10 |
|
11 | | -## 순서 |
| 11 | +Refer to the [README](../README.md) doc for preparation. |
12 | 12 |
|
13 | | -- [개발 과정 프롬프트](#개발-과정-프롬프트) |
14 | | - - [React 앱 프로젝트 준비](#react-앱-프로젝트-준비) |
15 | | - - [React 앱 프로젝트 구축](#react-앱-프로젝트-구축) |
| 13 | +## Getting Started |
16 | 14 |
|
17 | | -## 개발 과정 프롬프트 |
| 15 | +- [Check GitHub Copilot Agent Mode](#check-github-copilot-agent-mode) |
| 16 | +- [Prepare Custom Instructions](#prepare-custom-instructions) |
| 17 | +- [Prepare Application Project](#prepare-application-project) |
| 18 | +- [Set-up Figma MCP Server](#set-up-figma-mcp-server) |
| 19 | +- [Generate UI Components from Figma](#generate-ui-components-from-figma) |
| 20 | +- [Build React Frontend App](#build-react-frontend-app) |
| 21 | +- [Verify React Frontend App](#verify-react-frontend-app) |
18 | 22 |
|
19 | | -### React 앱 프로젝트 준비 |
| 23 | +### Check GitHub Copilot Agent Mode |
20 | 24 |
|
21 | | -1. GitHub Copilot이 현재 에이전트모드인지 확인합니다. 모델은 `Claude 3.7 Sonnet`을 선택하세요. |
| 25 | +1. Click the GitHub Copilot icon on the top of GitHub Codespace or VS Code and open GitHub Copilot window. |
22 | 26 |
|
23 | | -1. React 앱을 스캐폴딩(프로젝트 기본 구조 자동 생성)합니다. 아래와 같은 프롬프트를 이용해 보세요. |
| 27 | +  |
24 | 28 |
|
25 | | - ```text |
26 | | - `javascript` 폴더 안에 React를 사용한 프론트엔드 앱을 구성하려합니다. 패키지매니저는 `npm`, 빌드 툴은 `vite`, 언어는 JavaScript를 사용할 예정이고 AI를 사용한 빠른 마크업 개발을 위해 CSS 프레임워크론 Tailwind CSS를 사용할 예정입니다. 새로운 폴더를 만들지 말고 `javascript` 폴더에 React 앱 스캐폴딩을 시작해주세요. |
| 29 | +1. If you're asked to login or sign up, do it. It's free of charge. |
| 30 | +1. Make sure you're using GitHub Copilot Agent Mode. |
| 31 | + |
| 32 | +  |
| 33 | + |
| 34 | +1. Select model to either `GPT-4.1` or `Claude Sonnet 4`. |
| 35 | + |
| 36 | +### Prepare Custom Instructions |
| 37 | + |
| 38 | +1. Set the environment variable of `$REPOSITORY_ROOT`. |
| 39 | + |
| 40 | + ```bash |
| 41 | + # bash/zsh |
| 42 | + REPOSITORY_ROOT=$(git rev-parse --show-toplevel) |
| 43 | + ``` |
| 44 | + |
| 45 | + ```powershell |
| 46 | + # PowerShell |
| 47 | + $REPOSITORY_ROOT = git rev-parse --show-toplevel |
| 48 | + ``` |
| 49 | + |
| 50 | +1. Copy custom instructions. |
| 51 | + |
| 52 | + ```bash |
| 53 | + # bash/zsh |
| 54 | + cp -r $REPOSITORY_ROOT/docs/custom-instructions/javascript/. \ |
| 55 | + $REPOSITORY_ROOT/.github/ |
| 56 | + ``` |
| 57 | + |
| 58 | + ```powershell |
| 59 | + # PowerShell |
| 60 | + Copy-Item -Path $REPOSITORY_ROOT/docs/custom-instructions/javascript/* ` |
| 61 | + -Destination $REPOSITORY_ROOT/.github/ -Recurse -Force |
27 | 62 | ``` |
28 | 63 |
|
29 | | -1. 스캐폴딩이 잘 마무리 되었는지 확인합니다. |
| 64 | +### Prepare Application Project |
| 65 | + |
| 66 | +1. Make sure that you're using GitHub Copilot Agent Mode with the model of `Claude Sonnet 4` or `GPT-4.1`. |
| 67 | +1. Use prompt like below to scaffold a React web app project. |
30 | 68 |
|
31 | 69 | ```text |
32 | | - React 개발 서버를 실행해 애플리케이션이 잘 작동하는지 확인해주세요. |
| 70 | + I'd like to scaffold a React web app. Follow the instructions below. |
| 71 | + |
| 72 | + - Your working directory is `javascript`. |
| 73 | + - Identify all the steps first, which is you're going to do. |
| 74 | + - Use ViteJS as the frontend app framework. |
| 75 | + - Use default settings when initializing the project. |
| 76 | + - Use `SimpleSocialMediaApplication` as the name of the project while initializing. |
| 77 | + - Use the port number of `3030`. |
33 | 78 | ``` |
34 | 79 |
|
35 | | -1. 프로젝트에 필요한 `.gitignore` 파일을 추가합니다. |
| 80 | +### Set-up Figma MCP Server |
36 | 81 |
|
37 | | - ```text |
38 | | - `.gitignore`같은 필수 파일이 빠져있으니 추가해주세요. |
| 82 | +1. Get the personal access token (PAT) from [Figma](https://www.figma.com/). |
| 83 | +1. Set the environment variable of `$REPOSITORY_ROOT`. |
| 84 | +
|
| 85 | + ```bash |
| 86 | + # bash/zsh |
| 87 | + REPOSITORY_ROOT=$(git rev-parse --show-toplevel) |
| 88 | + ``` |
| 89 | +
|
| 90 | + ```powershell |
| 91 | + # PowerShell |
| 92 | + $REPOSITORY_ROOT = git rev-parse --show-toplevel |
| 93 | + ``` |
| 94 | +
|
| 95 | +1. Copy MCP server settings. |
| 96 | +
|
| 97 | + ```bash |
| 98 | + # bash/zsh |
| 99 | + cp -r $REPOSITORY_ROOT/docs/.vscode/. \ |
| 100 | + $REPOSITORY_ROOT/.vscode/ |
| 101 | + ``` |
| 102 | +
|
| 103 | + ```powershell |
| 104 | + # PowerShell |
| 105 | + Copy-Item -Path $REPOSITORY_ROOT/docs/.vscode/* ` |
| 106 | + -Destination $REPOSITORY_ROOT/.vscode/ -Recurse -Force |
39 | 107 | ``` |
40 | 108 |
|
41 | | -### React 앱 프로젝트 구축 |
| 109 | +1. Open Command Palette by typing F1 or `Ctrl`+`Shift`+`P` on Windows or `Cmd`+`Shift`+`P` on Mac OS, and search `MCP: List Servers`. |
| 110 | +1. Choose `Framelink Figma MCP` then click `Start Server`. |
| 111 | +1. Enter the PAT you get issued from Figma. |
| 112 | +
|
| 113 | +### Generate UI Components from Figma |
| 114 | +
|
| 115 | +1. Make sure that you're using GitHub Copilot Agent Mode with the model of `Claude Sonnet 4` or `GPT-4.1`. |
| 116 | +1. Make sure that you're running the Figma MCP server. |
| 117 | +1. Copy the [Figma design template](https://www.figma.com/community/file/1495954632647006209) to your account. |
| 118 | +
|
| 119 | +  |
| 120 | +
|
| 121 | +1. Right-click each section - `Home`, `Search`, `Post Details`, `Post Modal` and `Name Input Modal` 👉 Select `Copy/Paste as` 👉 Select `Copy link to selection` to get the link to each section. Take note all five links. |
| 122 | +
|
| 123 | +### Build React Frontend App |
42 | 124 |
|
43 | | -1. 이제 Contoso 아웃도어 컴파니의 제품 홍보를 위한 마이크로 소셜 미디어 웹사이트의 기능을 구현합니다. 백엔드와 연동 전 먼저 UI 작업을 시작합니다. (API 스키마를 컨택스트로 주입) |
| 125 | +1. Make sure that you're using GitHub Copilot Agent Mode with the model of `Claude Sonnet 4` or `GPT-4.1`. |
| 126 | +1. Make sure that you have all the Figma section links of 5 retrieved from the [previous section](#generate-ui-components-from-figma). |
| 127 | +1. Add [`product-requirements.md`](../product-requirements.md) and [`openapi.yaml`](../openapi.yaml) to GitHub Copilot. |
| 128 | +1. Use prompt like below to build the application based on the requirements and OpenAPI document. |
44 | 129 |
|
45 | 130 | ```text |
46 | | - 백엔드 개발자에게 전달받은 API 스키마 정보를 바탕으로 구현 가능한 기능을 스스로 판단하여 UI를 먼저 구현해주세요. 반응형 디자인으로 모바일과 데스크탑 모두를 지원해야하고, TailwindCSS를 활용해 깔끔하고 현대적인 UI를 구현해주세요. |
| 131 | + I'd like to build a React web app. Follow the instructions below. |
| 132 | + |
| 133 | + - Your working directory is `javascript`. |
| 134 | + - Identify all the steps first, which is you're going to do. |
| 135 | + - There's a backend API app running on `http://localhost:5050`. |
| 136 | + - Use `openapi.yaml` that describes all the endpoints and data schema. |
| 137 | + - Create all the UI components defined in this link: {{FIGMA_SECTION_LINK}}. |
| 138 | + - DO NOT add anything not defined in `openapi.yaml`. |
| 139 | + - DO NOT modify anything defined in `openapi.yaml`. |
| 140 | + - Give visual indication when the backend API is unavailable or unreachable for any reason. |
| 141 | + ``` |
| 142 | +
|
| 143 | +1. Repeat four more times for the rest four Figma design links. |
| 144 | +1. Click the `[keep]` button of GitHub Copilot to take the changes. |
| 145 | +
|
| 146 | +### Verify React Frontend App |
| 147 | +
|
| 148 | +1. Make sure that the FastAPI backend app is up and running. |
47 | 149 |
|
48 | | - 모든 작업은 `javascript`폴더 안에서 진행되어야 합니다. |
| 150 | + ```text |
| 151 | + Run the FastAPI backend API, which is located at the `python` directory. |
49 | 152 | ``` |
50 | 153 |
|
51 | | -2. 백엔드 port 정보를 받아 실제 백엔드 연동을 진행합니다. |
| 154 | +1. Verify if it's built properly or not. |
52 | 155 |
|
53 | 156 | ```text |
54 | | - 백엔드 엔지니어에게 받은 포트 번호는 `8000`이야. 우리는 모노레포로 작업중이니까 포트번호만 변경해서 실제 연동을 진행해줘. |
| 157 | + Run the React app and verify if the app is properly running. |
| 158 | + |
| 159 | + If app running fails, analyze the issues and fix them. |
55 | 160 | ``` |
56 | 161 |
|
| 162 | +1. Open a web browser and navigate to `http://localhost:3030`. |
| 163 | +1. Verify if both frontend and backend apps are running properly. |
| 164 | +1. Click the `[keep]` button of GitHub Copilot to take the changes. |
| 165 | +
|
57 | 166 | --- |
58 | 167 |
|
59 | | -축하합니다! **JavaScript 앱 개발** 실습이 끝났습니다. 이제 [STEP 03: Java 앱 개발](./03-java.md) 단계로 넘어가세요. |
| 168 | +OK. You've completed the "JavaScript" step. Let's move onto [STEP 03: Java Migration from Python](./03-java.md). |
0 commit comments