Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

DevHouse API

A REST API for managing a software development house: developers, the projects they work on, project types, and developer roles. Built with ASP.NET Core and secured with JWT authentication.

What this project does

DevHouse models the core entities a development agency needs to track. The API exposes full CRUD operations across four resources:

Resource Endpoints
Developers GET, POST, PUT, DELETE on /api/Developers
Projects GET, POST, PUT, DELETE on /api/Projects
ProjectTypes GET, POST, PUT, DELETE on /api/ProjectTypes
Roles GET, POST, PUT, DELETE on /api/Roles

Every endpoint is protected. Clients authenticate against /api/Auth/login to receive a JWT, then pass it as a Bearer token on subsequent requests.

The API is documented with Swagger, so the full endpoint surface is browsable and testable in the browser without any external tooling.

Why I built it this way

Layered architecture

The project separates Controllers, Models, and the data context rather than putting logic in one place:

  • Controllers handle HTTP concerns only — routing, status codes, request and response shapes
  • Models define the domain entities and their relationships
  • The DbContext in Data/ owns database access

This keeps each layer testable on its own and means a change to the database schema doesn't ripple into request handling.

Entity Framework Core with migrations

Rather than writing SQL schema scripts by hand, the schema is defined in C# model classes and generated through EF Core migrations. The migration history lives in Migrations/, so the database can be rebuilt from scratch on any machine with a single command, and schema changes are versioned alongside the code.

Pomelo is used as the MySQL provider since EF Core has no first-party MySQL support.

JWT authentication

Tokens are stateless, so the API doesn't hold session state and can be scaled horizontally without a shared session store. The token is signed and verified on each request, which suits an API consumed by clients that aren't browsers.

Swagger / OpenAPI

Swashbuckle generates the OpenAPI spec directly from the controllers and their attributes, so the documentation can't drift out of sync with the code. It also gives the API a working test client out of the box, including a flow for authorizing with a bearer token.

Tech stack

  • .NET 9 / ASP.NET Core
  • MySQL 8.0
  • Entity Framework Core (Pomelo provider)
  • JWT Bearer authentication
  • Swagger / OpenAPI 3.0

Application setup instructions

  1. Ensure you have .NET 9 SDK and MySQL Server 8.0 installed.

  2. Clone the repository:

git clone https://github.com/Marcosen99/devhouse-api.git
cd devhouse-api/DevHouse
  1. Copy appsettingsExample.json to appsettings.json and fill in your MySQL credentials:
"ConnectionStrings": {
  "DefaultConnection": "server=localhost;port=3306;database=devhouse;user=root;password=YOUR_PASSWORD;"
}

appsettings.json is gitignored so credentials never reach the repository.

  1. Restore dependencies:
dotnet restore

Instructions to create needed migrations

Run the following commands to create and apply the database migrations:

dotnet ef migrations add InitialCreate
dotnet ef database update

This will automatically create the devhouse database and all required tables.

Instructions to run the application

dotnet run

The API will be available at: http://localhost:5010

Swagger UI will be available at: http://localhost:5010/swagger

To test authenticated endpoints in Swagger:

  1. Call POST /api/Auth/login with the following body:
{
  "username": "admin",
  "password": "password"
}
  1. Copy the token from the response
  2. Click Authorize at the top of the Swagger UI
  3. Enter Bearer {your token} and click Authorize

Connection string structure for MySQL database connection

server=localhost;port=3306;database=devhouse;user=root;password=YOUR_PASSWORD;

Update appsettings.json with your own MySQL username and password before running migrations.

Additional external libraries/packages used

Package Version Purpose
Pomelo.EntityFrameworkCore.MySql 9.0.0 MySQL database provider for Entity Framework Core
Microsoft.EntityFrameworkCore.Design 9.0.0 Required for running EF Core migration commands
Microsoft.AspNetCore.Authentication.JwtBearer 9.0.0 JWT Bearer token authentication
Swashbuckle.AspNetCore 6.9.0 Swagger UI and API documentation

Notes

The login credentials are seeded demo values for evaluating the API. A production deployment would require hashed credentials stored in the database and a signing key supplied through environment variables or a secrets store.

About

REST API for managing developers, projects and roles. ASP.NET Core 9, EF Core, MySQL, JWT auth.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages