This repository was archived by the owner on Nov 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllms-small.txt
More file actions
11958 lines (8559 loc) · 353 KB
/
llms-small.txt
File metadata and controls
11958 lines (8559 loc) · 353 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Getting Started - Introduction
<script setup>
import Icon from '../components/Icon.vue'
</script>
# Introduction
**Remult** is a fullstack CRUD framework that uses your TypeScript model types to provide:
- Secure REST API (highly configurable)
- Type-safe frontend API client
- Type-safe backend query builder
#### Use the same model classes for both frontend and backend code
With Remult it is simple to keep your code [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) and increase development speed and maintainability by defining a single TypeScript model class (for each domain object) and sharing it between your frontend and backend code.
As Remult is "aware" of the runtime context (frontend or backend), data validations and entity lifecycle hooks can be written in layer-agnostic TypeScript which will run, as needed, on either the frontend, the backend, or both.
## Choose Your Remult Learning Path
Explore the flexibility of Remult through different learning paths tailored to match your style and project needs.
### `Option A`: Start with the Interactive Online Tutorial
If you're new to Remult or prefer a guided, hands-on approach, we recommend starting with our [interactive online tutorial](https://learn.remult.dev). This tutorial will walk you through building a full-stack application step by step, providing immediate feedback and insights as you learn.
### `Option B`: Create a new Project
[`npm init remult@latest`](./creating-a-project.md)
### `Option C`: Follow a Step-by-step Tutorial
<br />
<br />
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5rem">
<Icon tech="react" sizeIco:=150 link="/tutorials/react" techName="React" />
<Icon tech="angular" sizeIco:=150 link="/tutorials/angular" techName="Angular" />
<Icon tech="vue" sizeIco:=150 link="/tutorials/vue" techName="Vue" />
<Icon tech="svelte" sizeIco:=150 link="/tutorials/sveltekit" techName="SvelteKit" />
<Icon tech="nextjs" sizeIco:=150 link="/tutorials/react-next" techName="Next.js" />
<Icon tech="solid" sizeIco:=150 link="/tutorials/solid-start" techName="SolidStart" />
</div>
### `Option D`: Quickstart
Use this [Quickstart](./quickstart.md) guide to quickly setup and try out Remult or add Remult to an existing app.
### `Option E`: Browse Example Apps
[Example Apps](./example-apps.md)
### `Option F`: Video Tutorials
Check out these official [Remult video tutorials](https://youtube.com/playlist?list=PLlcnBwFkuOn166nXXxxfL9Hee-1GWlDSm&si=TDlwIFDLi4VMi-as).
# Getting Started - Creating a project
<script setup>
import Example from '../components/Example.vue'
</script>
# Creating a Remult Project
_The easiest way to start building a Remult app_
```bash
npm init remult@latest
```
Yes, that's it!
::: tip
Let us know how you liked the process! [@remultjs](https://twitter.com/RemultJs)
:::
## Demo

## What you get ?
<!-- Remult offers a streamlined project creation process that caters to over `180` different project flavors, ensuring you'll find the perfect setup for your needs. With just a few simple questions, you will get a fully functional Remult project up and running in no time.
Here's what you can expect: -->
### 1. **Tailored Setup**
Answer a few questions about your preferred tech stack and project requirements.
`Project name`: The name of your project _(it will create a folder with this name)_
`Choose your Framework` <Example :oneline=true :react=true :angular=true :vue=true :nextjs=true :svelte=true :nuxt=true />
`Choose your Web Server` _(if needed)_ <Example :oneline=true :express=true :fastify=true />
`Choose your Database` <Example :oneline=true :json=true :postgres=true :mysql=true :sqlite=true :mongodb=true :mssql=true />
`Authentication`: Do you want to add `auth.js` to your project directly ? including a complete implementation for `credentials` and `github` providers
`Add CRUD demo`: A comprehensive example of how to use an entity. It will show you how to create, read, update and delete data.
`Admin UI`: Will then be available at `/api/admin`
### 2. **Instant Configuration**
Based on your answers, Remult will configure the project with the best-suited options. With all combinations of frameworks, servers, databases and authentication, we manage more than `180 different project flavors`! We are missing yours? Let us know !
### 3. **Feature-Rich Demo**
Once you run your project, you'll be greeted with a comprehensive dashboard that showcases all of Remult's powerful features. It will look like this:

Each tile is a fully functional example of a feature that you selected.
### 4. **Easy Eject**
Simply remove the demo folder to eject the demo components.
# Getting Started - Quickstart
# Quickstart
Jumpstart your development with this Quickstart guide. Learn to seamlessly integrate Remult in various stacks, from installation to defining entities for efficient data querying and manipulation.
### Experience Remult with an Interactive Tutorial
For a guided, hands-on experience, [try our interactive online tutorial](https://learn.remult.dev/). It's the fastest way to get up and running with Remult and understand its powerful features.
## Installation
The _remult_ package is all you need for both frontend and backend code. If you're using one `package.json` for both frontend and backend (or a meta-framework) - **install Remult once** in the project's root folder. If you're using multiple `package.json` files (monorepo) - **install Remult in both server and client folders**.
::: code-group
```sh [npm]
npm install remult
```
```sh [yarn]
yarn add remult
```
```sh [pnpm]
pnpm add remult
```
```sh [bun]
bun add remult
```
:::
## Server-side Initialization
Remult is initialized on the server-side as a request handling middleware, with **a single line of code**. Here is the code for setting up the Remult middleware:
::: code-group
```ts [Express]
import express from 'express'
import { remultApi } from 'remult/remult-express'
const app = express()
app.use(remultApi({})) // [!code highlight]
app.listen(3000)
```
<!-- prettier-ignore-start -->
```ts [Fastify]
import fastify from 'fastify'
import { remultApi } from 'remult/remult-fastify'
(async () => {
const server = fastify()
await server.register(remultApi({})) // [!code highlight]
server.listen({ port: 3000 })
})()
```
<!-- prettier-ignore-end -->
```ts [Next.js]
// src/app/api/[...remult]/route.ts
import { remultApi } from 'remult/remult-next'
export const api = remultApi({}) // [!code highlight]
export const { GET, POST, PUT, DELETE } = api
```
```ts [Sveltekit]
// src/routes/api/[...remult]/+server.ts
import { remultApi } from 'remult/remult-sveltekit'
export const _api = remultApi({}) // [!code highlight]
export const { GET, POST, PUT, DELETE } = _api
```
```ts [nuxt.js]
// server/api/[...remult].ts
import { remultApi } from 'remult/remult-nuxt'
export const api = remultApi({})
export default defineEventHandler(api)
// enable experimental decorators
// Add to nuxt.config.ts
nitro: {
esbuild: {
options: {
tsconfigRaw: {
compilerOptions: {
experimentalDecorators: true,
},
},
},
},
},
vite: {
esbuild: {
tsconfigRaw: {
compilerOptions: {
experimentalDecorators: true,
},
},
},
},
```
<!-- prettier-ignore-start -->
```ts [Hapi]
import { type Plugin, server } from '@hapi/hapi'
import { remultApi } from 'remult/remult-hapi'
(async () => {
const hapi = server({ port: 3000 })
await hapi.register(remultApi({})) // [!code highlight]
hapi.start()
})()
```
<!-- prettier-ignore-end -->
```ts [Hono]
import { Hono } from 'hono'
import { serve } from '@hono/node-server'
import { remultApi } from 'remult/remult-hono'
const app = new Hono()
const api = remultApi({}) // [!code highlight]
app.route('', api) // [!code highlight]
serve(app)
```
```ts [Nest]
// src/main.ts
import { remultApi } from 'remult/remult-express'
async function bootstrap() {
const app = await NestFactory.create(AppModule)
app.use(remultApi({})) // [!code highlight]
await app.listen(3000)
}
bootstrap()
```
```ts{9-17} [Koa]
import * as koa from 'koa'
import * as bodyParser from 'koa-bodyparser'
import { createRemultServer } from 'remult/server'
const app = new koa()
app.use(bodyParser())
const api = createRemultServer({})
app.use(async (ctx, next) => {
const r = await api.handle(ctx.request)
if (r) {
ctx.response.body = r.data
ctx.response.status = r.statusCode
} else return await next()
})
app.listen(3000, () => {})
```
:::
## Connecting a Database
Use the `dataProvider` property of Remult's server middleware to set up a database connection for Remult.
::: tip Recommended - Use default local JSON files and connect a database later
If the `dataProvider` property is not set, Remult stores data as JSON files under the `./db` folder.
:::
Here are examples of connecting to some commonly used back-end databases:
::: tabs
== Postgres
Install node-postgres:
```sh
npm i pg
```
Set the `dataProvider` property:
```ts{3,7,11-15}
import express from "express"
import { remultApi } from "remult/remult-express"
import { createPostgresDataProvider } from "remult/postgres"
const app = express()
const connectionString = "postgres://user:password@host:5432/database"
app.use(
remultApi({
dataProvider:
createPostgresDataProvider({
connectionString, // default: process.env["DATABASE_URL"]
// configuration: {} // optional = a `pg.PoolConfig` object or "heroku"
})
})
)
```
Or use your existing postgres connection
```ts
import { Pool } from 'pg'
import { SqlDatabase } from 'remult'
import { PostgresDataProvider } from 'remult/postgres'
import { remultApi } from 'remult/remult-express'
const pg = new Pool({
connectionString: '....',
})
const app = express()
app.use(
remultApi({
dataProvider: new SqlDatabase(new PostgresDataProvider(pg)),
}),
)
```
== MySQL
Install knex and mysql2:
```sh
npm i knex mysql2
```
Set the `dataProvider` property:
```ts{3,9-18}
import express from "express"
import { remultApi } from "remult/remult-express"
import { createKnexDataProvider } from "remult/remult-knex"
const app = express()
app.use(
remultApi({
dataProvider: createKnexDataProvider({
// Knex client configuration for MySQL
client: "mysql2",
connection: {
user: "your_database_user",
password: "your_database_password",
host: "127.0.0.1",
database: "test"
}
})
})
)
```
Or use your existing knex provider
```ts
import express from 'express'
import { KnexDataProvider } from 'remult/remult-knex'
import { remultApi } from 'remult/remult-express'
import knex from 'knex'
const knexDb = knex({
client: '...',
connection: '...',
})
const app = express()
app.use(
remultApi({
dataProvider: new KnexDataProvider(knexDb), // [!code highlight]
}),
)
```
== MongoDB
Install mongodb:
```sh
npm i mongodb
```
Set the `dataProvider` property:
```ts{3-4,10-14}
import express from "express"
import { remultApi } from "remult/remult-express"
import { MongoClient } from "mongodb"
import { MongoDataProvider } from "remult/remult-mongo"
const app = express()
app.use(
remultApi({
dataProvider: async () => {
const client = new MongoClient("mongodb://localhost:27017/local")
await client.connect()
return new MongoDataProvider(client.db("test"), client)
}
})
)
```
== SQLite
There are several sqlite providers supported
### Better-sqlite3
Install better-sqlite3:
```sh
npm i better-sqlite3
```
Set the `dataProvider` property:
```ts
import express from 'express'
import { remultApi } from 'remult/remult-express'
import { SqlDatabase } from 'remult' // [!code highlight]
import Database from 'better-sqlite3' // [!code highlight]
import { BetterSqlite3DataProvider } from 'remult/remult-better-sqlite3' // [!code highlight]
const app = express()
app.use(
remultApi({
dataProvider: new SqlDatabase( // [!code highlight]
new BetterSqlite3DataProvider(new Database('./mydb.sqlite')), // [!code highlight]
), // [!code highlight]
}),
)
```
### sqlite3
This version of sqlite3 works even on stackblitz
Install sqlite3:
```sh
npm i sqlite3
```
Set the `dataProvider` property:
```ts
import express from 'express'
import { remultApi } from 'remult/remult-express'
import { SqlDatabase } from 'remult' // [!code highlight]
import sqlite3 from 'sqlite3' // [!code highlight]
import { Sqlite3DataProvider } from 'remult/remult-sqlite3' // [!code highlight]
const app = express()
app.use(
remultApi({
dataProvider: new SqlDatabase( // [!code highlight]
new Sqlite3DataProvider(new sqlite3.Database('./mydb.sqlite')), // [!code highlight]
), // [!code highlight]
}),
)
```
### bun:sqlite
Set the `dataProvider` property:
```ts
import express from 'express'
import { remultApi } from 'remult/remult-express'
import { SqlDatabase } from 'remult' // [!code highlight]
import { Database } from 'bun:sqlite' // [!code highlight]
import { BunSqliteDataProvider } from 'remult/remult-bun-sqlite' // [!code highlight]
const app = express()
app.use(
remultApi({
dataProvider: new SqlDatabase( // [!code highlight]
new BunSqliteDataProvider(new Database('./mydb.sqlite')), // [!code highlight]
), // [!code highlight]
}),
)
```
### sql.js
Install sqlite3:
```sh
npm i sql.js
```
Set the `dataProvider` property:
```ts
import express from 'express'
import { remultApi } from 'remult/remult-express'
import { SqlDatabase } from 'remult' // [!code highlight]
import initSqlJs from 'sql.js' // [!code highlight]
import { SqlJsDataProvider } from 'remult/remult-sql-js' // [!code highlight]
const app = express()
app.use(
remultApi({
dataProvider: new SqlDatabase( // [!code highlight]
new SqlJsDataProvider(initSqlJs().then((x) => new x.Database())), // [!code highlight]
), // [!code highlight]
}),
)
```
### Turso
Install turso:
```sh
npm install @libsql/client
```
Set the `dataProvider` property:
<!-- prettier-ignore-start -->
```ts
import express from 'express'
import { remultApi } from 'remult/remult-express'
import { SqlDatabase } from 'remult' // [!code highlight]
import { createClient } from '@libsql/client' // [!code highlight]
import { TursoDataProvider } from 'remult/remult-turso' // [!code highlight]
const app = express()
app.use(
remultApi({
dataProvider: new SqlDatabase( // [!code highlight]
new TursoDataProvider( // [!code highlight]
createClient({ // [!code highlight]
url: process.env.TURSO_DATABASE_URL, // [!code highlight]
authToken: process.env.TURSO_AUTH_TOKEN, // [!code highlight]
}), // [!code highlight]
), // [!code highlight]
), // [!code highlight]
}),
)
```
<!-- prettier-ignore-end -->
== Microsoft SQL Server
Install knex and tedious:
```sh
npm i knex tedious
```
Set the `dataProvider` property:
```ts{5,11-25}
// index.ts
import express from "express"
import { remultApi } from "remult/remult-express"
import { createKnexDataProvider } from "remult/remult-knex"
const app = express()
app.use(
remultApi({
dataProvider: createKnexDataProvider({
// Knex client configuration for MSSQL
client: "mssql",
connection: {
server: "127.0.0.1",
database: "test",
user: "your_database_user",
password: "your_database_password",
options: {
enableArithAbort: true,
encrypt: false,
instanceName: `sqlexpress`
}
}
})
})
)
```
Or use your existing knex provider
```ts
import express from 'express'
import { KnexDataProvider } from 'remult/remult-knex'
import { remultApi } from 'remult/remult-express'
import knex from 'knex'
const knexDb = knex({
client: '...',
connection: '...',
})
const app = express()
app.use(
remultApi({
dataProvider: new KnexDataProvider(knexDb), // [!code highlight]
}),
)
```
== DuckDB
Install DuckDB:
```sh
npm i @duckdb/node-api
```
Set the `dataProvider` property:
```ts
import express from 'express'
import { remultApi } from 'remult/remult-express'
import { SqlDatabase } from 'remult' // [!code highlight]
import { DuckDBInstance } from '@duckdb/node-api' // [!code highlight]
import { DuckDBDataProvider } from 'remult/remult-duckdb' // [!code highlight]
const app = express()
app.use(
remultApi({
dataProvider: new SqlDatabase( // [!code highlight]
new DuckDBDataProvider(
(await DuckDBInstance.create(':memory:')).connect(),
), // [!code highlight]
), // [!code highlight]
}),
)
```
== Oracle
Install knex and oracledb:
```sh
npm i knex oracledb
```
Set the `dataProvider` property:
```ts{5,11-19}
// index.ts
import express from "express"
import { remultApi } from "remult/remult-express"
import { createKnexDataProvider } from "remult/remult-knex"
const app = express()
app.use(
remultApi({
dataProvider: createKnexDataProvider({
// Knex client configuration for Oracle
client: "oracledb",
connection: {
user: "your_database_user",
password: "your_database_password",
connectString: "SERVER"
}
})
})
)
```
Or use your existing knex provider
```ts
import express from 'express'
import { KnexDataProvider } from 'remult/remult-knex'
import { remultApi } from 'remult/remult-express'
import knex from 'knex'
const knexDb = knex({
client: '...',
connection: '...',
})
const app = express()
app.use(
remultApi({
dataProvider: new KnexDataProvider(knexDb), // [!code highlight]
}),
)
```
== JSON Files
Set the `dataProvider` property:
```ts{5-6,12-14}
// index.ts
import express from "express"
import { remultApi } from "remult/remult-express"
import { JsonDataProvider } from "remult"
import { JsonEntityFileStorage } from "remult/server"
const app = express()
app.use(
remultApi({
dataProvider: async () =>
new JsonDataProvider(new JsonEntityFileStorage("./db"))
})
)
```
:::
## Integrate Auth
**Remult is completely unopinionated when it comes to user authentication.** You are free to use any kind of authentication mechanism, and only required to provide Remult with a [`getUser`](./ref_remultserveroptions.md#getuser) function that extracts a user object (which implements the minimal Remult `UserInfo` interface) from a request.
Here are examples of integrating some commonly used auth providers:
::: code-group
```ts [express-session]
import express from 'express'
import session from 'express-session'
import { remultApi } from 'remult/remult-express'
const app = express()
app.use(
session({
/* ... */
}),
)
app.post('/api/signIn', (req, res) => {
req.session!['user'] = { id: 1, name: 'admin', roles: ['admin'] }
})
app.use(
remultApi({
getUser: (req) => req.session!['user'], // [!code highlight]
}),
)
```
```ts{8-13} [next-auth]
// src/app/api/[...remult]/route.ts
import { remultApi } from 'remult/remult-next'
import { getServerSession } from 'next-auth'
import { authOptions } from '../auth/[...nextauth]/route'
export const api = remultApi({
getUser: async () => {
const user = (await getServerSession(authOptions))?.user
return user?.email && user?.name
? { id: user?.email, name: user?.name }
: undefined
},
})
export const { POST, PUT, DELETE, GET, withRemult } = api
```
:::
## Defining and Serving an Entity
Remult entity classes are shared between frontend and backend code.
```ts
// shared/product.ts
import { Entity, Fields } from 'remult'
@Entity('products', {
allowApiCrud: true,
allowApiDelete: 'admin',
})
export class Product {
@Fields.id()
id!: string
@Fields.string()
name = ''
@Fields.number()
unitPrice = 0
}
```
Alternatively, [generate entities](./entities-codegen-from-db-schema.md) from an existing Postgres database.
### Serve Entity CRUD API
All Remult server middleware options contain an [`entities`](./ref_remultserveroptions.md#entities) array. Use it to register your Entity.
```ts
// backend/index.ts
app.use(
remultApi({
entities: [Product], // [!code highlight]
}),
)
```
## Using your Entity on the Client
To start querying and mutating data from the client-side using Remult, use the [`repo`](./ref_remult.md#repo) function to create a [`Repository`](./ref_repository.md) object for your entity class. This approach simplifies data operations, allowing you to interact with your backend with the assurance of type safety.
```ts
// frontend/code.ts
import { repo } from 'remult'
import { Product } from '../shared/product'
const productsRepo = repo(Product)
async function playWithRemult() {
// add a new product to the backend database
await productsRepo.insert({ name: 'Tofu', unitPrice: 5 })
// fetch products from backend database
const products = await productsRepo.find({
where: { unitPrice: { '>=': 5 } },
orderBy: { name: 'asc' },
limit: 10,
})
console.log(products)
// update product data
const tofu = products.filter((p) => p.name === 'Tofu')
await productsRepo.save({ ...tofu, unitPrice: tofu.unitPrice + 5 })
// delete product
await productsRepo.delete(tofu)
}
playWithRemult()
```
## Client-side Customization
::: tip Recommended Defaults
By default, remult uses the browser's [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), and makes data API calls using the base URL `/api` (same-origin).
:::
### Changing the default API base URL
To use a different origin or base URL for API calls, set the remult object's `apiClient.url` property.
```ts
remult.apiClient.url = 'http://localhost:3002/api'
```
### Using an alternative HTTP client
Set the `remult` object's `apiClient.httpClient` property to customize the HTTP client used by Remult:
::: code-group
```ts [Axios instead of Fetch]
import axios from 'axios'
import { remult } from 'remult'
remult.apiClient.httpClient = axios
```
```ts [Angular HttpClient instead of Fetch]
//...
import { HttpClientModule, HttpClient } from '@angular/common/http'
import { remult } from 'remult'
@NgModule({
//...
imports: [
//...
HttpClientModule,
],
})
export class AppModule {
constructor(http: HttpClient) {
remult.apiClient.httpClient = http
}
}
```
:::
# Getting Started - Example Apps
<script setup>
import Example from '../components/Example.vue'
import Icon from '../components/Icon.vue'
</script>
# Example Apps
We have already a _ton_ of examples! Pick and choose the one that fits your needs 😊
## Todo MVC
<Example
imgSrc="/example-apps/todoMVC.png"
:react=true :vite=true :express=true
github="https://github.com/remult/TodoMVC-example"
codesandbox="https://codesandbox.io/s/github/remult/TodoMVC-example?file=/src/frontend/App.tsx"
/>
## CRM Demo
A fully featured CRM! Make sure to check out the link: <b>Dev / Admin</b> on top right!
<Example
imgSrc="/example-apps/CRM.png"
:react=true :vite=true :express=true :postgres=true :mui=true
live="https://crm-demo.up.railway.app/"
github="https://github.com/remult/crm-demo"
/>
## Shadcn React Table
Using remult with server side sorting, filtering, paging & CRUD
<Example
imgSrc="/example-apps/shadcn.png"
:react=true :vite=true :express=true :postgres=true :shadcn=true
live="https://table.up.railway.app/"
github="https://www.github.com/remult/remult/tree/main/examples/shadcn-react-table"
stackblitz="https://stackblitz.com/github/remult/remult/tree/main/examples/shadcn-react-table"
/>
## TanStack React Table
Example of using remult with react table - most basic design, with server side sorting, paging & filtering
<Example
title='TanStack React Table'
imgSrc="/example-apps/tanStack.png"