-
Install required tools and dependencies:
-
Restore .NET tools:
dotnet tool restore -
Create the buttercup_dev user that will be used to connect to the application and test databases:
mysql -u root -p < scripts/create-dev-user.sql -
Create the application database:
dotnet ef database update -s src/Buttercup.Web -
Create a Bugsnag project for the application and use the ASP.NET Core Secret Manager to add the project's API key as a user secret:
dotnet user-secrets set "Bugsnag:ApiKey" "<replace-with-api-key>" -p src/Buttercup.Web
-
Change to the web project directory:
cd src/Buttercup.Web -
Install node dependencies:
npm install -
Build all development and production assets once:
npx gulpOr build only development assets and watch for changes:
npx gulp watch -
Run the app:
dotnet run -
Navigate to https://localhost:5000 and sign in using email 'dev@example.com' and password 'dev-pass'
-
To run all .NET tests:
dotnet test
-
Change to the web project directory:
cd src/Buttercup.Web -
Install node dependencies:
npm install -
Run all tests once:
npx jestOr run tests for changed files in watch mode:
npx jest --watch
-
Change to the web project directory:
cd src/Buttercup.Web -
Install node dependencies:
npm install -
Build frontend assets:
npx gulp -
Run all tests once:
npx playwright testOr run the tests in UI mode:
npx playwright test --ui
-
To generate and open the .NET coverage report:
dotnet test --collect "XPlat Code Coverage" ./scripts/build-dotnet-coverage-report.sh open coverage/index.html -
To generate and open the TypeScript coverage report:
cd src/Buttercup.Web npx jest --coverage open coverage/lcov-report/index.html
-
To lint scripts:
cd src/Buttercup.Web npx eslint . -
To lint styles:
cd src/Buttercup.Web npx stylelint styles/
-
To create a new database migration:
dotnet ef migrations add <MIGRATION_NAME> -s src/Buttercup.Web -p src/Buttercup.EntityModel.Migrations -
To run all pending database migrations:
dotnet ef database update -s src/Buttercup.Web
In development, emails are sent to Mailpit by default.
To send emails using Azure Communication Services:
-
Create an Azure Communication Service for Buttercup and set it up with an email domain.
-
Create an Entra ID app registration for Buttercup development. Keep a copy of the Application (client) ID and Directory (tenant) ID for use later on.
-
Create a client secret for the Buttercup development app. Keep a copy of the client secret value for use later on.
-
Create an Entra ID security group for Buttercup development and add the service principal for the Buttercup development app as member.
-
Assign the Communication and Email Service Owner role for the Buttercup communication service to the Buttercup development group.
-
Use the ASP.NET Core Secret Manager to set the service principal's tenant ID, client ID and client secret as user secrets:
dotnet user-secrets set "Azure:ClientCredentials:TenantId" "<replace-with-tenant-id>" -p src/Buttercup.Web dotnet user-secrets set "Azure:ClientCredentials:ClientId" "<replace-with-client-id>" -p src/Buttercup.Web dotnet user-secrets set "Azure:ClientCredentials:ClientSecret" "<replace-with-client-secret>" -p src/Buttercup.Web -
Set the Email > Provider config value to 'Azure'.
Using an environment variable:
export EMAIL__PROVIDER=Azure dotnet runOr using a command line argument:
dotnet run Email:Provider=Azure