How to run BeanShare locally for development and testing.
| Software | Version | Purpose |
|---|---|---|
| .NET 10.0 SDK | 10.0+ | Application runtime |
| Docker Desktop | Latest | PostgreSQL & Keycloak containers |
For MAUI Android testing (optional):
- Android SDK (API Level 21+)
- JDK 17+ (OpenJDK recommended)
- Android Emulator or physical device
cd BeanShare
docker compose up -dThis starts three containers:
| Container | Port | Purpose |
|---|---|---|
beanshare-postgres-dev |
5432 | PostgreSQL database |
beanshare-keycloak-dev |
8080 | Keycloak authentication |
beanshare-postgres-test |
5433 | PostgreSQL for integration tests |
Keycloak auto-imports the beanshare realm on startup with:
- 3 OAuth clients (
beanshare-api,beanshare-web,beanshare-mobile) - 8 demo users (all with password
password123)
Verify all services are healthy:
docker compose pscd src/Presentation/BeanShare.Api
dotnet runThe API starts on http://localhost:5247. On first run it automatically creates the database schema and seeds demo data (users, spaces, coffee stock, consumption entries, billing periods, and global presets).
Swagger UI: http://localhost:5247/swagger
cd src/Presentation/BeanShare.BlazorWeb
dotnet runThe web app starts on http://localhost:5126. Click Login to authenticate via Keycloak.
All demo users use password password123:
| User | Role | |
|---|---|---|
| John Smith | john.smith@beanshare.dev | Admin (Engineering Team, Executive Lounge) |
| Sarah Johnson | sarah.johnson@beanshare.com | Member (Engineering Team, Marketing Office) |
| Mike Wilson | mike.wilson@beanshare.com | Member (Engineering Team, Remote Workers Hub) |
| Emma Davis | emma.davis@beanshare.com | Member (Engineering Team, Startup Garage) |
| Test User | test@beanshare.com | Member (Engineering Team, Remote Workers Hub) |
Keycloak Admin Console: http://localhost:8080 (admin / admin)
The application uses environment-aware seeding. In development, all seeders run automatically on first startup:
| Seeder | Description |
|---|---|
GlobalPresetSeeder |
12 coffee recipe presets (Espresso, Cappuccino, Pour Over, etc.) |
UserSeeder |
8 demo users |
SpaceSeeder |
5 spaces (Engineering Team, Marketing Office, Remote Workers Hub, Startup Garage, Executive Lounge) |
CoffeeStockSeeder |
Coffee stock purchases across all spaces |
ConsumptionSeeder |
Consumption entries with realistic date distribution |
BillingPeriodSeeder |
Billing periods in various states (open, closed, settled) |
In production, only the GlobalPresetSeeder runs (marked as IsEssential). See PRODUCTION-DEPLOYMENT.md for details.
cd src/Presentation/BeanShare.Maui
JAVA_HOME=/path/to/jdk ANDROID_HOME=/path/to/sdk \
dotnet build -f net10.0-android -c Debug -p:EmbedAssembliesIntoApk=trueInstall the APK on the emulator:
adb install -r bin/Debug/net10.0-android/com.companyname.beanshare.maui-Signed.apk- The Android emulator reaches the host machine's
localhostvia10.0.2.2. The MAUI app handles this mapping automatically inMauiProgram.cs(API URL) andAuthenticationService.cs(Keycloak URL). EmbedAssembliesIntoApk=trueis required — Fast Deployment breaks the Blazor WebView communication.- After reinstalling the APK, clear app data to remove stale tokens:
adb shell pm clear com.companyname.beanshare.maui
cd src/Presentation/BeanShare.Maui
dotnet build -f net10.0-windows10.0.19041.0 -c Release# All tests
dotnet test
# Unit tests only
dotnet test tests/BeanShare.Tests.Unit
# Integration tests (requires beanshare-postgres-test on port 5433)
dotnet test tests/BeanShare.Tests.IntegrationThe healthcheck uses a bash TCP probe. If Keycloak is accessible at http://localhost:8080 but Docker shows unhealthy, restart it:
docker compose restart beanshare-keycloak- Verify Keycloak is running and the realm exists
- Check that
Keycloak:AuthorityURL is correct and reachable from the API - Ensure the Keycloak signing keys haven't changed (restart API after Keycloak recreate)
- Verify
Keycloak:ClientSecretmatches the secret in Keycloak Admin Console - Check that redirect URIs in Keycloak client include
http://localhost:5126/* - Ensure the Keycloak realm name matches the Authority URL path
The Android emulator uses 10.0.2.2 to reach the host machine's localhost. The MAUI app handles this automatically, but ensure the API is listening on localhost:5247.
Without an OpenExchangeRates:AppId, the API uses built-in constant exchange rates (approximate early-2026 values). For live rates, get a free key from https://openexchangerates.org/signup/free.