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: docs/01-get-started/01-creating-endpoints.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,8 @@ development:
38
38
Next, we add the Dartantic AI package as a dependency to our server. This package provides a convenient interface for working with different AI providers, including Google's Gemini API.
39
39
40
40
```bash
41
-
$ cd magic_recipe_server
42
-
$ dart pub add dartantic_ai
41
+
cd magic_recipe_server
42
+
dart pub add dartantic_ai
43
43
```
44
44
45
45
## Create a new endpoint
@@ -100,8 +100,8 @@ For methods to be recognized by Serverpod, they need to return a typed `Future`
100
100
Now, you need to generate the code for your new endpoint. You do this by running `serverpod generate` in the server directory of your project:
101
101
102
102
```bash
103
-
$ cd magic_recipe_server
104
-
$ serverpod generate
103
+
cd magic_recipe_server
104
+
serverpod generate
105
105
```
106
106
107
107
`serverpod generate` will create bindings for the endpoint and register them in the server's `generated/protocol.dart` file. It will also generate the required client code so that you can call your new `generateRecipe` method from your app.
@@ -221,16 +221,16 @@ Before you start your server, ensure no other Serverpod server is running. Also,
221
221
Let's try our new recipe app! First, start the server:
Copy file name to clipboardExpand all lines: docs/01-get-started/02-models-and-data.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,8 @@ You can use most primitive Dart types here or any other models you have specifie
34
34
To generate the code for the model, run the `serverpod generate` command in your server directory:
35
35
36
36
```bash
37
-
$ cd magic_recipe_server
38
-
$ serverpod generate
37
+
cd magic_recipe_server
38
+
serverpod generate
39
39
```
40
40
41
41
This will generate the code for the model and create a new file called `recipe.dart` in the `lib/src/generated` directory. It will also update the client code in `magic_recipe/magic_recipe_client` so you can use it in your Flutter app.
@@ -133,8 +133,8 @@ class RecipeEndpoint extends Endpoint {
133
133
First, we need to update our generated client by running `serverpod generate`.
134
134
135
135
```bash
136
-
$ cd magic_recipe_server
137
-
$ serverpod generate
136
+
cd magic_recipe_server
137
+
serverpod generate
138
138
```
139
139
140
140
Now that we have created the `Recipe` model we can use it in the app. We will do this in the `_callGenerateRecipe` method of the `magic_recipe_flutter/lib/main.dart` file. Let's update our `RecipeWidget` so that it displays the author and year of the recipe in addition to the recipe itself.
@@ -433,16 +433,16 @@ class ResultDisplay extends StatelessWidget {
433
433
First, start the server:
434
434
435
435
```bash
436
-
$ cd magic_recipe_server
437
-
$ docker compose up -d
438
-
$ dart bin/main.dart
436
+
cd magic_recipe_server
437
+
docker compose up -d
438
+
dart bin/main.dart
439
439
```
440
440
441
441
Then, start the Flutter app:
442
442
443
443
```bash
444
-
$ cd magic_recipe_flutter
445
-
$ flutter run -d chrome
444
+
cd magic_recipe_flutter
445
+
flutter run -d chrome
446
446
```
447
447
448
448
This will start the Flutter app in your browser. It should look something like this:
Copy file name to clipboardExpand all lines: docs/01-get-started/03-working-with-the-database.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,9 +42,9 @@ To create a migration, follow these two steps in order:
42
42
2. Run `serverpod create-migration` to create the necessary database migration.
43
43
44
44
```bash
45
-
$ cd magic_recipe_server
46
-
$ serverpod generate
47
-
$ serverpod create-migration
45
+
cd magic_recipe_server
46
+
serverpod generate
47
+
serverpod create-migration
48
48
```
49
49
50
50
Each time you run `serverpod create-migration`, a new migration file will be created in your _migrations_ folder. These step-by-step migrations provide a history of your database changes and allow you to roll back changes if needed.
@@ -190,8 +190,8 @@ The `insertRow` method is used to insert a new row into the database. The `find`
190
190
Like before, when you change something that has an effect on your client code, you need to run `serverpod generate`. We don't need to run `serverpod create-migrations` again because we already created a migration in the previous step and haven't done any changes that affect the database.
191
191
192
192
```bash
193
-
$ cd magic_recipe_server
194
-
$ serverpod generate
193
+
cd magic_recipe_server
194
+
serverpod generate
195
195
```
196
196
197
197
## Call the endpoint from the app
@@ -434,9 +434,9 @@ To run the application with database support, follow these steps in order:
434
434
First, start the database and apply migrations:
435
435
436
436
```bash
437
-
$ cd magic_recipe_server
438
-
$ docker compose up -d # Start the database container
439
-
$ dart bin/main.dart --apply-migrations # Apply any pending migrations
437
+
cd magic_recipe_server
438
+
docker compose up -d # Start the database container
439
+
dart bin/main.dart --apply-migrations # Apply any pending migrations
440
440
```
441
441
442
442
:::tip
@@ -446,8 +446,8 @@ The `--apply-migrations` flag is safe to use during development - if no migratio
Copy file name to clipboardExpand all lines: docs/06-concepts/06-database/01-connection.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,19 +100,19 @@ development:
100
100
A newly created Serverpod project has a preconfigured Docker instance with a Postgres database set up. Run the following command from the root of the `server` package to start the database:
101
101
102
102
```bash
103
-
$ docker compose up --build --detach
103
+
docker compose up --build --detach
104
104
```
105
105
106
106
To stop the database run:
107
107
108
108
```bash
109
-
$ docker compose stop
109
+
docker compose stop
110
110
```
111
111
112
112
To remove the database and __delete__ all associated data, run:
Copy file name to clipboardExpand all lines: docs/06-concepts/06-database/11-migrations.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ If you want to transition a manually managed table to then be managed by Serverp
28
28
To create a migration navigate to your project's `server` package directory and run the `create-migration` command.
29
29
30
30
```bash
31
-
$ serverpod create-migration
31
+
serverpod create-migration
32
32
```
33
33
34
34
The command reads the database schema from the last migration, then compares it to the database schema necessary to accommodate the projects, and any module dependencies, current database requirements. If differences are identified, a new migration is created in the `migrations` directory to roll the database forward.
@@ -47,15 +47,15 @@ The migration command aborts and displays an error under two conditions:
47
47
To override these safeguards and force the creation of a migration, use the `--force` flag.
48
48
49
49
```bash
50
-
$ serverpod create-migration --force
50
+
serverpod create-migration --force
51
51
```
52
52
53
53
### Tag migration
54
54
55
55
Tags can be useful to identify migrations that introduced specific changes to the project. Tags are appended to the migration name and can be added with the `--tag` option.
56
56
57
57
```bash
58
-
$ serverpod create-migration --tag "v1-0-0"
58
+
serverpod create-migration --tag "v1-0-0"
59
59
```
60
60
61
61
This would create a migration named `<timestamp>-v1-0-0`:
@@ -97,13 +97,13 @@ For each migration, five files are created:
97
97
Migrations are applied using the server runtime. To apply migrations, navigate to your project's `server` package directory, then start the server with the `--apply-migrations` flag. Migrations are applied as part of the startup sequence and the framework asserts that each migration is only applied once to the database.
98
98
99
99
```bash
100
-
$ dart run bin/main.dart --apply-migrations
100
+
dart run bin/main.dart --apply-migrations
101
101
```
102
102
103
103
Migrations can also be applied using the maintenance role. In maintenance, after migrations are applied, the server exits with an exit code indicating if migrations were successfully applied, zero for success or non-zero for failure.
104
104
105
105
```bash
106
-
$ dart run bin/main.dart --role maintenance --apply-migrations
106
+
dart run bin/main.dart --role maintenance --apply-migrations
107
107
```
108
108
109
109
This is useful if migrations are applied as part of an automated process.
@@ -119,7 +119,7 @@ By default, the command connects to and pulls a live database schema from a runn
119
119
To create a repair migration, navigate to your project's `server` package directory and run the `create-repair-migration` command.
120
120
121
121
```bash
122
-
$ serverpod create-repair-migration
122
+
serverpod create-repair-migration
123
123
```
124
124
125
125
This creates a repair migration in the `repair-migration` directory targeting the project's latest migration.
@@ -137,7 +137,7 @@ Since each repair migration is created for a specific live database schema, Serv
137
137
By default, the repair migration system connects to your `development` database using the information specified in your Serverpod config. To use a different database source, the `--mode` option is used.
138
138
139
139
```bash
140
-
$ serverpod create-repair-migration --mode production
140
+
serverpod create-repair-migration --mode production
141
141
```
142
142
143
143
The command connects and pulls the live database schema from a running server.
@@ -147,7 +147,7 @@ The command connects and pulls the live database schema from a running server.
147
147
Repair migrations can also target a specific migration version by specifying the migration name with the `--version` option.
This would create a repair migration named `<timestamp>-reset-migrations` in the `repair` directory:
@@ -194,13 +194,13 @@ The `repair` directory only exists if a repair migration has been created and co
194
194
The repair migration is applied using the server runtime. To apply a repair migration, start the server with the `--apply-repair-migration` flag. The repair migration is applied as part of the startup sequence and the framework asserts that each repair migration is only applied once to the database.
195
195
196
196
```bash
197
-
$ dart run bin/main.dart --apply-repair-migration
197
+
dart run bin/main.dart --apply-repair-migration
198
198
```
199
199
200
200
The repair migration can also be applied using the maintenance role. In maintenance, after migrations are applied, the server exits with an exit code indicating if migrations were successfully applied, zero for success or non-zero for failure.
201
201
202
202
```bash
203
-
$ dart run bin/main.dart --role maintenance --apply-repair-migration
203
+
dart run bin/main.dart --role maintenance --apply-repair-migration
204
204
```
205
205
206
206
If a repair migration is applied at the same time as migrations, the repair migration is applied first.
@@ -214,11 +214,11 @@ Note that data is not rolled back, only the database schema.
214
214
To roll back to a previous migration, first create a repair migration targeting the desired migration version:
Copy file name to clipboardExpand all lines: docs/06-concepts/10-modules.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,15 +32,15 @@ modules:
32
32
Then run `pub get` and `serverpod generate` from your server's directory (e.g., `mypod_server`) to add the module to your project's deserializer.
33
33
34
34
```bash
35
-
$ dart pub get
36
-
$ serverpod generate
35
+
dart pub get
36
+
serverpod generate
37
37
```
38
38
39
39
Finally, since modules might include modifications to the database schema, you should create a new database migration and apply it by running `serverpod create-migration` then `dart bin/main.dart --apply-migrations` from your server's directory.
40
40
41
41
```bash
42
-
$ serverpod create-migration
43
-
$ dart bin/main.dart --apply-migrations
42
+
serverpod create-migration
43
+
dart bin/main.dart --apply-migrations
44
44
```
45
45
46
46
### Client setup
@@ -79,13 +79,13 @@ fields:
79
79
With the `serverpod create` command, it is possible to create new modules for code that is shared between projects or that you want to publish to pub.dev. To create a module instead of a server project, pass `module` to the `--template` flag.
80
80
81
81
```bash
82
-
$ serverpod create --template module my_module
82
+
serverpod create --template module my_module
83
83
```
84
84
85
85
The create command will create a server and a client Dart package. If you also want to add custom Flutter code, use `flutter create` to create a package.
Copy file name to clipboardExpand all lines: docs/06-concepts/11-authentication/04-providers/03-google/01-setup.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,7 +190,7 @@ If your `google-services.json` does not include a web OAuth client entry, you ma
190
190
For a production app you need to get the SHA-1 key from your production keystore! This can be done by running this command: ([Read more](https://support.google.com/cloud/answer/6158849#installedapplications&android&zippy=%2Cnative-applications%2Candroid)).
191
191
192
192
```bash
193
-
$ keytool -list -v -keystore /path/to/keystore
193
+
keytool -list -v -keystore /path/to/keystore
194
194
```
195
195
:::
196
196
@@ -208,7 +208,7 @@ Navigate to _Clients_ and select the server credentials (the one configured as a
208
208
Force flutter to run on a specific port by running.
Copy file name to clipboardExpand all lines: docs/06-concepts/11-authentication/11-legacy/01-setup.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Serverpod's auth module makes it easy to authenticate users through email or 3rd
15
15
Add the module as a dependency to the server project's `pubspec.yaml`.
16
16
17
17
```sh
18
-
$ dart pub add serverpod_auth_server
18
+
dart pub add serverpod_auth_server
19
19
```
20
20
21
21
Add the authentication handler to the Serverpod instance.
@@ -46,27 +46,27 @@ modules:
46
46
While still in the server project, generate the client code and endpoint methods for the auth module by running the `serverpod generate` command line tool.
47
47
48
48
```bash
49
-
$ serverpod generate
49
+
serverpod generate
50
50
```
51
51
52
52
### Initialize the auth database
53
53
54
54
After adding the module to the server project, you need to initialize the database. First you have to create a new migration that includes the auth module tables. This is done by running the `serverpod create-migration` command line tool in the server project.
55
55
56
56
```bash
57
-
$ serverpod create-migration
57
+
serverpod create-migration
58
58
```
59
59
60
60
Start your database container from the server project.
61
61
62
62
```bash
63
-
$ docker compose up --build --detach
63
+
docker compose up --build --detach
64
64
```
65
65
66
66
Then apply the migration by starting the server with the `apply-migrations` flag.
67
67
68
68
```bash
69
-
$ dart run bin/main.dart --role maintenance --apply-migrations
69
+
dart run bin/main.dart --role maintenance --apply-migrations
70
70
```
71
71
72
72
The full migration instructions can be found in the [migration guide](../../database/migrations).
Copy file name to clipboardExpand all lines: docs/06-concepts/11-authentication/11-legacy/04-providers/02-google.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ Put the file inside the `android/app/` directory and rename it to `google-servic
119
119
For a production app you need to get the SHA-1 key from your production keystore! This can be done by running this command: ([Read more](https://support.google.com/cloud/answer/6158849#installedapplications&android&zippy=%2Cnative-applications%2Candroid)).
120
120
121
121
```bash
122
-
$ keytool -list -v -keystore /path/to/keystore
122
+
keytool -list -v -keystore /path/to/keystore
123
123
```
124
124
125
125
:::
@@ -136,7 +136,7 @@ Navigate to _Credentials_ under _APIs & Services_ and select the server credenti
136
136
Force flutter to run on a specific port by running.
0 commit comments