{"id":31936635,"url":"https://github.com/nikollbibajnoah/restful-api","last_synced_at":"2026-04-12T17:03:03.162Z","repository":{"id":310692016,"uuid":"1039622966","full_name":"NikollbibajNoah/RESTful-API","owner":"NikollbibajNoah","description":"RESTful-API with .NET framework in C#","archived":false,"fork":false,"pushed_at":"2025-09-30T08:05:21.000Z","size":11615,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-23T05:16:04.376Z","etag":null,"topics":["backend","ci-cd","csharp","docker","jwt-authentication","mysql","postgres","rest-api"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NikollbibajNoah.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-17T16:27:37.000Z","updated_at":"2025-09-30T08:05:24.000Z","dependencies_parsed_at":"2025-10-14T07:58:12.762Z","dependency_job_id":null,"html_url":"https://github.com/NikollbibajNoah/RESTful-API","commit_stats":null,"previous_names":["nikollbibajnoah/restful-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NikollbibajNoah/RESTful-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NikollbibajNoah%2FRESTful-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NikollbibajNoah%2FRESTful-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NikollbibajNoah%2FRESTful-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NikollbibajNoah%2FRESTful-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NikollbibajNoah","download_url":"https://codeload.github.com/NikollbibajNoah/RESTful-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NikollbibajNoah%2FRESTful-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31722563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T13:21:33.774Z","status":"ssl_error","status_checked_at":"2026-04-12T13:21:29.265Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","ci-cd","csharp","docker","jwt-authentication","mysql","postgres","rest-api"],"created_at":"2025-10-14T07:47:32.228Z","updated_at":"2026-04-12T17:03:03.125Z","avatar_url":"https://github.com/NikollbibajNoah.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# RESTful-API\n\nThis project is a **RESTful API** built with **.NET 9** using **JWT authentication**.  \nIt is a learning project to practice authentication, authorization, and building a\nclean backend structure with Docker, including advanced features like\ncomprehensive exception handling, and caching.\n\n---\n\n## Table of Contents\n- [Features](#features)\n- [Technologies](#technologies)\n- [Architecture](#architecture)\n- [Structure](#structure)\n- [Authentication](#authentification)\n- [Exception Handling](#exception-handling)\n- [Setup \u0026 Run](#setup--run)\n\n---\n\n## Features\n- **CRUD operations** for user entities\n- **User registration \u0026 login** with JWT authentication\n- **Protected endpoints** with `[Authorize]` attribute\n- **Two separate databases**:\n    - **MySQL** → Business data (users, entities)\n    - **PostgreSQL** → Authentication data (user credentials)\n- **Advanced exception handling** with structured error responses\n- **Memory caching** for improved performance\n- **CORS configuration** for different environments\n- **Swagger UI** with JWT support\n- **Docker setup** for MySQL \u0026 PostgreSQL\n\n---\n\n## Technologies\nFollowing technologies were used:\n\n- .NET SDK 9\n- Docker\n- Rider IDE\n- MySQL\n- Postgres\n\n## Architecture\n\nThe application follows a layered architecture:\n\n- **Controllers** → Handle HTTP requests (AuthController, UserController)\n- **Services** → Business logic (authentication, user handling, CRUD operations)\n- **Entities \u0026 DTOs** → Data models for persistence and API communication\n- **DbContexts** → EF Core contexts (MySQL for business data, PostgreSQL for auth data)\n- **Middleware** → Global error handling, logging\n- **Authentication** → JWT-based authentication and claims\n- **Exception Handling** → Structured error responses\n- **Caching** → Memory caching for performance optimization\n\n## Structure\n```\n/Controllers -\u003e API endpoints (AuthController, UserController, etc.)\n/Auth -\u003e JWT services, auth logic\n/Context -\u003e EF Core DbContexts (MySQL + PostgreSQL)\n/Entity -\u003e Entities \u0026 DTOs\n/Middleware -\u003e Global exception handling\n/Services -\u003e Business logic services\n```\n\n## Authentification\n\n**Register**\n```http\nPOST /auth/register\nContent-Type: application/json\n\n{\n  \"username\": \"Noah\",\n  \"email\": \"user@example.com\",\n  \"password\": \"Password123!\"\n}\n```\n\n**Login**\n```http\nPOST /auth/login\nContent-Type: application/json\n\n{\n  \"username\": \"Noah\",\n  \"password\": \"Password123!\"\n}\n```\n\n**Response:**\n```json\n{\n  \"token\": \"\u003cJWT_TOKEN\u003e\",\n  \"expiresAtUtc\": \"2025-09-20T10:00:00Z\"\n}\n```\n\n**Protected endpoint**\n```http\nGET /auth/me\nAuthorization: Bearer \u003cJWT_TOKEN\u003e\n```\n\n**Response:**\n```json\n{\n  \"user\": \"Noah\",\n  \"claims\": [\n    { \"type\": \"nameidentifier\", \"value\": \"2\" },\n    { \"type\": \"name\", \"value\": \"Noah\" },\n    { \"type\": \"email\", \"value\": \"user@example.com\" },\n    { \"type\": \"role\", \"value\": \"User\" }\n  ]\n}\n```\n\n## Exception Handling\nThe API provides structured error responses for different scenarios:\n### Validation Errors (400 Bad Request)\n```json\n{\n  \"statusCode\": 400,\n  \"message\": \"Validation failed\",\n  \"details\": [\n    \"Name: Name is required\",\n    \"Email: Invalid email format\",\n    \"Age: Age must be between 1 and 150\"\n  ],\n  \"timestamp\": \"2024-01-15T10:30:00Z\"\n}\n```\n\n### Not Found (404)\n```json\n{\n  \"statusCode\": 404,\n  \"message\": \"User with ID '999' was not found\",\n  \"timestamp\": \"2024-01-15T10:30:00Z\"\n}\n```\n\n## Setup \u0026 Run\nRequirements\n\n- .NET 9 SDK\n\n- Docker \u0026 Docker Compose\n\nRun locally\n```bash\n# Start databases\ndocker-compose up -d\n\n# Run backend\ndotnet run --project RESTful\n```\nThe API will be available at:\n\nSwagger UI: http://localhost:5287/swagger\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikollbibajnoah%2Frestful-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikollbibajnoah%2Frestful-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikollbibajnoah%2Frestful-api/lists"}