+
Skip to content

jdow-sg/ecommerce-app

 
 

Repository files navigation

Amp Demo

This is a demo repo that is carefully crafted to showcase the capabilities of Amp centered around an example e-commerce platform with a FastAPI backend and React frontend. Data is stored in SQLite so it is self contained and easy to run.

For more information about Amp visit the Amp manual.

See the DEMO.md for more information about how to effectively use this repo for an array of different demo purposes ranging from fixes an issue with a PR to advanced refactors.

image

Project Structure

.
├── .github/            # GitHub workflows and CI configuration
├── backend/            # FastAPI backend
│   ├── app/            # Application source code
│   ├── tests/          # Backend tests
│   ├── alembic/        # Database migrations
│   ├── pyproject.toml  # Python dependencies (managed by uv)
│   ├── pytest.ini      # Test configuration
│   ├── main.py         # FastAPI entry point
│   ├── AGENTS.md       # Agent documentation for backend
│   └── store.db        # SQLite database file
├── frontend/           # React frontend (TypeScript/Vite)
│   ├── src/            # React components and pages
│   ├── e2e/            # Playwright E2E tests
│   ├── public/         # Static assets
│   ├── package.json    # Node.js dependencies
│   ├── vite.config.ts  # Vite configuration
│   ├── AGENTS.md       # Agent documentation for frontend
│   └── playwright.config.ts # Playwright test configuration
├── justfile            # Development automation commands
├── package.json        # Root package.json for shared dependencies
├── AGENTS.md           # Agent documentation for overall project
├── DEMO.md             # Demo usage guide
└── README.md           # README

Prerequisites

Mandatory

  • Just - Command runner (brew install just)
  • Python 3.13+ - Python runtime
  • uv - Python package manager
  • Node.js 20+ - JavaScript runtime
  • npm - Package manager (ships with Node.js)

Quick Start

Clone the project and verify prerequisites:

git clone https://github.com/sourcegraph/amp-demo.git
cd amp-demo

# Verify you have required tools
just --version
python --version
uv --version
node --version 

Install dependencies and setup testing:

just install-all      # Install all dependencies (backend, frontend, E2E browsers)

Run the application:

just dev             # Start both services with native hot-reload using concurrently

Access the application:

Development Commands

Lifecycle Commands

just dev              # Start both services (native hot-reload)
just dev-backend      # Start only backend
just dev-frontend     # Start only frontend

Seed Database

just seed             # Populate database with sample data (only needed if database changes)

Manual Development (individual services)

Install dependencies (if not already done):

just install-all      # All dependencies (backend, frontend, E2E browsers)

Run services individually (if needed):

just dev-backend      # Start only backend
just dev-frontend     # Start only frontend

Testing & Quality

Setup E2E Testing (Required First Time)

just setup-e2e        # Install Playwright browsers

Running Tests

# Backend tests (native)
just test-local                        # Backend tests
just test-cov-local                    # Backend tests with coverage
just test-local-single TEST            # Run single test

# E2E tests
just test-e2e         # E2E tests (headless)
just test-e2e-headed  # E2E tests (headed - for debugging)

# Combined test suites
just test-all-local   # All tests (backend + E2E)

Code Quality

# backend
just check            # Run linting (ruff) and type checking (mypy)
just format           # Format backend code

# frontend
just lint             # Lint frontend TypeScript

Pre-Push Validation (Recommended)

Before pushing to CI, ensure all checks pass locally to avoid CI failures:

# One-time setup (if not done already)
just install-all      # Install all dependencies

# Run complete CI pipeline locally
just ci               # Runs: lint, tests, build, e2e (mirrors CI exactly)

just ci runs the exact same checks as the GitHub Actions CI pipeline:

  1. Backend Quality: Ruff linting + MyPy type checking
  2. Backend Tests: Full test suite with coverage
  3. Frontend Quality: ESLint + TypeScript build
  4. E2E Tests: End-to-end Playwright tests

Build & Deployment

just build            # Build frontend for production
cd frontend && npm run build  # Alternative frontend build

Database Management

just reset-db         # Reset SQLite database
just db-shell         # Open SQLite CLI
just migrate-create "message"  # Create new migration
just migrate-up       # Apply migrations
just migrate-down     # Rollback migration

Monitoring & Debugging

just health           # Check service health
just logs             # View last 100 lines from backend and frontend logs
just logs-follow      # Follow both logs live (Ctrl+C to exit)

Source

Based on the ecommerce-demo repo.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 62.8%
  • Python 34.1%
  • Just 2.1%
  • Other 1.0%
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载