Ecommerce Website Example
Use the ecommerce sample in examples/ecommerce to explore a full storefront, admin, and API setup.
Run the sample
-
Navigate to the example:
cd examples/ecommerce -
Install dependencies:
make install -
Create the database and configure
config/config.yamlas needed.make db-create -
Generate code and run migrations:
make generate
make migrate -
Create a superuser for the admin:
make superuser -
Start the server:
make run
The app is now available at http://localhost:8000/.【F:examples/ecommerce/SETUP.md†L9-L95】
Admin access
- Admin URL: http://localhost:8000/admin/【F:examples/ecommerce/SETUP.md†L86-L95】
- Credentials: There are no default credentials. Create a superuser with
make superuser(orforge createsuperuser) and log in with the account you created.【F:examples/ecommerce/SETUP.md†L66-L95】
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】
Related documentation
- Admin guide
- Migrations guide
- ORM system overview sidebar_position: 3
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.
-
Install dependencies
cd examples/ecommerce
make install
# or: go mod download -
Create the database
make db-create
# or: createdb ecommerce_db -
Generate code + run migrations
make generate
make migrate
# or: forge generate && forge migrate -
Create a superuser (admin login)
make superuser
# or: forge createsuperuser -
Start the server
make run
# or: forge runserver
Tip: If you want the quick all-in-one flow,
make setupcovers install, generate, migrate, and superuser creation. Usemake runafterward.
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 createsuperuserormake 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.goandmake seed).
UI walkthrough (text)
If you do not have screenshots available locally, use the following walkthrough to confirm the main pages:
- Homepage (
/)- The storefront landing page. Start the server and verify the page loads without error.
- Admin UI (
/admin/)- Log in with the superuser account you created.
- Explore catalog, customers, orders, inventory, and marketing sections.
- REST API (
/api/v1/)- Confirm the browsable API (or JSON response) for endpoints like
/api/v1/products/and/api/v1/orders/.
- Confirm the browsable API (or JSON response) for endpoints like