{"id":20226398,"url":"https://github.com/nueluzoma/csharp-backend","last_synced_at":"2025-04-10T17:07:47.366Z","repository":{"id":249095285,"uuid":"829610413","full_name":"NuelUzoma/CSharp-Backend","owner":"NuelUzoma","description":"A project showcasing the development of a backend application using C# and ASP.NET Core, utilizing Entity Framework and PostgreSQL for database operations. ","archived":false,"fork":false,"pushed_at":"2024-07-29T00:36:23.000Z","size":17,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T14:50:31.483Z","etag":null,"topics":["asp-net-core","csharp","dotnet","entity-framework","jwt-authentication","postgresql"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NuelUzoma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-07-16T19:29:09.000Z","updated_at":"2025-01-06T09:19:33.000Z","dependencies_parsed_at":"2024-07-29T01:51:03.857Z","dependency_job_id":null,"html_url":"https://github.com/NuelUzoma/CSharp-Backend","commit_stats":null,"previous_names":["nueluzoma/csharp-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NuelUzoma%2FCSharp-Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NuelUzoma%2FCSharp-Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NuelUzoma%2FCSharp-Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NuelUzoma%2FCSharp-Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NuelUzoma","download_url":"https://codeload.github.com/NuelUzoma/CSharp-Backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248260737,"owners_count":21074215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["asp-net-core","csharp","dotnet","entity-framework","jwt-authentication","postgresql"],"created_at":"2024-11-14T07:18:01.714Z","updated_at":"2025-04-10T17:07:47.345Z","avatar_url":"https://github.com/NuelUzoma.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSharp-Backend\n\nThis repository contains a C# and ASP.NET Core application utilizing Entity Framework for database operations. This project demonstrates a basic implementation of user authentication with JWT, password hashing with BCrypt, and includes setup instructions for a PostgreSQL database.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Database Migration](#database-migration)\n- [Running the Application](#running-the-application)\n- [API Endpoints](#api-endpoints)\n\n## Introduction\n\nCSharp-Backend is a project showcasing the development of a backend application using C# and ASP.NET Core. The application includes user authentication, JWT integration, and database operations using Entity Framework with PostgreSQL.\n\n## Features\n\n- User registration and authentication\n- JWT-based authentication\n- Password hashing with BCrypt\n- Database operations with Entity Framework Core\n- PostgreSQL database integration\n- API documentation with Postman\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed:\n\n- .NET SDK 8.0\n- PostgreSQL\n- Visual Studio Code (or any other code editor)\n\n## Installation\n\n1. **Clone the repository:**\n   ```bash\n   git clone https://github.com/NuelUzoma/CSharp-Backend.git\n   cd CSharp-Backend\n   ```\n\n2. **Install .NET SDK 8.0:**\n   Follow the instructions from the [official .NET download page for debian](https://learn.microsoft.com/en-gb/dotnet/core/install/linux-debian).\n\n   For Linux:\n   ```bash\n   wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb\n   sudo dpkg -i packages-microsoft-prod.deb\n   rm packages-microsoft-prod.deb\n\n   sudo apt-get update \u0026\u0026 \\\n   sudo apt-get install -y dotnet-sdk-8.0\n\n   sudo apt-get update \u0026\u0026 \\\n   sudo apt-get install -y aspnetcore-runtime-8.0\n\n   dotnet --version\n   ```\n\n3. **Install PostgreSQL:**\n   Follow the instructions from the [official PostgreSQL download page](https://www.postgresql.org/download/).\n\n4. **Restore NuGet packages:**\n   ```bash\n   dotnet restore\n   ```\n\n## Configuration\n\n1. **Set up the database connection string:**\n   Update the `appsettings.json` file with your PostgreSQL connection string:\n   ```json\n   {\n     \"ConnectionStrings\": {\n       \"DefaultConnection\": \"Host=localhost;Database=first_backend;Username=your_username;Password=your_password\"\n     },\n     \"Jwt\": {\n       \"Key\": \"your_256_bit_key\",\n       \"Issuer\": \"http://localhost:5145\",\n       \"Audience\": \"http://localhost:5145\"\n     },\n     \"Logging\": {\n       \"LogLevel\": {\n         \"Default\": \"Information\",\n         \"Microsoft.AspNetCore\": \"Warning\"\n       }\n     },\n     \"AllowedHosts\": \"*\"\n   }\n   ```\n\n2. **Generate a 256-bit secret key for JWT:**\n   ```bash\n   openssl rand -base64 32\n   ```\n\n## Database Migration\n\n1. **Create and apply migrations:**\n   ```bash\n   dotnet dotnet-ef migrations add InitialCreate\n   dotnet dotnet-ef database update\n   ```\n\n## Running the Application\n\n1. **Run the application:**\n   ```bash\n   dotnet run\n   ```\n\n## API Endpoints\n\n### User Registration\n\n- **Endpoint:** `POST /api/user/signup`\n- **Description:** Registers a new user.\n- **Request Body:**\n  ```json\n  {\n    \"name\": \"JohnDoe\",\n    \"email\": \"johndoe@example.com\",\n    \"password\": \"your_password\"\n  }\n  ```\n- **Response:**\n  ```json\n  {\n    \"id\": 1,\n    \"name\": \"JohnDoe\",\n    \"email\": \"johndoe@example.com\"\n  }\n  ```\n\n### User Authentication\n\n- **Endpoint:** `POST /api/auth/login`\n- **Description:** Authenticates a user and returns a JWT.\n- **Request Body:**\n  ```json\n  {\n    \"email\": \"johndoe@example.com\",\n    \"password\": \"your_password\"\n  }\n  ```\n- **Response:**\n  ```json\n  {\n    \"token\": \"your_jwt_token\"\n  }\n  ```\n\n### Get Users\n\n- **Endpoint:** `GET /api/user`\n- **Description:** Retrieves users.\n- **Response:**\n  ```json\n    [\n        {\n            \"id\": 1,\n            \"name\": \"Emmanuel\",\n            \"email\": \"emc14@gmail.com\"\n        },\n        {\n            \"id\": 2,\n            \"name\": \"Nuel\",\n            \"email\": \"user2@gmail.com\"\n        },\n        {\n            \"id\": 3,\n            \"name\": \"Uzo\",\n            \"email\": \"user3@gmail.com\"\n        },\n        {\n            \"id\": 4,\n            \"name\": \"Uzoma\",\n            \"email\": \"user4@gmail.com\"\n        },\n        {\n            \"id\": 5,\n            \"name\": \"Uzomachukwu\",\n            \"email\": \"user5@gmail.com\"\n        },\n        {\n            \"id\": 6,\n            \"name\": \"Uzomachukws Chidera\",\n            \"email\": \"user6@gmail.com\"\n        },\n        {\n            \"id\": 7,\n            \"name\": \"Chidera KSI\",\n            \"email\": \"user7@gmail.com\"\n        }\n    ]\n  ```\n\n### Get User by ID\n\n- **Endpoint:** `GET /api/user/{id}`\n- **Description:** Retrieves a user by ID.\n- **Response:**\n  ```json\n    {\n        \"id\": 4,\n        \"name\": \"Uzoma\",\n        \"email\": \"user4@gmail.com\"\n    }\n  ```\n\n### Delete User by ID\n\n- **Endpoint:** `DELETE /api/user/{id}`\n- **Description:** Deletes a user by ID.\n- **Response:**\n  ```json\n    {\n         \"message\": \"User has been deleted successfully\"\n    }\n  ```\n\n#### API Full Documentation collection is available on Postman as well, awaiting publishing.\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnueluzoma%2Fcsharp-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnueluzoma%2Fcsharp-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnueluzoma%2Fcsharp-backend/lists"}