Skip to content

About

Reusable headless e-commerce foundation (.NET 10 API + Next.js admin), GST-ready

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Ecom foundation

CI

A headless e-commerce starter for Indian stores: a .NET API, an admin for running the store, and a storefront for customers. Fork it, brand it, and go live.

Part Stack Folder
API .NET 10 Minimal API, EF Core, Postgres 17, Azure Blob Storage backend/
Admin Next.js 16, React 19, Tailwind 4 admin/
Storefront Next.js 16, React 19 storefront/

What it does: catalog (product types, categories, variants, collections, images), carts, guest and account checkout, discounts, payments by cash on delivery, bank transfer, UPI or card, order management with status history, GST invoices as PDF, transactional emails, customer accounts, and staff roles (Owner, Manager, Staff).

Run it locally

You need Docker, the .NET 10 SDK, Node 24 (what CI uses), and pnpm 10.

docker compose up -d --build              # Postgres, Azurite, Mailpit and the API on :8080

cp admin/.env.local.example admin/.env.local
pnpm --dir admin install
pnpm --dir admin dev                      # admin on :3001

cp storefront/.env.local.example storefront/.env.local
pnpm --dir storefront install
pnpm --dir storefront dev                 # storefront on :3000

On start the API applies migrations and seeds a demo store (the supplements preset) with these logins:

Email Role
owner@demo.local Owner: everything
manager@demo.local Manager: everything except staff
staff@demo.local Staff: view the catalog and customers, manage orders
customer@demo.local Storefront customer

The password is DemoPassword in Seeder.cs.

What Where
Storefront http://localhost:3000
Admin http://localhost:3001
API http://localhost:8080 (API reference at /scalar, OpenAPI at /openapi/v1.json)
Emails sent by the API Mailpit, http://localhost:8025

Every API route except /health needs the X-Api-Key header (dev-key in compose). The two Next.js apps read API_URL and API_KEY on the server only; the key never reaches the browser.

Tests

Command What it runs
dotnet test backend API tests against Postgres and Azurite in Testcontainers (needs Docker)
pnpm --dir storefront test:unit Variant resolver, money formatting, API error mapping
pnpm --dir admin test:e2e Admin Playwright tests on their own stack (API :18080, admin :3101)
pnpm --dir storefront test:e2e Storefront Playwright tests on their own stack (API :28080, storefront :3100)
pnpm --dir <app> lint ESLint
pnpm --dir <app> check:brand Contrast of the brand colour tokens

The e2e suites start and remove their own Docker stacks, so they never touch your dev database. E2E_KEEP=1 leaves the stack running after the tests finish.

CI runs on every pull request and every push to main. It runs the API tests, builds the API's Docker image, and lints, checks, tests and builds both apps. The Playwright suites run locally only.

Common tasks

Change the API contract. After changing an endpoint, start the API and regenerate the typed clients:

pnpm --dir admin gen:api
pnpm --dir storefront gen:api

Add a migration.

dotnet tool restore
dotnet ef migrations add <Name> --project backend/Ecom.Api --output-dir Data/Migrations

Configure the store. Name, currency, GSTIN, payment methods, UPI ID and shipping come from Store__* settings on the API; see docker-compose.yml. Email links point at the storefront through Store__StorefrontUrl, Email__CustomerConfirmUrl and Email__CustomerResetUrl.

Docs

About

Reusable headless e-commerce foundation (.NET 10 API + Next.js admin), GST-ready

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages