Skip to content

CommunityPro/community-pro-api

Repository files navigation

Community Pro API

Modular monolith backend for Community Pro. .NET 9, minimal APIs, one Postgres database with a schema per module, Meilisearch for search.

Prerequisites

  • .NET SDK 9+ (SDK 10 works — projects target net9.0)
  • Docker Desktop (Postgres 16 + Meilisearch)
  • dotnet-ef (pinned in .config/dotnet-tools.json): dotnet tool restore

Local development

Start infrastructure:

docker compose up -d

Postgres listens on localhost:5432 (communitypro / communitypro, database communitypro). Meilisearch listens on localhost:7700 with master key communitypro-local-master-key.

Run the API with hot reload:

dotnet watch --project src/CommunityPro.Api
  • Health check: GET http://localhost:5080/health
  • API reference (dev only): http://localhost:5080/scalar/v1
  • OpenAPI document (dev only): http://localhost:5080/openapi/v1.json

In Development the host applies pending EF Core migrations on startup, so Postgres must be up before the API.

Migrations

One migration set per module, each DbContext mapped to its own Postgres schema. From the repo root:

dotnet ef migrations add <Name> \
  --project src/Modules/CommunityPro.Members \
  --startup-project src/CommunityPro.Api \
  --context MembersDbContext

Apply manually (optional — dev startup does this automatically):

dotnet ef database update \
  --project src/Modules/CommunityPro.Members \
  --startup-project src/CommunityPro.Api \
  --context MembersDbContext

Repeat the pattern per module as their contexts land (IdentityDbContext, ContentDbContext, ...). Design-time factories fall back to the docker-compose connection string; override with the COMMUNITYPRO_CONNECTION environment variable.

Build & test

dotnet build
dotnet test

Layout

src/
  CommunityPro.Api/            Host: DI wiring, endpoint discovery, middleware
  CommunityPro.SharedKernel/   Result<T>, Error, PagedResult<T>, domain events, IEndpointModule
  Modules/
    CommunityPro.Identity/     Phase 1
    CommunityPro.Members/      Phase 2 (owns the "members" schema; migrations pipeline proven here)
    CommunityPro.Content/      Phase 4
    CommunityPro.Contributors/ Phase 5
    CommunityPro.Mentorship/   Phase 6
    CommunityPro.Sponsorship/  Phase 7
    CommunityPro.Admin/        Phase 8
tests/
  CommunityPro.Tests/          xUnit, per-module test folders

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages