You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MyApp/_posts/2025-11-12_react.md
+175-2Lines changed: 175 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,179 @@ Switch to Dark Mode to see how all components looks in Dark Mode:
101
101
</a>
102
102
</div>
103
103
104
-
---
105
-
106
104
ServiceStack's first-class React support positions your applications at the forefront of AI-assisted development. With declarative APIs, complete type safety, and minimal boilerplate, you can leverage AI code generation with confidence while maintaining the quality and maintainability your production systems demand.
105
+
106
+
## TypeScript Data Models
107
+
108
+
As AI Models are not as adept at generating C# APIs or Migrations yet, they excel at generating TypeScript code, which our
109
+
[TypeScript Data Models](https://docs.servicestack.net/autoquery/okai-models) feature can take advantage of by generating all the C# AutoQuery CRUD APIs and DB Migrations needing to support it.
We'll quickly cover the common dev workflow for this feature.
132
+
133
+
To create a new Table use `init <Table>`, e.g:
134
+
135
+
:::copy
136
+
npx okai init Transaction
137
+
:::
138
+
139
+
This will generate an empty `MyApp.ServiceModel/<Table>.d.ts` file along with stub AutoQuery APIs and DB Migration implementations.
140
+
141
+
#### Regenerate AutoQuery APIs and DB Migrations
142
+
143
+
After modifying the TypeScript Data Model to include the desired fields, you can re-run the `okai` tool to generate the AutoQuery APIs and DB Migrations
144
+
(which can be run anywhere within your Solution):
145
+
146
+
:::copy
147
+
npx okai Transaction.d.ts
148
+
:::
149
+
150
+
After you're happy with your Data Model you can run DB Migrations to run the DB Migration and create your RDBMS Table:
151
+
152
+
:::copy
153
+
npm run migrate
154
+
:::
155
+
156
+
#### Making changes after first migration
157
+
158
+
If you want to make further changes to your Data Model, you can re-run the `okai` tool to update the AutoQuery APIs and DB Migrations, then run the `rerun:last` npm script to drop and re-run the last migration:
159
+
160
+
:::copy
161
+
npm run rerun:last
162
+
:::
163
+
164
+
#### Removing a Data Model and all generated code
165
+
166
+
If you changed your mind and want to get rid of the RDBMS Table you can revert the last migration:
167
+
168
+
:::copy
169
+
npm run revert:last
170
+
:::
171
+
172
+
Which will drop the table and then you can get rid of the AutoQuery APIs, DB Migrations and TypeScript Data model with:
173
+
174
+
:::copy
175
+
npx okai rm Transaction.d.ts
176
+
:::
177
+
178
+
## AI-First Example
179
+
180
+
There are a number of options for starting with an AI generated Application, with all the Instant AI App Generators like
181
+
[Google's App Studio](https://aistudio.google.com/apps) able to provide a great starting point. Although currently Professional Developers tend to use
182
+
[Cursor](https://cursor.com/), [Claude Code](https://www.claude.com/product/claude-code) or
183
+
[Codex](https://openai.com/codex/) as their day-to-day tools of choice.
184
+
185
+
### Use GitHub Copilot when creating a new Repository
186
+
187
+
If you're using [GitHub Copilot](https://copilot.github.com/) you can also use it to generate a new App
188
+
[from the Vite React template ](https://github.com/new?template_name=react-vite&template_owner=NetCoreTemplates):
For the example, I've started with a useful App that I've never created before, a Budget Planner App, using the prompt:
193
+
194
+
### Budget Planner Prompt
195
+
196
+
```
197
+
- React 19, TypeScript, TailwindCSS v4
198
+
- Persistence in IndexedDB/localStorage
199
+
- Recharts
200
+
- Vitest with React Testing Library
201
+
202
+
## Features
203
+
Dashboard
204
+
- Overview of total income, expenses, and remaining budget
205
+
- Monthly summary chart (line graph)
206
+
- Expense categories (pie chart)
207
+
208
+
Transactions
209
+
- Add/Edit/Delete income or expenses
210
+
- Date filtering/sorting
211
+
212
+
Budgets
213
+
- Set monthly budget goals per category
214
+
- Progress bars for spending vs. budget
215
+
216
+
Reports
217
+
- View past months
218
+
- Export
219
+
```
220
+
221
+
The generated source code for the App was uploaded to: [github.com/mythz/budgets.apps.cafe](https://github.com/mythz/budgets.apps.cafe)
222
+
223
+
### Budgent Planner App
224
+
225
+
After a few minutes Copilot creates a PR with what we asked for, even things that we didn't specify in the prompt but could be inferred from the Project Template like **Dark Mode** support where it made use of the existing `<DarkModeToggle />`.
Input: “Uber to work” → Suggests category: Transport
252
+
253
+
Implementation:
254
+
255
+
Maintain a small local list of common keywords + categories.
256
+
Pre-fill category in the transaction form as the user types in the Description.
257
+
258
+
Which resulted in [this commit](https://github.com/mythz/budgets.apps.cafe/commit/e45a17b8dfd2b5983971554ced3e52ded6fa050e) which sees the feature available in the UI:
Combined with Vite's instant hot-reload, this creates a remarkably fluid development experience where
272
+
we get to watch our prompts materialize into working features in real-time.
273
+
274
+
All this to say that this new development model exists today, and given its significant productivity gains, it's
275
+
very likely to become the future of software development, especially for UIs. Since developers are no longer
276
+
the primary authors of code, our UI choices swing from Developer preferences to UI technologies that AI models
277
+
excel at.
278
+
279
+
So whilst we have a preference for Vue given it's more readable syntax and progressive enhancement capabalities, and whilst .NET ecosystem has a strong bias towards Blazor, we're even more excited for the future of React and are committed to providing the best possible support for it.
0 commit comments