Skip to content

Commit b41fb0b

Browse files
committed
Add README
1 parent e3519c0 commit b41fb0b

File tree

1 file changed

+212
-0
lines changed

1 file changed

+212
-0
lines changed

README.md

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,215 @@ npx create-net angular-spa MyProject
1515
## Jumpstart with Copilot
1616

1717
Instantly [scaffold a new App with this template](https://github.com/new?template_name=angular-spa&template_owner=NetCoreTemplates) using GitHub Copilot, just describe the features you want and watch Copilot build it!
18+
19+
### Angular with Modern Features
20+
21+
- **Standalone Components** - No NgModules, cleaner component architecture
22+
- **Signal-based State Management** - Reactive state with Angular's new signals API
23+
- **TypeScript 5.9** - Latest TypeScript features and improved type safety
24+
- **Tailwind CSS 4** - Utility-first styling with dark mode support
25+
26+
### .NET 10 Backend
27+
28+
- **ServiceStack v10** - High-performance .NET APIs with AutoQuery CRUD
29+
- **Entity Framework Core 10** - For ASP.NET Core Identity
30+
- **OrmLite** - Fast, typed POCO ORM for application data
31+
- **SQLite** - Zero-configuration database (easily swap for PostgreSQL, SQL Server, etc.)
32+
33+
### Upgrading to an production RDBMS
34+
35+
To switch from SQLite to PostgreSQL/SQL Server/MySQL:
36+
37+
1. Install preferred RDBMS (`ef-postgres`, `ef-mysql`, `ef-sqlserver`), e.g:
38+
39+
```bash
40+
npx add-in ef-postgres
41+
```
42+
43+
2. Install `db-identity` to also switch to use this RDBMS for [Background Jobs](https://docs.servicestack.net/rdbms-background-jobs) and [Request Logs Analytics](https://docs.servicestack.net/admin-ui-rdbms-analytics):
44+
45+
```bash
46+
npx add-in db-identity
47+
```
48+
49+
## Simplified .NET + Angular Development Workflow
50+
51+
- Single endpoint `https://localhost:5001` for both .NET and Angular UI (no dev certs required)
52+
- ASP.NET Core proxies requests to Angular dev server (port 4200)
53+
- Hot Module Replacement (HMR) support for instant UI updates
54+
- WebSocket proxying for Angular HMR functionality
55+
56+
![](https://docs.servicestack.net/img/pages/templates/angular-dev.svg)
57+
58+
## .NET Angular App with Static Export
59+
60+
**Angular SPA** uses **static export**, where a production build of the Angular App is generated at deployment and published together with the .NET App in its `/wwwroot` folder, utilizing static file serving to render its UI.
61+
62+
This minimal `angular-spa` starting template is perfect for your next AI Assisted project, offering a streamlined foundation for building modern web applications with **Angular 21** and **.NET 10**:
63+
64+
![](https://docs.servicestack.net/img/pages/templates/static-prod.svg)
65+
66+
## Key Features
67+
68+
### 🔐 ASP.NET Core Identity Authentication
69+
70+
Full authentication system with beautifully styled Tailwind CSS pages:
71+
- User registration and login
72+
- Email confirmation
73+
- Password reset
74+
- Profile management
75+
- Role-based authorization
76+
77+
### ⚡ Rapid AutoQuery CRUD dev workflow
78+
79+
Quickly generate complete C# [CRUD APIs](https://docs.servicestack.net/autoquery/crud) and [DB Migrations](https://docs.servicestack.net/ormlite/db-migrations) from simple [TypeScript data models](https://localhost:5002/autoquery/okai-models):
80+
81+
1. Create a new feature
82+
83+
```bash
84+
npx okai init MyFeature
85+
```
86+
87+
2. Define your TypeScript data models in `MyFeature.d.ts`, e.g:
88+
89+
```bash
90+
code MyApp.ServiceModel/MyFeature.d.ts
91+
```
92+
93+
3. When ready, generate C# APIs and migrations
94+
95+
```bash
96+
npx okai MyFeature.d.ts
97+
```
98+
99+
4. Apply database migrations
100+
101+
```bash
102+
npm run migrate
103+
```
104+
105+
### Use AI for quick scaffolding
106+
107+
To help quickly scaffold your data models and features, use ServiceStack's AI assistant. Example of creating AutoQuery CRUD APIs for managing products:
108+
109+
```bash
110+
npx okai "Manage products price and inventory"
111+
```
112+
113+
### 🤖 AI Chat Integration
114+
115+
Built-in AI Chat API support with multiple provider options:
116+
- ServiceStack AI
117+
- OpenAI, Anthropic, Google, Groq
118+
- Ollama for local models
119+
- OpenRouter and more
120+
121+
### 🔑 API Keys Management
122+
123+
Secure API key authentication with:
124+
- Admin-managed API keys
125+
- User self-service key generation
126+
- Scopes and features configuration
127+
128+
### 📊 Background Jobs
129+
130+
Durable background job processing with:
131+
- Command-based job execution
132+
- Recurring job scheduling
133+
- SMTP email sending via background workers
134+
135+
### 📝 Request Logging
136+
137+
SQLite-backed request logging for:
138+
- API request tracking
139+
- Error monitoring
140+
- Performance analysis
141+
142+
### 🔍 Built-in Admin UIs
143+
144+
- **/ui** - ServiceStack API Explorer
145+
- **/admin-ui** - Database management, user administration
146+
- **/swagger** - OpenAPI documentation (development mode)
147+
148+
## Architecture Highlights
149+
150+
### Hybrid Development Model
151+
152+
During development, `dotnet watch` starts both the .NET backend and Angular dev server with Hot Module Replacement. In production, Angular builds to static files served directly by ASP.NET Core.
153+
154+
### Modular Configuration
155+
156+
Clean separation of concerns with `IHostingStartup` pattern:
157+
- [Configure.AppHost.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Configure.AppHost.cs) - Main ServiceStack AppHost registration
158+
- [Configure.Auth.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Configure.Auth.cs) - ServiceStack AuthFeature with ASP.NET Core Identity integration
159+
- [Configure.AutoQuery.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Configure.AutoQuery.cs) - AutoQuery features and audit events
160+
- [Configure.Db.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Configure.Db.cs) - Database setup (OrmLite for app data, EF Core for Identity)
161+
- [Configure.Db.Migrations.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Configure.Db.Migrations.cs) - Runs OrmLite and EF DB Migrations and creates initial users
162+
- [Configure.BackgroundJobs.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Configure.BackgroundJobs.cs) - Background job processing
163+
- [Configure.HealthChecks.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Configure.HealthChecks.cs) - Health monitoring endpoint
164+
165+
This pattern keeps [Program.cs](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp/Program.cs) clean and separates concerns.
166+
167+
### Type-Safe API Client
168+
169+
Auto-generated TypeScript DTOs ensure type safety across the stack:
170+
171+
```typescript
172+
import { QueryBookings } from '@/dtos'
173+
174+
const response = await client.api(new QueryBookings({ minCost: 100 }))
175+
if (response.succeeded) {
176+
console.log(response.response!.results)
177+
}
178+
```
179+
180+
## Deployment Ready
181+
182+
GitHub Actions workflows included for:
183+
- **CI/CD** - Automated build and test
184+
- **Container Builds** - Docker image creation
185+
- **Kamal Deployment** - One-command production deployment with SSL
186+
187+
### Kamal Deployments
188+
189+
All deployments include the GitHub Action workflows to deploy your App to [any Linux Server with Kamal](https://docs.servicestack.net/kamal-deploy) using Docker, SSH and GitHub Container Registry (ghcr).
190+
191+
## AI-Assisted Development with CLAUDE.md
192+
193+
As part of our objectives of improving developer experience and embracing modern AI-assisted development workflows - all new .NET React templates include a comprehensive `AGENTS.md` file designed to optimize AI-assisted development workflows.
194+
195+
### What is CLAUDE.md?
196+
197+
`CLAUDE.md` and [AGENTS.md](https://agents.md) onboards Claude (and other AI assistants) to your codebase by using a structured documentation file that provides it with complete context about your project's architecture, conventions, and technology choices. This enables more accurate code generation, better suggestions, and faster problem-solving.
198+
199+
### What's Included
200+
201+
Each template's `AGENTS.md` contains:
202+
203+
- **Project Architecture Overview** - Technology stack, design patterns, and key architectural decisions
204+
- **Project Structure** - Gives Claude a map of the codebase
205+
- **ServiceStack Conventions** - DTO patterns, Service implementation, AutoQuery, Authentication, and Validation
206+
- **React Integration** - TypeScript DTO generation, API client usage, component patterns, and form handling
207+
- **Database Patterns** - OrmLite setup, migrations, and data access patterns
208+
- **Common Development Tasks** - Step-by-step guides for adding APIs, implementing features, and extending functionality
209+
- **Testing & Deployment** - Test patterns and deployment workflows
210+
211+
### Extending with Project-Specific Details
212+
213+
The existing `CLAUDE.md` serves as a solid foundation, but for best results, you should extend it with project-specific details like the purpose of the project, key parts and features of the project and any unique conventions you've adopted.
214+
215+
### Benefits
216+
217+
- **Faster Onboarding** - New developers (and AI assistants) understand project conventions immediately
218+
- **Consistent Code Generation** - AI tools generate code following your project's patterns
219+
- **Better Context** - AI assistants can reference specific ServiceStack patterns and conventions
220+
- **Reduced Errors** - Clear documentation of framework-specific conventions
221+
- **Living Documentation** - Keep it updated as your project evolves
222+
223+
### How to Use
224+
225+
Claude Code and most AI Assistants already support automatically referencing `CLAUDE.md` and `AGENTS.md` files, for others you can just include it in your prompt context when asking for help, e.g:
226+
227+
> Using my project's AGENTS.md, can you help me add a new AutoQuery API for managing Products?
228+
229+
The AI will understand your App's ServiceStack conventions, React setup, and project structure, providing more accurate and contextual assistance.

0 commit comments

Comments
 (0)