|
| 1 | +# Module 07 - Complete Repository Structure |
| 2 | + |
| 3 | +## 📁 Folder Organization |
| 4 | + |
| 5 | +``` |
| 6 | +module-07-web-applications/ |
| 7 | +├── README.md # Main module documentation |
| 8 | +├── .devcontainer/ # GitHub Codespaces configuration |
| 9 | +│ ├── devcontainer.json # Codespaces settings |
| 10 | +│ └── setup.sh # Auto-setup script |
| 11 | +├── docs/ |
| 12 | +│ ├── best-practices.md # Production patterns |
| 13 | +│ ├── troubleshooting.md # Common issues & solutions |
| 14 | +│ └── architecture-diagrams.md # Visual references |
| 15 | +├── exercises/ |
| 16 | +│ ├── exercise-1-todo/ |
| 17 | +│ │ ├── README.md # Exercise instructions |
| 18 | +│ │ ├── starter/ |
| 19 | +│ │ │ ├── frontend/ |
| 20 | +│ │ │ │ ├── package.json |
| 21 | +│ │ │ │ ├── vite.config.js |
| 22 | +│ │ │ │ ├── tailwind.config.js |
| 23 | +│ │ │ │ ├── postcss.config.js |
| 24 | +│ │ │ │ ├── index.html |
| 25 | +│ │ │ │ └── src/ |
| 26 | +│ │ │ │ ├── App.jsx # Minimal starter |
| 27 | +│ │ │ │ ├── App.css |
| 28 | +│ │ │ │ └── main.jsx |
| 29 | +│ │ │ └── backend/ |
| 30 | +│ │ │ ├── requirements.txt |
| 31 | +│ │ │ └── main.py # Minimal starter |
| 32 | +│ │ └── solution/ # Complete working solution |
| 33 | +│ │ ├── frontend/ |
| 34 | +│ │ └── backend/ |
| 35 | +│ ├── exercise-2-notes/ |
| 36 | +│ │ ├── README.md |
| 37 | +│ │ ├── starter/ |
| 38 | +│ │ │ └── frontend/ |
| 39 | +│ │ │ ├── package.json |
| 40 | +│ │ │ ├── vite.config.js |
| 41 | +│ │ │ ├── tailwind.config.js |
| 42 | +│ │ │ ├── index.html |
| 43 | +│ │ │ └── src/ |
| 44 | +│ │ │ ├── App.jsx |
| 45 | +│ │ │ └── main.jsx |
| 46 | +│ │ └── solution/ |
| 47 | +│ │ └── frontend/ |
| 48 | +│ └── exercise-3-recipes/ |
| 49 | +│ ├── README.md |
| 50 | +│ ├── starter/ |
| 51 | +│ │ ├── frontend/ |
| 52 | +│ │ │ ├── package.json |
| 53 | +│ │ │ ├── vite.config.js |
| 54 | +│ │ │ ├── tailwind.config.js |
| 55 | +│ │ │ ├── index.html |
| 56 | +│ │ │ └── src/ |
| 57 | +│ │ │ ├── App.jsx |
| 58 | +│ │ │ └── main.jsx |
| 59 | +│ │ └── backend/ |
| 60 | +│ │ ├── requirements.txt |
| 61 | +│ │ ├── .env.example |
| 62 | +│ │ └── main.py |
| 63 | +│ └── solution/ |
| 64 | +│ ├── frontend/ |
| 65 | +│ └── backend/ |
| 66 | +└── resources/ |
| 67 | + ├── copilot-prompts.md # Best prompts collection |
| 68 | + └── quick-reference.md # Cheatsheet |
| 69 | +``` |
| 70 | + |
| 71 | +## 📄 Starter Files Content |
| 72 | + |
| 73 | +### Exercise 1 - Frontend `package.json` |
| 74 | +```json |
| 75 | +{ |
| 76 | + "name": "todo-app-frontend", |
| 77 | + "version": "1.0.0", |
| 78 | + "type": "module", |
| 79 | + "scripts": { |
| 80 | + "dev": "vite", |
| 81 | + "build": "vite build", |
| 82 | + "preview": "vite preview" |
| 83 | + }, |
| 84 | + "dependencies": { |
| 85 | + "react": "^18.2.0", |
| 86 | + "react-dom": "^18.2.0", |
| 87 | + "axios": "^1.6.0" |
| 88 | + }, |
| 89 | + "devDependencies": { |
| 90 | + "@types/react": "^18.2.0", |
| 91 | + "@types/react-dom": "^18.2.0", |
| 92 | + "@vitejs/plugin-react": "^4.0.0", |
| 93 | + "autoprefixer": "^10.4.14", |
| 94 | + "postcss": "^8.4.24", |
| 95 | + "tailwindcss": "^3.3.0", |
| 96 | + "vite": "^4.4.0" |
| 97 | + } |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +### Exercise 1 - Backend `requirements.txt` |
| 102 | +``` |
| 103 | +fastapi==0.104.1 |
| 104 | +uvicorn==0.24.0 |
| 105 | +sqlalchemy==2.0.23 |
| 106 | +python-dotenv==1.0.0 |
| 107 | +``` |
| 108 | + |
| 109 | +### Exercise 1 - Minimal Starter `App.jsx` |
| 110 | +```javascript |
| 111 | +import { useState } from 'react' |
| 112 | +import './App.css' |
| 113 | + |
| 114 | +function App() { |
| 115 | + // Copilot Prompt: Create a complete todo app with: |
| 116 | + // - Add todo functionality |
| 117 | + // - List todos with checkboxes |
| 118 | + // - Delete todos |
| 119 | + // - Filter by status (all/active/completed) |
| 120 | + // - Use Tailwind CSS for styling |
| 121 | + // - Connect to backend API at http://localhost:8000 |
| 122 | + |
| 123 | + return ( |
| 124 | + <div className="min-h-screen bg-gray-100"> |
| 125 | + <h1 className="text-3xl font-bold text-center py-8"> |
| 126 | + Todo App |
| 127 | + </h1> |
| 128 | + {/* Let Copilot build the rest! */} |
| 129 | + </div> |
| 130 | + ) |
| 131 | +} |
| 132 | + |
| 133 | +export default App |
| 134 | +``` |
| 135 | + |
| 136 | +### Exercise 2 - Frontend `package.json` |
| 137 | +```json |
| 138 | +{ |
| 139 | + "name": "smart-notes-frontend", |
| 140 | + "version": "1.0.0", |
| 141 | + "type": "module", |
| 142 | + "scripts": { |
| 143 | + "dev": "vite", |
| 144 | + "build": "vite build", |
| 145 | + "preview": "vite preview" |
| 146 | + }, |
| 147 | + "dependencies": { |
| 148 | + "react": "^18.2.0", |
| 149 | + "react-dom": "^18.2.0", |
| 150 | + "@uiw/react-md-editor": "^3.23.0", |
| 151 | + "react-icons": "^4.11.0", |
| 152 | + "fuse.js": "^7.0.0", |
| 153 | + "uuid": "^9.0.1", |
| 154 | + "date-fns": "^2.30.0" |
| 155 | + }, |
| 156 | + "devDependencies": { |
| 157 | + "@types/react": "^18.2.0", |
| 158 | + "@types/react-dom": "^18.2.0", |
| 159 | + "@vitejs/plugin-react": "^4.0.0", |
| 160 | + "autoprefixer": "^10.4.14", |
| 161 | + "postcss": "^8.4.24", |
| 162 | + "tailwindcss": "^3.3.0", |
| 163 | + "vite": "^4.4.0" |
| 164 | + } |
| 165 | +} |
| 166 | +``` |
| 167 | + |
| 168 | +### Exercise 3 - Backend `requirements.txt` |
| 169 | +``` |
| 170 | +fastapi==0.104.1 |
| 171 | +uvicorn==0.24.0 |
| 172 | +openai==1.3.0 |
| 173 | +python-dotenv==1.0.0 |
| 174 | +python-multipart==0.0.6 |
| 175 | +cloudinary==1.36.0 |
| 176 | +httpx==0.25.2 |
| 177 | +slowapi==0.1.9 |
| 178 | +``` |
| 179 | + |
| 180 | +### Exercise 3 - `.env.example` |
| 181 | +```bash |
| 182 | +# OpenAI Configuration |
| 183 | +OPENAI_API_KEY=sk-...your-key-here |
| 184 | + |
| 185 | +# Optional: Cloudinary for image uploads |
| 186 | +CLOUDINARY_CLOUD_NAME=your-cloud-name |
| 187 | +CLOUDINARY_API_KEY=your-api-key |
| 188 | +CLOUDINARY_API_SECRET=your-api-secret |
| 189 | + |
| 190 | +# Application Settings |
| 191 | +DEBUG=True |
| 192 | +SECRET_KEY=your-secret-key-here |
| 193 | +``` |
| 194 | + |
| 195 | +### Universal `vite.config.js` |
| 196 | +```javascript |
| 197 | +import { defineConfig } from 'vite' |
| 198 | +import react from '@vitejs/plugin-react' |
| 199 | + |
| 200 | +export default defineConfig({ |
| 201 | + plugins: [react()], |
| 202 | + server: { |
| 203 | + port: 5173, |
| 204 | + host: true, |
| 205 | + proxy: { |
| 206 | + '/api': { |
| 207 | + target: 'http://localhost:8000', |
| 208 | + changeOrigin: true, |
| 209 | + } |
| 210 | + } |
| 211 | + } |
| 212 | +}) |
| 213 | +``` |
| 214 | + |
| 215 | +### Universal `tailwind.config.js` |
| 216 | +```javascript |
| 217 | +/** @type {import('tailwindcss').Config} */ |
| 218 | +export default { |
| 219 | + content: [ |
| 220 | + "./index.html", |
| 221 | + "./src/**/*.{js,ts,jsx,tsx}", |
| 222 | + ], |
| 223 | + theme: { |
| 224 | + extend: {}, |
| 225 | + }, |
| 226 | + plugins: [], |
| 227 | +} |
| 228 | +``` |
| 229 | + |
| 230 | +### Minimal Backend Starter |
| 231 | +```python |
| 232 | +# main.py - Minimal starter for all exercises |
| 233 | +from fastapi import FastAPI |
| 234 | +from fastapi.middleware.cors import CORSMiddleware |
| 235 | + |
| 236 | +app = FastAPI() |
| 237 | + |
| 238 | +# CORS configuration |
| 239 | +app.add_middleware( |
| 240 | + CORSMiddleware, |
| 241 | + allow_origins=["*"], # Configure properly for production |
| 242 | + allow_credentials=True, |
| 243 | + allow_methods=["*"], |
| 244 | + allow_headers=["*"], |
| 245 | +) |
| 246 | + |
| 247 | +@app.get("/") |
| 248 | +def read_root(): |
| 249 | + return {"message": "API is running!"} |
| 250 | + |
| 251 | +# Copilot will help you build the rest! |
| 252 | +``` |
| 253 | + |
| 254 | +## 🚀 Quick Start Commands |
| 255 | + |
| 256 | +### For Students: |
| 257 | +```bash |
| 258 | +# 1. Fork this repository |
| 259 | +# 2. Create a Codespace from your fork |
| 260 | +# 3. Wait for setup to complete (2-3 minutes) |
| 261 | +# 4. Start coding! |
| 262 | + |
| 263 | +# Exercise 1 |
| 264 | +cd exercises/exercise-1-todo/starter |
| 265 | +# Follow README.md |
| 266 | + |
| 267 | +# Exercise 2 |
| 268 | +cd exercises/exercise-2-notes/starter |
| 269 | +# Follow README.md |
| 270 | + |
| 271 | +# Exercise 3 |
| 272 | +cd exercises/exercise-3-recipes/starter |
| 273 | +# Add your OpenAI API key to backend/.env |
| 274 | +# Follow README.md |
| 275 | +``` |
| 276 | + |
| 277 | +### For Instructors: |
| 278 | +```bash |
| 279 | +# Clone the repository |
| 280 | +git clone <repo-url> |
| 281 | + |
| 282 | +# Test all exercises |
| 283 | +./scripts/test-all-exercises.sh |
| 284 | + |
| 285 | +# Create solution branches |
| 286 | +git checkout -b solutions |
| 287 | +# Add complete solutions |
| 288 | +git push origin solutions |
| 289 | +``` |
| 290 | + |
| 291 | +## 📝 Notes |
| 292 | + |
| 293 | +- All npm dependencies are pre-installed in Codespaces |
| 294 | +- Python virtual environments are pre-created |
| 295 | +- Ports are automatically forwarded |
| 296 | +- GitHub Copilot is pre-activated |
| 297 | +- No local setup required! |
| 298 | + |
| 299 | +This structure provides everything needed for a smooth 3-hour workshop experience in GitHub Codespaces. |
0 commit comments