MyPortal

Getting started

Prerequisites, database configuration, and running the MyPortal API and SPA locally.

This walks through a local development instance: the database, the Web API, and the Angular SPA.

Prerequisites

  • .NET 8 SDK
  • Node.js 20+ and npm
  • SQL Server 2019 or newer — Developer, Express, or LocalDB
  • A SQL login with permission to create databases

1. Clone the repository

git clone https://github.com/MyPortalEdu/MyPortal.git
cd MyPortal

2. Configure the database connection

Both MyPortal.Migrations and MyPortal.WebApi read their connection string from Database:ConnectionString. Use user-secrets so it stays out of source control:

dotnet user-secrets init --project MyPortal.Migrations
dotnet user-secrets set "Database:ConnectionString" \
  "Server=.;Database=MyPortal;Trusted_Connection=True;TrustServerCertificate=True" \
  --project MyPortal.Migrations

dotnet user-secrets init --project MyPortal.WebApi
dotnet user-secrets set "Database:ConnectionString" \
  "Server=.;Database=MyPortal;Trusted_Connection=True;TrustServerCertificate=True" \
  --project MyPortal.WebApi

Alternatively, set Database__ConnectionString as an environment variable, or pass --Database:ConnectionString=... on the command line.

3. Create or update the database

The migrations runner creates the database if it does not exist, then applies any pending updates, views, functions, and stored procedures.

dotnet run --project MyPortal.Migrations

Re-run this whenever you pull changes that include new SQL.

4. Run the Web API

dotnet run --project MyPortal.WebApi

The API listens on the URLs configured in MyPortal.WebApi/Properties/launchSettings.json.

5. Run the SPA

cd MyPortal.Frontend/myportal-spa
npm install
npm start

The dev server runs on http://localhost:4200.

Serving the SPA over HTTPS

Use npm run start:https to serve over HTTPS with the proxy configuration in proxy.conf.json. This reuses the ASP.NET Core development certificate, which the machine already trusts, so the browser accepts https://localhost:4200 without a warning. The script exports the certificate to .certs/ first, which is gitignored.

If it reports that no trusted certificate is available, create one:

dotnet dev-certs https --trust

Everyday commands

TaskCommand
Build everythingdotnet build MyPortal.sln
Run backend testsdotnet test
Run SPA testsnpm test from MyPortal.Frontend/myportal-spa
Apply new SQLdotnet run --project MyPortal.Migrations