Skip to content

Commit 26d68be

Browse files
authored
Enhance README with project details and rename instructions
Updated README to provide detailed project information and renaming guide.
1 parent ad372a8 commit 26d68be

1 file changed

Lines changed: 297 additions & 1 deletion

File tree

README.md

Lines changed: 297 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,297 @@
1-
# CleanArchTemplate
1+
# CleanArchTemplate (.NET 9 Clean Architecture)
2+
3+
## About the Project
4+
5+
**CleanArchTemplate** is a fully featured **.NET 9 Clean Architecture** boilerplate project built for rapid enterprise application development.
6+
It provides a ready-to-use foundation with modern best practices and modular layers, so you can quickly rename and launch new projects.
7+
8+
### ✨ Key Features
9+
10+
-**.NET 9 Clean Architecture** pattern
11+
-**Entity Framework Core** with `DbContext`
12+
-**Authentication & Authorization** using **Roles** and **Policies**
13+
-**JWT with Refresh Tokens**
14+
-**File Upload Support**
15+
-**Email Sending via SendGrid and Mailgun** (requires API keys)
16+
-**Email Templates (Account Registration, etc)** ready to use
17+
-**Dependency Injection (DI) Registration**
18+
-**Logging with NLog**
19+
-**Swagger/OpenAPI** documentation
20+
-**Ready to use out-of-the-box** after renaming
21+
- ✅ Organized in **four projects**:
22+
- `API`
23+
- `Application`
24+
- `Domain`
25+
- `Infrastructure`
26+
- ✅ Common base types such as:
27+
- `EntityBase` (as record)
28+
- `ApplicationUser`
29+
- DTOs
30+
31+
Use this project as a starting point for scalable, secure, and maintainable .NET applications.
32+
33+
---
34+
35+
# Rename Guide
36+
37+
If you want to create a new project based on this template (for example, rename **CleanArchTemplate** to **NewProjectName**), follow the steps below.
38+
39+
---
40+
41+
## Step 1 – Close the IDE
42+
43+
Close **Visual Studio**, **Rider**, or **VS Code** before renaming to avoid file locks.
44+
45+
---
46+
47+
## Step 2 – Rename the Solution and Folder
48+
49+
In **File Explorer**:
50+
51+
1. Rename the main project folder
52+
```
53+
CleanArchTemplate → NewProjectName
54+
```
55+
2. Rename the solution file
56+
```
57+
CleanArchTemplate.sln → NewProjectName.sln
58+
```
59+
60+
---
61+
62+
## Step 3 – Update the Solution File
63+
64+
Open the `.sln` file in a text editor (Notepad or VS Code) and search for:
65+
66+
```
67+
Project("{GUID}") = "CleanArchTemplate", "CleanArchTemplate\CleanArchTemplate.csproj", "{GUID}"
68+
```
69+
Replace **CleanArchTemplate** with your new project name:
70+
```
71+
Project("{GUID}") = "NewProjectName", "NewProjectName\NewProjectName.csproj", "{GUID}"
72+
```
73+
74+
Save and close.
75+
76+
---
77+
78+
## ⚙️ Step 4 – Rename the Project Files (Optional)
79+
80+
If you wish, rename your `.csproj` files to match:
81+
82+
```
83+
84+
API.csproj → NewProjectName.API.csproj
85+
Application.csproj → NewProjectName.Application.csproj
86+
Infrastructure.csproj → NewProjectName.Infrastructure.csproj
87+
Domain.csproj → NewProjectName.Domain.csproj
88+
89+
````
90+
91+
This step is optional; the template will still run with the original file names.
92+
93+
---
94+
95+
## 🧩 Step 5 – Update Namespaces and References
96+
97+
Search the entire solution for **`CleanArchTemplate`** and replace it with your new project name, e.g.:
98+
99+
```csharp
100+
namespace CleanArchTemplate.API.Controllers
101+
````
102+
103+
becomes
104+
105+
```csharp
106+
namespace NewProjectName.API.Controllers
107+
```
108+
109+
Also update any `<ProjectReference>` entries if you renamed `.csproj` files:
110+
111+
```xml
112+
<ProjectReference Include="..\Application\Application.csproj" />
113+
```
114+
115+
to
116+
117+
```xml
118+
<ProjectReference Include="..\Application\NewProjectName.Application.csproj" />
119+
```
120+
121+
---
122+
123+
## Step 6 – Update `.csproj` Properties
124+
125+
Inside each `.csproj` file, ensure the following reflect your new project name:
126+
127+
```xml
128+
<PropertyGroup>
129+
<RootNamespace>NewProjectName</RootNamespace>
130+
<AssemblyName>NewProjectName</AssemblyName>
131+
</PropertyGroup>
132+
```
133+
134+
---
135+
136+
## Step 7 – Update App Settings and Database Name
137+
138+
Open `appsettings.json` in the API project and update your connection string:
139+
140+
```json
141+
"ConnectionStrings": {
142+
"DefaultConnection": "Server=...;Database=NewProjectNameDB;..."
143+
}
144+
```
145+
146+
---
147+
148+
## Step 8 – Update Email and SMTP Configuration
149+
150+
In `appsettings.json`, update the following sections:
151+
152+
### **SmtpConfig**
153+
154+
Set your actual SMTP credentials:
155+
156+
```json
157+
"SmtpConfig": {
158+
"Host": "smtp.yourdomain.com",
159+
"Port": 587,
160+
"Mail": "noreply@yourdomain.com",
161+
"Password": "your_smtp_password",
162+
"DisplayName": "Your App Name"
163+
}
164+
```
165+
166+
### **EmailLink**
167+
168+
Update the domain to match your new environment:
169+
170+
```json
171+
"EmailLink": {
172+
"Domain": "https://newprojectname.com"
173+
}
174+
```
175+
176+
### **CORSAllowedOrigins**
177+
178+
Add your allowed frontend domains:
179+
180+
```json
181+
"CORSAllowedOrigins": [
182+
"https://newprojectname.com",
183+
"https://admin.newprojectname.com"
184+
]
185+
```
186+
187+
Then open the **Mail Service** class:
188+
189+
```
190+
Application/Services/MailService.cs
191+
```
192+
193+
Locate the method:
194+
195+
```csharp
196+
SendEmailViaMailgun()
197+
```
198+
199+
and update the Mailgun **domain** to match your configuration.
200+
201+
---
202+
203+
## Step 9 – Update Swagger Details
204+
205+
Go to:
206+
`API/Extensions/ServiceCollectionExtensions.cs`
207+
208+
Find `ConfigureSwagger` and change the Swagger title, description, and version text from **CleanArchTemplate** to **NewProjectName**.
209+
210+
In `Program.cs`, update:
211+
212+
```csharp
213+
app.UseSwaggerUI(c =>
214+
{
215+
c.SwaggerEndpoint("/swagger/v1/swagger.json", "CleanArchTemplate");
216+
});
217+
```
218+
219+
to
220+
221+
```csharp
222+
app.UseSwaggerUI(c =>
223+
{
224+
c.SwaggerEndpoint("/swagger/v1/swagger.json", "NewProjectName");
225+
});
226+
```
227+
228+
---
229+
230+
## Step 10 – Update Emails and Usernames
231+
232+
Search for both `CleanArchTemplate` and `@cleanarchtemplate` and replace them with your new project name.
233+
234+
Example:
235+
236+
```
237+
superadmin@cleanarchtemplate.com
238+
```
239+
240+
becomes
241+
242+
```
243+
superadmin@newprojectname.com
244+
```
245+
246+
---
247+
248+
## Step 11 – Run Migrations
249+
250+
To run or add Entity Framework migrations:
251+
252+
1. In Visual Studio, **set the Infrastructure project as Startup Project**.
253+
2. Open the Package Manager Console and run:
254+
255+
```powershell
256+
Add-Migration InitialCreate
257+
Update-Database
258+
```
259+
260+
---
261+
262+
## Step 12 – Clean & Rebuild
263+
264+
After renaming:
265+
266+
```bash
267+
dotnet clean
268+
dotnet build
269+
```
270+
271+
Run the API and confirm everything works correctly.
272+
273+
---
274+
275+
# Summary
276+
277+
| Area | What to Change |
278+
| ------------------ | ------------------------------------------------- |
279+
| Solution / Folder | Rename to your new project name |
280+
| Namespaces | Replace `CleanArchTemplate` with `NewProjectName` |
281+
| Emails / Usernames | Replace `@cleanarchtemplate` |
282+
| SMTP Settings | Update host, mail, password, display name, port |
283+
| Email Link | Update domain |
284+
| CORS | Update allowed origins |
285+
| Mail Service | Update Mailgun domain |
286+
| Swagger | Update title and endpoint |
287+
| Database | Update connection string name |
288+
| Migrations | Run with Infrastructure as startup project |
289+
290+
---
291+
292+
**That’s it!**
293+
After completing these steps, your new project (**NewProjectName**) will be fully operational — complete with authentication, authorization, Swagger, file upload, EF Core, DI, NLog, and refresh tokens — all ready to go!
294+
295+
---
296+
297+
> **Tip:** Commit your renamed project as a new GitHub repository to keep this template clean for future reuse.

0 commit comments

Comments
 (0)