Simplify client: remove Svelte, use pure Astro with SSR data fetching#179
Simplify client: remove Svelte, use pure Astro with SSR data fetching#179GeekTrainer merged 30 commits intomainfrom
Conversation
- Convert DogList.svelte and DogDetails.svelte to Astro components - Move data fetching from client-side to Astro page frontmatter (SSR) - Remove middleware API proxy (no longer needed with server-side fetch) - Remove Svelte, @astrojs/svelte, svelte.config.js - Remove dead deps: autoprefixer, postcss, flask-cors - Remove unused starter assets (astro.svg, background.svg) - Eliminate global.css (merged into Layout.astro) - Simplify Header to always-visible nav (zero client JS) - Remove dead dark: variants and transition classes - Add data-testid attributes for stable e2e test selectors - Add PLAN.md with remaining work items Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ld deps Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
…rences) Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
…r e2e tests Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
E2e tests with real Flask + seeded test DB, fix platform-specific build failures, update workshop content, remove Google Fonts, disable telemetry
There was a problem hiding this comment.
Pull request overview
This PR simplifies the workshop app by removing Svelte from the Astro client, moving data fetching to Astro SSR frontmatter, and aligning e2e tests/docs with the new “pure Astro” architecture.
Changes:
- Replace Svelte components with Astro components and switch pages to server-side fetches from the Flask API.
- Remove the Astro middleware API proxy plus Svelte-related config/dependencies and unused starter assets/styles.
- Update Playwright e2e setup to run against a real Flask server with a deterministic seeded SQLite test DB; update workshop docs accordingly.
Reviewed changes
Copilot reviewed 34 out of 38 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| server/utils/seed_test_database.py | Adds deterministic SQLite seeding script for e2e tests. |
| server/requirements.txt | Removes flask-cors; keeps core Flask/SQLAlchemy deps. |
| server/app.py | Allows DB path override via DATABASE_PATH env var. |
| scripts/start-app.sh | Updates comment to reflect Astro (not SvelteKit) client process. |
| content/full-day/README.md | Updates prerequisites text to remove Svelte reference. |
| content/full-day/6-code.md | Updates exercise instructions to reference .astro components. |
| content/full-day/5-context.md | Updates frontend description to “Astro” only. |
| content/full-day/3-codespaces.md | Removes Svelte VS Code extension from recommended list. |
| content/1-hour/README.md | Updates prerequisites text to remove Svelte reference. |
| content/1-hour/4-add-feature.md | Updates exercise instructions to reference .astro components. |
| content/1-hour/3-copilot-instructions.md | Updates sample Copilot instructions to “Astro” only. |
| content/1-hour/1-add-endpoint.md | Updates architecture description to remove Svelte mention. |
| content/1-hour/0-setup.md | Updates startup description to “Astro app” (not Astro/Svelte). |
| client/svelte.config.js | Removes Svelte config (deleted). |
| client/src/styles/global.css | Removes global Tailwind import file (deleted). |
| client/src/pages/index.astro | SSR-fetch dogs in frontmatter and render via DogList.astro. |
| client/src/pages/dog/[id].astro | SSR-fetch dog details in frontmatter; add error/back-link testid. |
| client/src/pages/about.astro | Removes unused imports/comment; adds data-testid for back link. |
| client/src/middleware.ts | Removes API proxy middleware (deleted). |
| client/src/layouts/Layout.astro | Moves Tailwind import to global style; removes dark-mode/font preload bits. |
| client/src/components/Header.astro | Simplifies header to always-visible nav; removes client JS toggle menu. |
| client/src/components/DogList.svelte | Removes Svelte dog list component (deleted). |
| client/src/components/DogList.astro | Adds Astro dog list component with stable data-testids. |
| client/src/components/DogDetails.svelte | Removes Svelte dog details component (deleted). |
| client/src/components/DogDetails.astro | Adds Astro dog details component with stable data-testids. |
| client/src/assets/background.svg | Removes unused starter asset (deleted). |
| client/src/assets/astro.svg | Removes unused starter asset (deleted). |
| client/playwright.config.ts | Starts Flask+Astro servers for e2e and seeds a dedicated test DB. |
| client/package.json | Removes Svelte/PostCSS-related deps; keeps Astro/Tailwind/Playwright. |
| client/package-lock.json | Updates lockfile to reflect removed deps and version bumps. |
| client/e2e-tests/homepage.spec.ts | Updates selectors to data-testid and SSR expectations. |
| client/e2e-tests/dog-details.spec.ts | Updates selectors and adds direct dog detail assertions. |
| client/e2e-tests/api-integration.spec.ts | Reworks integration tests to validate SSR-rendered API data. |
| client/e2e-tests/README.md | Documents the “real Flask server + seeded DB” e2e architecture. |
| client/astro.config.mjs | Removes Svelte integration and disables Astro telemetry. |
| README.md | Updates top-level tech stack description (no Svelte). |
| PLAN.md | Adds plan/todos for the simplification work. |
| .gitignore | Ignores the seeded e2e SQLite database file. |
- Fix repo path in devcontainer postStartCommand (dog-shelter → pets-workshop) - Remove unused port 5000 from forwardPorts - Fix line number references in 1-hour and full-day exercises Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move client/, server/, and scripts/ directories under app/ to consolidate application code. Update all references in dependabot config, gitignore, workshop content, and filepath comments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add page/per_page query parameters to GET /api/dogs endpoint with paginated JSON response. Update homepage to display pagination controls. Add test dogs to seed data and update e2e tests for pagination. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dynamically detect when node_modules is a symlink and add the real path to Vite's server.fs.allow list. This resolves dev toolbar errors in environments with symlinked dependencies while remaining a no-op when node_modules is not symlinked. Add esbuild-wasm as a dependency. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Clean up the original directories that were moved under app/. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move sandbox Dockerfile and startup script into .dev/ directory to keep dev tooling separate from workshop and app code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extract project-specific values (image name, watch files) into sandbox.json so the startup script is reusable across projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot Can you properly resolve the merge conflicts that need to happen here? Also, can you go through the content and ensure all of the steps point to the proper new folder (app/client and app/server rather than /client and /server) |
|
@GeekTrainer I've opened a new pull request, #190, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: GeekTrainer <6109729+GeekTrainer@users.noreply.github.com>
- Revert content/github-actions/2-code-scanning.md to main (remove UI text changes) - Remove orphaned content/shared-images/setup-secret-protection.png - Remove .dev/ sandbox tooling (not needed for this PR) - Remove root PLAN.md planning artifact Path updates in actions content (server/ → app/server/, client/ → app/client/) are unchanged as they were already correct. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Code: - seed_database.py now respects DATABASE_PATH env var (matches app.py pattern) Factual fixes: - Fix reusable workflow nesting limit: 10 → 4 levels (8-reusable-workflows.md) - Add cache: 'pip' to composite action setup-python step (7-custom-actions.md) - Clarify secrets vs variables distinction in reusable workflows example Content cleanup: - Fix Ctl → Ctrl typo across 8 files - Fix 'Then caller' → 'The caller' typo (8-reusable-workflows.md) - Fix URL path: using-workflows → writing-workflows (5-matrix-strategies.md) - Fix misleading [marketplace] link label → [caching] in README - Rewrite 4-caching.md intro to lead with caching, not marketplace - Clarify 'code scanning workflow' next step (9-required-workflows.md) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1-hour fixes: - Fix ## HERE line number: 69 → 80 (1-add-endpoint.md) - Fix WS → WSL abbreviation (README.md) - Fix 'prior set' → 'prior step' (0-setup.md) - Fix 'one of models' → 'one of the models' (5-bonus.md) - Fix test command: remove 'as you did previously', add working dir (4-add-feature.md) - Fix absolute link paths to relative (1-add-endpoint.md) - Fix Ctl → Ctrl (1-add-endpoint.md) Full-day fixes: - Fix if __name__ line number: 71 → 82, fix code indent (6-code.md) - Fix 'Mongo DB' → 'SQLite' (3-codespaces.md) - Fix 3 corrupted URLs (5-context.md) - Fix XCode link syntax: parentheses → brackets (5-context.md) - Fix wrong issue title/PR name to match exercise 2 (7-github-flow.md) - Fix 'front-end tests' → 'server unit tests' (7-github-flow.md) - Fix 'virtual server' → 'virtual environment' (6-code.md) - Fix cd server → cd app/server (6-code.md) - Fix Explorer path: 'server' → 'app > server' (4-testing.md) - Fix test_file.py → test_app.py (5-context.md) - Fix 'previously talked about extensions' (8-deployment.md) - Fix Ctl → Ctrl across 6 files - Update actions/checkout@v3 → v4, setup-python@v4 → v5 (4-testing.md) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merge main, resolve conflicts, and fix content path references
Bump astro 5→6, @astrojs/node 9→10, typescript 5→6, esbuild-wasm 0.27→0.28, and minor updates for tailwindcss, playwright, and @types/node. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ght-mcp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove redundant db.create_all() in seed_test_database.py (init_db already handles it) - Set reuseExistingServer: false for Flask to ensure test data is always seeded - Replace POSIX shell commands with cross-platform alternatives: - Add start-test-server.js Node script for Flask server launch - Use cross-env for Astro dev server env vars Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve conflicts: - .gitignore, README.md: keep simplify branch versions - content/github-actions/: take main's updated content - Update github-actions content paths from client/ and server/ to app/client/ and app/server/ to match new folder structure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update working-directory references from ./server and ./client to ./app/server and ./app/client to match new folder structure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR simplifies the workshop application by removing Svelte and client-side fetching, moving the Astro UI to SSR-driven data fetching, and updating docs/tooling to match the new app/client + app/server layout.
Changes:
- Migrates UI components from Svelte to
.astroand switches pages to SSRfetch()in frontmatter (removing the client middleware proxy). - Updates the Flask API to support pagination and configurable SQLite DB path via
DATABASE_PATH. - Rehomes/updates Playwright e2e setup plus workshop documentation to reflect the new directory structure and selectors.
Show a summary per file
| File | Description |
|---|---|
| server/requirements.txt | Removes old server dependency file (moved under app/server). |
| content/github-actions/9-required-workflows.md | Updates example paths to app/server/.... |
| content/github-actions/7-custom-actions.md | Updates workshop steps for new server/client paths and working directories. |
| content/github-actions/5-matrix-strategies.md | Updates CI snippet paths to app/server/.... |
| content/github-actions/4-caching.md | Updates npm cache path to app/client/package-lock.json. |
| content/github-actions/3-running-tests.md | Updates workflow snippets for new layout and paths. |
| content/full-day/README.md | Removes Svelte mention from prerequisites. |
| content/full-day/8-deployment.md | Fixes keyboard shortcut text (“Ctrl”) and adjusts Copilot Chat copy. |
| content/full-day/7-github-flow.md | Updates shortcuts (“Ctrl”), issue/PR wording, and workflow narrative. |
| content/full-day/6-code.md | Updates file paths to app/server/... and switches “Svelte” to “Astro” in instructions. |
| content/full-day/5-context.md | Updates backend test naming guidance and frontend tech description; fixes several links. |
| content/full-day/4-testing.md | Updates paths to app/server/... and modernizes workflow action versions in snippet. |
| content/full-day/3-codespaces.md | Removes Svelte extension/port, updates postStartCommand path, fixes wording/shortcuts. |
| content/full-day/2-issues.md | Fixes “Ctrl” shortcut text. |
| content/1-hour/README.md | Removes Svelte mention from prerequisites; fixes WSL acronym. |
| content/1-hour/5-bonus.md | Minor wording cleanup for model selection step. |
| content/1-hour/4-add-feature.md | Updates instructions to Astro + new file paths; clarifies how to run tests. |
| content/1-hour/3-copilot-instructions.md | Removes Svelte mention from sample Copilot instructions. |
| content/1-hour/1-add-endpoint.md | Updates server/client paths and script paths; fixes “Ctrl” shortcut text. |
| content/1-hour/0-setup.md | Updates startup script paths and removes Svelte mention. |
| client/svelte.config.js | Deletes Svelte config (Svelte removed). |
| client/src/styles/global.css | Deletes global Tailwind import (moved into Layout global style). |
| client/src/pages/index.astro | Deletes old page that rendered Svelte component. |
| client/src/pages/dog/[id].astro | Deletes old page that rendered Svelte details component. |
| client/src/middleware.ts | Removes API proxy middleware (no longer needed with SSR fetch). |
| client/src/components/Header.astro | Deletes JS-driven header (replaced with static nav). |
| client/src/components/DogList.svelte | Removes Svelte dog list component. |
| client/src/components/DogDetails.svelte | Removes Svelte dog details component. |
| client/src/assets/background.svg | Removes unused starter asset. |
| client/src/assets/astro.svg | Removes unused starter asset. |
| client/playwright.config.ts | Removes old Playwright config from legacy client location. |
| client/e2e-tests/homepage.spec.ts | Removes old e2e tests under legacy client. |
| client/e2e-tests/dog-details.spec.ts | Removes old e2e tests under legacy client. |
| client/e2e-tests/api-integration.spec.ts | Removes old e2e tests under legacy client. |
| client/astro.config.mjs | Removes old Astro config that included Svelte integration. |
| app/server/utils/seed_test_database.py | Adds deterministic e2e DB seeder used by Playwright webServer. |
| app/server/utils/seed_database.py | Allows overriding DB path via DATABASE_PATH when seeding. |
| app/server/test_app.py | Updates unit tests to match paginated /api/dogs response shape. |
| app/server/requirements.txt | Adds server requirements under new app/server layout. |
| app/server/models/dogs.csv | Adds dog seed CSV under app/server/models. |
| app/server/models/dog.py | Introduces Dog model + AdoptionStatus enum. |
| app/server/models/breeds.csv | Adds breed seed CSV under app/server/models. |
| app/server/models/breed.py | Updates file header path comment after move under app/server. |
| app/server/models/base.py | Updates file header path comment after move under app/server. |
| app/server/models/init.py | Adds SQLAlchemy init + init_db() helper. |
| app/server/dogshelter.db | Adds a committed SQLite DB snapshot. |
| app/server/app.py | Adds pagination and DATABASE_PATH support; changes /api/dogs response format. |
| app/scripts/start-app.sh | Updates comment text to reflect Astro (no Svelte). |
| app/scripts/start-app.ps1 | Adds PowerShell start script for server + client. |
| app/scripts/seed-database.sh | Adds shell script to seed DB using shared helpers. |
| app/scripts/seed-database.ps1 | Adds PowerShell script to seed DB. |
| app/scripts/common.sh | Adds shared shell helpers for venv setup, deps install, and process cleanup. |
| app/scripts/common.ps1 | Adds shared PowerShell helpers for venv/deps/process management. |
| app/client/tsconfig.json | Adds strict Astro TS config. |
| app/client/start-test-server.js | Adds Playwright helper to seed test DB + run Flask with DATABASE_PATH. |
| app/client/src/pages/index.astro | Adds SSR home page that fetches /api/dogs and renders pagination + test IDs. |
| app/client/src/pages/dog/[id].astro | Adds SSR dog details page that fetches /api/dogs/:id + renders errors/test IDs. |
| app/client/src/pages/about.astro | Removes global.css import and adds data-testid to back link. |
| app/client/src/layouts/Layout.astro | Moves Tailwind import into global style and removes dark-mode class/transition bits. |
| app/client/src/components/Header.astro | Adds static header/nav with no client JS. |
| app/client/src/components/DogList.astro | Adds Astro dog list component with stable data-testid hooks. |
| app/client/src/components/DogDetails.astro | Adds Astro dog details component with stable data-testid hooks. |
| app/client/run-tests.sh | Adds helper script to start servers and run Playwright tests. |
| app/client/public/favicon.svg | Adds favicon under new app/client public dir. |
| app/client/playwright.config.ts | Adds Playwright config using two web servers (Flask + Astro) and seeded test DB. |
| app/client/package.json | Updates dependencies to remove Svelte and bump Astro/Tailwind; adds cross-env. |
| app/client/e2e-tests/homepage.spec.ts | Adds updated homepage e2e assertions using data-testid. |
| app/client/e2e-tests/dog-details.spec.ts | Adds updated dog details e2e tests using SSR + data-testid. |
| app/client/e2e-tests/api-integration.spec.ts | Adds updated integration tests aligned with SSR pages and seeded DB. |
| app/client/e2e-tests/about.spec.ts | Adds about page e2e coverage. |
| app/client/e2e-tests/README.md | Updates e2e documentation to describe new test architecture. |
| app/client/astro.config.mjs | Adds Astro config without Svelte integration and with Node adapter. |
| app/client/README.md | Adds Astro starter README under app/client. |
| app/client/Dockerfile | Adds Dockerfile for building/running Astro SSR output. |
| app/client/.dockerignore | Adds dockerignore for client image builds. |
| README.md | Updates top-level repo description to remove Svelte and clarify Tailwind usage. |
| .gitignore | Updates ignored Playwright output paths; adds ignore for e2e DB file. |
| .github/dependabot.yml | Updates dependabot npm directory to /app/client. |
Copilot's findings
- Files reviewed: 58/79 changed files
- Comments generated: 2
|
|
||
| // Seed the test database | ||
| execSync('python3 utils/seed_test_database.py', { | ||
| cwd: serverDir, | ||
| stdio: 'inherit', | ||
| }); | ||
|
|
||
| // Start Flask with the test database | ||
| const server = spawn('python3', ['app.py'], { |
There was a problem hiding this comment.
start-test-server.js is labeled “Cross-platform” but hard-codes python3 for both seeding and starting Flask. This will fail on Windows environments where python3 isn’t available (often only python/py exists). Detect the platform and choose the appropriate Python executable (or respect a PYTHON env var) so Playwright’s webServer works consistently across OSes.
| // Seed the test database | |
| execSync('python3 utils/seed_test_database.py', { | |
| cwd: serverDir, | |
| stdio: 'inherit', | |
| }); | |
| // Start Flask with the test database | |
| const server = spawn('python3', ['app.py'], { | |
| const pythonExecutable = process.env.PYTHON || (process.platform === 'win32' ? 'py' : 'python3'); | |
| // Seed the test database | |
| execSync(`${pythonExecutable} utils/seed_test_database.py`, { | |
| cwd: serverDir, | |
| stdio: 'inherit', | |
| }); | |
| // Start Flask with the test database | |
| const server = spawn(pythonExecutable, ['app.py'], { |
| # Pets workshop | ||
|
|
||
| This repository contains the project for three guided workshops to explore various GitHub features. The project is a website for a fictional dog shelter, with a [Flask](https://flask.palletsprojects.com/en/stable/) backend using [SQLAlchemy](https://www.sqlalchemy.org/) and [Astro](https://astro.build/) frontend using [Svelte](https://svelte.dev/) for dynamic pages. | ||
| This repository contains the project for three guided workshops to explore various GitHub features. The project is a website for a fictional dog shelter, with a [Flask](https://flask.palletsprojects.com/en/stable/) backend using [SQLAlchemy](https://www.sqlalchemy.org/) and an [Astro](https://astro.build/) frontend using [Tailwind CSS](https://tailwindcss.com/). |
There was a problem hiding this comment.
PR description mentions adding PLAN.md, but this change set doesn’t include a PLAN.md file (and there are no references to it in the repo). Either add the file or update the PR description so it matches the delivered changes.
Detect platform to choose python3 (Unix) or py (Windows), with PYTHON env var override for custom setups. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The goal of this PR is to simplify the app. This will both make keeping it updated easier, but also allow for better focus on the workshop rather than the app.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com