Local Development Setup
1. Clone the Repository
git clone <your-repo-url> HeadlessEcommerce
cd HeadlessEcommerce
2. Start PostgreSQL
The simplest way is via Docker:
docker run -d \
--name headless-ecommerce-db \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres123 \
-e POSTGRES_DB=HeadlessEcommerce \
-p 5432:5432 \
postgres:17
3. Start RabbitMQ
docker run -d \
--name headless-ecommerce-rabbitmq \
-e RABBITMQ_DEFAULT_USER=guest \
-e RABBITMQ_DEFAULT_PASS=guest \
-p 5672:5672 \
-p 15672:15672 \
rabbitmq:3-management
RabbitMQ management UI will be available at http://localhost:15672.
4. Configure the API
Edit HeadlessEcommerce.Api/appsettings.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=HeadlessEcommerce;Username=postgres;Password=postgres123"
},
"Licensing": {
"LicenseFilePath": "/absolute/path/to/your/license.lic"
}
}
The Licensing.PublicKeyBase64 is typically configured in the main appsettings.json or via environment variable Licensing__PublicKeyBase64.
5. Run Database Migrations
cd HeadlessEcommerce.Api
dotnet ef database update --project ../HeadlessEcommerce.Infrastructure
Or if EF tools are not installed globally:
dotnet tool install --global dotnet-ef
6. Seed Sample Data (Optional)
The DataSeeder creates a fashion store with products, categories, variants, pricing, and inventory:
cd HeadlessEcommerce.DataSeeder
dotnet run -- --yes
See Data Seeder details for configuration options.
7. Run the API
cd HeadlessEcommerce.Api
dotnet run
The API will start at http://localhost:8080. Swagger UI is at http://localhost:8080/swagger.
8. Run the Backoffice (Optional)
cd "HeadlessEcommerce Backoffice"
npm install
npm start
Backoffice runs at http://localhost:4200 by default.
9. Run the Storefront (Optional)
cd "HeadlessEcommerce Storefront"
npm install
npm start
Storefront runs at http://localhost:4200 (or next available port).
Request Headers
The API uses headers for multi-store/language/currency context:
| Header | Example | Purpose |
|---|---|---|
X-Store-Code | us-store | Selects the active store |
X-Language-Code | en | Selects the content language |
X-Currency-Code | USD | Selects the pricing currency |
Authorization | Bearer <token> | JWT authentication |
Querying the Database
Since psql may not be installed on your host, use Docker:
docker exec headless-ecommerce-db psql -U postgres -d HeadlessEcommerce -c 'SELECT COUNT(*) FROM "Products"'
PostgreSQL uses PascalCase quoted identifiers. Always quote table and column names: "Products", "SlugRegistry", etc.