Skip to main content

Ecommerce Website Example

Use the ecommerce sample in examples/ecommerce to explore a full storefront, admin, and API setup.

Run the sample

  1. Navigate to the example:

    cd examples/ecommerce
  2. Install dependencies:

    make install
  3. Create the database and configure config/config.yaml as needed.

    make db-create
  4. Generate code and run migrations:

    make generate
    make migrate
  5. Create a superuser for the admin:

    make superuser
  6. Start the server:

    make run

The app is now available at http://localhost:8000/.【F:examples/ecommerce/SETUP.md†L9-L95】

Admin access

Main user flows to try

  • Create categories and products (including variants) in the admin.
  • Add a customer and place a test order.
  • Add a review to exercise the marketing flow.

These flows are called out in the setup guide’s “Try” section after logging into the admin.【F:examples/ecommerce/SETUP.md†L111-L131】


E-commerce Website Sample

This page walks through running the ecommerce sample locally, the main entry points, and a quick UI walkthrough.

Run the sample locally

Use the ecommerce example under examples/ecommerce.

  1. Install dependencies

    cd examples/ecommerce
    make install
    # or: go mod download
  2. Create the database

    make db-create
    # or: createdb ecommerce_db
  3. Generate code + run migrations

    make generate
    make migrate
    # or: forge generate && forge migrate
  4. Create a superuser (admin login)

    make superuser
    # or: forge createsuperuser
  5. Start the server

    make run
    # or: forge runserver

Tip: If you want the quick all-in-one flow, make setup covers install, generate, migrate, and superuser creation. Use make run afterward.

Entry points

Once the server is running, use these URLs:

  • Homepage: http://localhost:8000/
  • Admin UI: http://localhost:8000/admin/
  • REST API: http://localhost:8000/api/v1/

Default credentials and seed data

  • There are no default credentials checked into the repo. You create the admin user with forge createsuperuser or make superuser.
  • There is no preloaded seed data by default. You can:
    • Add records manually in the admin UI.
    • Create your own seed script (the setup guide suggests scripts/seed.go and make seed).

UI walkthrough (text)

If you do not have screenshots available locally, use the following walkthrough to confirm the main pages:

  1. Homepage (/)
    • The storefront landing page. Start the server and verify the page loads without error.
  2. Admin UI (/admin/)
    • Log in with the superuser account you created.
    • Explore catalog, customers, orders, inventory, and marketing sections.
  3. REST API (/api/v1/)
    • Confirm the browsable API (or JSON response) for endpoints like /api/v1/products/ and /api/v1/orders/.