Port Project API is a RESTful web API for port operations management. It models core port back-office responsibilities such as staff and qualifications management, operational resources, docks and storage areas, vessel and vessel type management, shipping agents and representatives, and vessel visit notifications (including cargo, crew and decision logs).
This repository implements domain-driven design (aggregates and value objects) and uses Entity Framework Core with SQLite for persistence. The API aims to provide a pragmatic, well-structured backend for integration tests, demos and further development.
Key domain aggregates:
- StaffMember
- Qualification
- Resource
- Dock
- StorageArea
- VesselType
- Vessel
- ShippingAgentOrganization
- ShippingAgentRepresentative
- VesselVisitNotification
Main API controllers (examples):
StaffMembersControllerQualificationsControllerResourceControllerStorageAreaControllerDockControllerVesselTypeControllerVesselControllerShippingAgentOrganizationsControllerShippingAgentRepresentativesControllerVesselVisitNotificationController
- .NET 9 (ASP.NET Core Web API)
- Entity Framework Core (EF Core)
- SQLite (file-based database)
- Swagger / Postman / OpenAPI (development only)
- .NET SDK 9 or later
- (Optional)
dotnet-eftool for migrations
From the repository root:
# Restore and build (Windows PowerShell / cmd)
dotnet restore
dotnet buildRun the API from the solution or the PortProject.Api project folder:
# Run using dotnet run
dotnet run --project PortProject.ApiBy default the app uses SQLite and a file named portproject.db in the working directory (configured in PortProjectContext).
When running in the Development environment the project exposes Swagger UI at https://localhost:{PORT}/swagger.
Install the EF Core CLI if you plan to manage migrations:
dotnet tool install --global dotnet-efCreate a migration and update the database (example):
# From repository root
dotnet ef migrations add InitialCreate --project PortProject.Api --startup-project PortProject.Api
dotnet ef database update --project PortProject.Api --startup-project PortProject.ApiThe project is configured to use a SQLite file by default. If you change the connection string, update appsettings.json or your environment variables accordingly.
Base URL: /api
Common endpoints include (not exhaustive):
GET /api/StaffMembers— list staffPOST /api/StaffMembers— create staff memberGET /api/VesselTypes— list vessel typesPOST /api/VesselVisitNotification— submit a vessel visit notificationGET /api/StorageArea— manage storage areasGET /api/Dock— manage docksGET /api/Resource— manage resources
Refer to the Swagger UI for a complete list of endpoints, request/response schemas and example payloads.
Top-level folders of interest:
PortProject.Api/Controllers— HTTP controllersPortProject.Api/Domain— domain model (aggregates, value objects, interfaces)PortProject.Api/Application— application services and DTOsPortProject.Api/Infrastructure— EF Core repositories and persistencePortProject.Api/Models—AplicationContext(EF Core DbContext)*.Tests,*.System_Testsand*.IntegrationTests— test projects
There are several test projects in the repository (unit, system tests, and integration tests). Run tests with:
dotnet test- Swagger not available: ensure
ASPNETCORE_ENVIRONMENTis set toDevelopment. - Database errors after model changes: regenerate migrations and apply them, or delete
portproject.dband run migrations to recreate the schema. - Connection string: check
appsettings.jsonforDefaultConnectionor rely on the default SQLite config inPortProjectContext.
- Coding follows DDD principles: aggregates, value objects and explicit repositories.
- Prefer adding migrations when modifying the domain model.
- Keep enum serialization stable (the project configures Newtonsoft.Json to serialize enums as strings).
Student team: Pedro Santos, Amir Masnavi, Leonor Marinho, Inês Oliveira, Mariana Sarmento.
This project is provided for academic purposes. Please consult the repository owner for any licensing or reuse policies.