{"id":31396226,"url":"https://github.com/xjectro/dotnet-boilterplate","last_synced_at":"2025-10-01T22:26:48.924Z","repository":{"id":316743684,"uuid":"1063915970","full_name":"Xjectro/dotnet-boilterplate","owner":"Xjectro","description":"A clean architecture .NET 9.0 Web API project with JWT authentication, built with Entity Framework Core and PostgreSQL.","archived":false,"fork":false,"pushed_at":"2025-09-26T11:29:38.000Z","size":286,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-26T13:25:22.913Z","etag":null,"topics":["aspnet-core","authentication","authorization","bcrypt","clean-architecture","code-first","csharp","dependency-injection","dotnet","educational","entity-framework-core","jwt-authentication","layered-architecture","migrations","net9","postgresql","repository-pattern","rest-api","swagger","webapi"],"latest_commit_sha":null,"homepage":"https://xjectro.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xjectro.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-09-25T09:38:25.000Z","updated_at":"2025-09-26T11:31:40.000Z","dependencies_parsed_at":"2025-09-26T13:25:26.394Z","dependency_job_id":"67905bc4-8c86-419f-ab99-d45276b3e5cb","html_url":"https://github.com/Xjectro/dotnet-boilterplate","commit_stats":null,"previous_names":["xjectro/dotnet-boilterplate"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Xjectro/dotnet-boilterplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xjectro%2Fdotnet-boilterplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xjectro%2Fdotnet-boilterplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xjectro%2Fdotnet-boilterplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xjectro%2Fdotnet-boilterplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xjectro","download_url":"https://codeload.github.com/Xjectro/dotnet-boilterplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xjectro%2Fdotnet-boilterplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277503542,"owners_count":25829216,"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","status":"online","status_checked_at":"2025-09-29T02:00:09.175Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["aspnet-core","authentication","authorization","bcrypt","clean-architecture","code-first","csharp","dependency-injection","dotnet","educational","entity-framework-core","jwt-authentication","layered-architecture","migrations","net9","postgresql","repository-pattern","rest-api","swagger","webapi"],"created_at":"2025-09-29T11:09:21.271Z","updated_at":"2025-09-30T12:07:24.663Z","avatar_url":"https://github.com/Xjectro.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project Root - .NET Web API\n\nA clean architecture .NET 9.0 Web API project with JWT authentication, built with Entity Framework Core and PostgreSQL.\n\n## 🏗️ Architecture\n\nThis project follows Clean Architecture principles with the following layers:\n\n- **Domain**: Core business entities and domain logic\n- **Application**: Business logic, DTOs, and service interfaces\n- **Infrastructure**: Data access, repositories, and external services\n- **API**: Controllers, middleware, and API configuration\n\n## 🚀 Features\n\n- **JWT Authentication**: Secure token-based authentication\n- **User Registration \u0026 Login**: Complete authentication flow\n- **BCrypt Password Hashing**: Secure password storage\n- **PostgreSQL Database**: Robust data persistence\n- **Entity Framework Core**: Code-first database approach\n- **Swagger Documentation**: Interactive API documentation\n- **Clean Architecture**: Maintainable and testable code structure\n\n## 🛠️ Technology Stack\n\n- **.NET 9.0**: Latest .NET framework\n- **ASP.NET Core Web API**: RESTful API framework\n- **Entity Framework Core 9.0**: ORM for data access\n- **PostgreSQL**: Primary database\n- **JWT**: JSON Web Tokens for authentication\n- **BCrypt.Net**: Password hashing library\n- **Swagger/OpenAPI**: API documentation\n\n## 📋 Prerequisites\n\n- [.NET 9.0 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)\n- [PostgreSQL](https://www.postgresql.org/download/)\n- IDE (Visual Studio, VS Code, or Rider)\n\n## ⚙️ Setup \u0026 Installation\n\n### 1. Clone the Repository\n```bash\ngit clone \u003crepository-url\u003e\ncd project-root\n```\n\n### 2. Database Configuration\nUpdate the connection string in `src/Api/appsettings.json`:\n```json\n{\n  \"ConnectionStrings\": {\n    \"DefaultConnection\": \"Host=localhost;Port=5432;Database=your_db;Username=your_user;Password=your_password\"\n  }\n}\n```\n\n### 3. JWT Configuration\nConfigure JWT settings in `src/Api/appsettings.json`:\n```json\n{\n  \"JwtSettings\": {\n    \"Secret\": \"your-secret-key-at-least-32-characters-long\",\n    \"Issuer\": \"YourApp\",\n    \"Audience\": \"YourAppUsers\",\n    \"ExpiresInMinutes\": 60\n  }\n}\n```\n\n### 4. Database Migration\nRun the following commands to set up the database:\n```bash\n# Apply migrations\nmake update\n\n# Or manually:\ndotnet ef database update --project src/Infrastructure --startup-project src/Api\n```\n\n### 5. Build and Run\n```bash\n# Build the project\nmake build\n\n# Run the application\nmake run\n\n# Or manually:\ndotnet run --project src/Api\n```\n\nThe API will be available at:\n- HTTP: `http://localhost:5143`\n- HTTPS: `https://localhost:7284` (if configured)\n\n## 📚 API Endpoints\n\n### Authentication\n\n#### Register User\n```http\nPOST /api/auth/register\nContent-Type: application/json\n\n{\n  \"username\": \"john_doe\",\n  \"email\": \"john@example.com\",\n  \"password\": \"SecurePassword123\"\n}\n```\n\n#### Login User\n```http\nPOST /api/auth/login\nContent-Type: application/json\n\n{\n  \"email\": \"john@example.com\",\n  \"password\": \"SecurePassword123\"\n}\n```\n\n**Response:**\n```json\n{\n  \"success\": true,\n  \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"\n}\n```\n\n### Session Management\n\n#### Get Current User\n```http\nGET /api/session\nAuthorization: Bearer \u003cyour-jwt-token\u003e\n```\n\n**Response:**\n```json\n{\n  \"success\": true,\n  \"id\": 1,\n  \"username\": \"john_doe\",\n  \"email\": \"john@example.com\"\n}\n```\n\n## 🔧 Development Commands\n\nThe project includes a Makefile for common development tasks:\n\n```bash\n# Create a new migration\nmake migrate-MigrationName\n\n# Update database\nmake update\n\n# Build project\nmake build\n\n# Run project\nmake run\n```\n\n## 🗂️ Project Structure\n\n```\n├── src/\n│   ├── Api/                    # Web API layer\n│   │   ├── Controllers/        # API controllers\n│   │   ├── Middleware/         # Custom middleware\n│   │   └── Attributes/         # Custom attributes\n│   ├── Application/            # Application layer\n│   │   ├── DTOs/              # Data Transfer Objects\n│   │   ├── Interfaces/        # Service contracts\n│   │   └── Services/          # Business logic services\n│   ├── Domain/                # Domain layer\n│   │   └── Entities/          # Domain entities\n│   └── Infrastructure/        # Infrastructure layer\n│       ├── Data/              # Database context \u0026 migrations\n│       └── Repositories/      # Data access implementations\n├── Makefile                   # Development commands\n└── project-root.sln          # Solution file\n```\n\n## 🔒 Security Features\n\n- **JWT Token Authentication**: Stateless authentication mechanism\n- **BCrypt Password Hashing**: Industry-standard password encryption (cost factor: 12)\n- **Authorization Middleware**: Custom middleware for token validation\n- **Secure Headers**: Proper security headers configuration\n\n## 🧪 Testing the API\n\n### Using Swagger UI\n1. Navigate to `http://localhost:5143/swagger` when the application is running\n2. Use the interactive documentation to test endpoints\n3. For protected endpoints, click \"Authorize\" and enter: `Bearer \u003cyour-token\u003e`\n\n### Using HTTP Files\nThe project includes `src/Api/Api.http` file for testing with REST clients.\n\n## 📝 Database Schema\n\n### Members Table\n```sql\nCREATE TABLE members (\n    Id SERIAL PRIMARY KEY,\n    username VARCHAR(30) NOT NULL,\n    email TEXT NOT NULL,\n    password TEXT NOT NULL\n);\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under a custom educational license. See the [LICENCE](LICENCE) file for details.\n\n**Note**: This software is provided for learning and educational purposes only. Commercial use, distribution, or sale is strictly prohibited.\n\n## 🚨 Important Security Notes\n\n- Change the default JWT secret key in production\n- Use strong passwords for database connections\n- Never commit sensitive configuration to version control\n- Consider using environment variables for sensitive settings\n- Implement rate limiting in production\n- Add HTTPS configuration for production deployment\n\n## 📞 Support\n\nFor questions and support, please create an issue in the repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxjectro%2Fdotnet-boilterplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxjectro%2Fdotnet-boilterplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxjectro%2Fdotnet-boilterplate/lists"}