Skip to content

Commit 523c5fe

Browse files
committed
update next-rsc
1 parent b44e835 commit 523c5fe

File tree

4 files changed

+396
-23
lines changed

4 files changed

+396
-23
lines changed

components/template-intro.tsx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import Link from 'next/link';
2+
import { ExternalLink, Github } from 'lucide-react';
3+
4+
interface TemplateIntroProps {
5+
image: string;
6+
repo: string;
7+
demo: string;
8+
name?: string;
9+
}
10+
11+
export default function TemplateIntro({ image, repo, demo, name }: TemplateIntroProps) {
12+
return (
13+
<div className="flex flex-col gap-6 my-8 not-prose">
14+
<div className="relative rounded-xl overflow-hidden border border-slate-200 dark:border-slate-800 shadow-sm group">
15+
<a href={demo} target="_blank" rel="noopener noreferrer" className="block">
16+
<img
17+
src={image}
18+
alt={name || "Template Screenshot"}
19+
className="w-full h-auto object-cover transition-transform duration-500 group-hover:scale-[1.01]"
20+
/>
21+
<div className="absolute inset-0 bg-black/0 group-hover:bg-black/5 transition-colors duration-300" />
22+
</a>
23+
</div>
24+
25+
<div className="flex justify-center">
26+
<a href={demo} target="_blank" rel="noopener noreferrer" className="text-xl font-medium text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 hover:underline">
27+
{demo.replace(/^https?:\/\//, '')}
28+
</a>
29+
</div>
30+
31+
<div className="flex flex-wrap gap-4 justify-center">
32+
<a
33+
href={demo}
34+
target="_blank"
35+
rel="noopener noreferrer"
36+
className="inline-flex items-center gap-2 px-6 py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-medium transition-colors shadow-sm hover:shadow-md"
37+
>
38+
<ExternalLink className="w-4 h-4" />
39+
Live Demo
40+
</a>
41+
42+
<a
43+
href={repo}
44+
target="_blank"
45+
rel="noopener noreferrer"
46+
className="inline-flex items-center gap-2 px-6 py-2.5 bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-800 text-slate-700 dark:text-slate-200 rounded-lg font-medium transition-all shadow-sm hover:shadow-md"
47+
>
48+
<Github className="w-4 h-4" />
49+
View Source
50+
</a>
51+
</div>
52+
</div>
53+
);
54+
}

content/docs/configuration.mdx

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
title: Configuration
3+
description: Configuration of .NET React template features
4+
---
5+
6+
## Configuration
7+
8+
### Key Configuration Files
9+
10+
- **MyApp/appsettings.json** - Application configuration
11+
- **MyApp.Client/next.config.mjs** - Next.js configuration (for Next.js templates)
12+
- **MyApp.Client/vite.config.ts** - Vite configuration (for Vite templates)
13+
- **MyApp.Client/styles/index.css** - Tailwind CSS configuration
14+
- **config/deploy.yml** - Kamal deployment settings
15+
16+
## App Settings
17+
18+
Configure in `appsettings.json` or environment:
19+
20+
```json
21+
{
22+
"ConnectionStrings": {
23+
"DefaultConnection": "DataSource=App_Data/app.db;Cache=Shared"
24+
},
25+
"SmtpConfig": {
26+
"Host": "smtp.example.com",
27+
"Port": 587,
28+
"FromEmail": "[email protected]",
29+
"FromName": "MyApp"
30+
},
31+
"AppConfig": {
32+
}
33+
}
34+
```
35+
36+
### Enable SMTP to Send Identity Auth Emails
37+
38+
Update **SmtpConfig** in `appsettings.json` with your SMTP settings.
39+
40+
In `Program.cs`, uncomment:
41+
42+
```csharp
43+
services.AddSingleton<IEmailSender<ApplicationUser>, EmailSender>();
44+
```
45+
46+
### App Settings Secrets
47+
48+
Instead of polluting each GitHub Reposity with multiple App-specific GitHub Action Secrets, you can save all your secrets in a single `APPSETTINGS_PATCH` GitHub Action Secret to patch `appsettings.json` with environment-specific configuration using [JSON Patch](https://jsonpatch.com). E.g:
49+
50+
```json
51+
[
52+
{
53+
"op":"replace",
54+
"path":"/ConnectionStrings/DefaultConnection",
55+
"value":"Server=service-postgres;Port=5432;User Id=dbuser;Password=dbpass;Database=dbname;Pooling=true;"
56+
},
57+
{ "op":"add", "path":"/SmtpConfig", "value":{
58+
"UserName": "SmptUser",
59+
"Password": "SmptPass",
60+
"Host": "email-smtp.us-east-1.amazonaws.com",
61+
"Port": 587,
62+
"From": "[email protected]",
63+
"FromName": "MyApp",
64+
65+
}
66+
},
67+
{ "op":"add", "path":"/Admins", "value": ["[email protected]","[email protected]"] },
68+
{ "op":"add", "path":"/CorsFeature/allowOriginWhitelist/-", "value":"https://servicestack.net" }
69+
]
70+
```
71+
72+
### SMTP Email
73+
74+
Enable email sending by uncommenting in `Program.cs`:
75+
76+
```csharp
77+
services.AddSingleton<IEmailSender<ApplicationUser>, EmailSender>();
78+
```
79+
80+
## Upgrading to Enterprise Database
81+
82+
To switch from SQLite to PostgreSQL/SQL Server/MySQL:
83+
84+
1. Install preferred RDBMS (ef-postgres, ef-mysql, ef-sqlserver), e.g:
85+
86+
```bash
87+
npx add-in ef-postgres
88+
```
89+
90+
2. Install `db-identity` to use RDBMS `DatabaseJobsFeature` for background jobs and `DbRequestLogger` for Request Logs:
91+
92+
```bash
93+
npx add-in db-identity
94+
```
95+
96+
### App Settings Secrets
97+
98+
You could register any App-specifc secrets here, although our preference is instead of polluting each
99+
GitHub Reposity with multiple App-specific GitHub Action Secrets, you can save all your secrets in a single
100+
`APPSETTINGS_PATCH` GitHub Action Secret to patch `appsettings.json` with environment-specific configuration
101+
using [JSON Patch](https://jsonpatch.com). E.g:
102+
103+
```bash
104+
# JSON Patch to apply to appsettings.json:
105+
gh secret set APPSETTINGS_PATCH [json-patch]
106+
```
107+
108+
JSON Patch example:
109+
110+
```json
111+
[
112+
{
113+
"op":"replace",
114+
"path":"/ConnectionStrings/DefaultConnection",
115+
"value":"Server=service-postgres;Port=5432;User Id=dbuser;Password=dbpass;Database=dbname"
116+
},
117+
{ "op":"add", "path":"/SmtpConfig", "value":{
118+
"UserName": "SmptUser",
119+
"Password": "SmptPass",
120+
"Host": "email-smtp.us-east-1.amazonaws.com",
121+
"Port": 587,
122+
"From": "[email protected]",
123+
"FromName": "MyApp",
124+
125+
}
126+
},
127+
{ "op":"add", "path":"/Admins", "value": ["[email protected]","[email protected]"] },
128+
{ "op":"add", "path":"/CorsFeature/allowOriginWhitelist/-", "value":"https://servicestack.net" }
129+
]
130+
```
131+
132+
### Kamal Accessories
133+
134+
[Kamal Accessories](https://kamal-deploy.org/docs/commands/accessory/) allow you to run stateful services (like Databases, Redis, etc) on the same server as your application. This is a cost-effective way to host small-to-medium applications on a single server.
135+
136+
You can define accessories in your `config/deploy.yml`. Here is an example of adding a local PostgreSQL database:
137+
138+
```yaml
139+
service: acme
140+
# ...
141+
142+
accessories:
143+
postgres:
144+
image: postgres
145+
# IP address of server to deploy accessory to. (e.g. 100.100.100.100)
146+
host: <%= ENV['KAMAL_DEPLOY_IP'] %>
147+
# Expose port 5432 to the host (optional, for external access)
148+
# port: "5432:5432"
149+
env:
150+
clear:
151+
# Database username and database name
152+
POSTGRES_USER: app
153+
POSTGRES_DB: app_db
154+
# Persist data to a volume
155+
PGDATA: /var/lib/postgresql/data
156+
# secrets from .env or GitHub Secrets
157+
secret:
158+
- POSTGRES_PASSWORD
159+
directories:
160+
# Mount host directories to container for persistence
161+
- /opt/docker/acme/postgres:/var/lib/postgresql/data
162+
# Optional: Init scripts
163+
- /opt/docker/acme/initdb.d:/docker-entrypoint-initdb.d
164+
```
165+
166+
### Referencing Accessories
167+
168+
When your application runs in Docker on the same server, you can reference the accessory using the Docker service name.
169+
170+
For Kamal, the service name follows the pattern `<app-service>-<accessory-name>`.
171+
For example, if your service is named `acme` and accessory is `postgres`, the hostname will be `acme-postgres`.
172+
173+
**Connection String Example:**
174+
175+
```
176+
Server=acme-postgres;Port=5432;User Id=app;Password=...;Database=app_db;
177+
```

content/docs/meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"index",
44
"features",
55
"templates",
6-
"vibe-coding",
76
"---Learn---",
7+
"vibe-coding",
88
"autoquery",
9+
"configuration",
910
"deployments"
1011
]
1112
}

0 commit comments

Comments
 (0)