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: README.md
+41-87Lines changed: 41 additions & 87 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,125 +9,79 @@ Celest is the Flutter cloud platform. We enable Flutter and Dart developers to d
9
9
10
10
And to stay up-to-date on the future of Celest, including full server-side rendered Flutter apps, join our newsletter at [celest.dev](https://www.celest.dev/#stay-up-to-date).
11
11
12
-
## Getting started with Celest
12
+
## Getting Started
13
13
14
-
### Prerequisites
14
+
To get started with Celest, you'll need to configure your development environment so that you have Flutter and the Celest CLI installed on your machine.
15
15
16
-
To use Celest in your Flutter app, you need the following prerequisites:
16
+
1. Install [Flutter](https://docs.flutter.dev/get-started/install) from the official website
17
+
3.[Download](https://celest.dev/download) and install the Celest CLI
2. Create a new Flutter project (or choose an existing one)
20
-
3.[Download](https://celest.dev/docs/download) and install the Celest CLI
19
+
### Creating a project
21
20
22
-
### Creating a Celest project
21
+
Once you have the CLI installed, you can create a new project by running the following command:
23
22
24
-
That’s it! You are now ready to start building your backend - all in Dart!
25
-
26
-
Start by first creating a new Flutter project. If you have an existing Flutter project, you can use that instead. To start a new Flutter project, go to your console and run the following command.
27
-
28
-
```shell
29
-
$ flutter create <flutter_app>
30
-
```
31
-
32
-
Then, navigate to your new Flutter app directory.
33
-
34
-
```shell
35
-
$ cd<flutter_app>
23
+
```bash
24
+
$ celest init
36
25
```
26
+
You can run this command from within your Flutter project which will create a new `celest/` directory for your project. Or you can run
27
+
this in another directory to have a standalone Celest project.
37
28
38
-
Once you are in your Flutter app directory, run the following command to initialize your Celest project.
29
+
Once you have a project, run `celest start`to start a local development environment.
39
30
40
-
```shell
31
+
```bash
41
32
$ celest start
33
+
✓ Celest is running on http://localhost:7777
42
34
```
43
35
44
-
Once the command executes, Celest will spin up a local environment and watch for changes made to your backend, generating a Dart client for you to test your changes.
45
-
46
-
The CLI will also create a folder in your project called `celest`, which will include the following files.
47
-
48
-
```shell
49
-
flutter_app/
50
-
└── celest/
51
-
├── functions/ # Celest Functions folder
52
-
| └── greeting.dart # Example API file
53
-
├── lib/
54
-
│ │── client.dart # Generated client for your Flutter app
55
-
│ ├── models/ # Custom API models
56
-
|| └── person.dart
57
-
│ └── exceptions/ # Custom API exceptions
58
-
| └── bad_name_exception.dart
59
-
└── test/ # Tests for your backend
60
-
```
36
+
This command will start a local server which will run in the background as you write your backend logic. As you make changes to the files in the `celest/` directory,
37
+
the server will hot-reload those changes so you can see them live.
61
38
62
-
To start building your serverless cloud function, navigate to the `my_celest_app/celest/functions/` folder and create a file named `<api_name>.dart`. You can create as many APIs as you want in this directory.
63
-
Each file groups and organizes multiple Celest Functions of similar functionality into a namespace.
39
+
To interact with the running environment, Celest will generate a Dart client which you can use in any Dart or Flutter project. This client
40
+
is generated in the `client/` directory of your `celest/` folder. As you make changes in the local environment, this client will be updated to reflect those changes.
64
41
65
-
Celest Functions are defined as top-level functions as shown below.
42
+
### Example
43
+
44
+
Here is an example of a simple Celest function:
66
45
67
46
```dart
47
+
import 'package:celest/celest.dart';
48
+
68
49
@cloud
69
50
Future<String> sayHello(String name) async {
51
+
print('Saying hello to $name');
70
52
return 'Hello, $name';
71
53
}
72
-
73
-
@cloud
74
-
Future<String> sayGoodbye(String name) async {
75
-
return 'Goodbye, $name';
76
-
}
77
54
```
78
55
79
-
That's all you need to define your API! Now, you can connect your Flutter app to your cloud functions by using the Celest client as shown in the following example. Replace the contents of the `main.dart` file in your Flutter app to the following code-snippet.
56
+
This function can be called from a Dart project like so:
final response = await celest.functions.sayHello('World');
64
+
print(response); // Hello, World
117
65
}
118
66
```
119
67
120
-
You have now set up your Celest project and integrated it into your Flutter app. Follow our [documentation](https://celest.dev/docs/functions/introduction) to learn more about using Celest Functions.
68
+
## What's Next?
69
+
70
+
In addition to Dart cloud functions, Celest offers authentication and database services out-of-the-box. To learn more about these features,
71
+
and to see what else you can do with cloud functions, visit our [docs](https://celest.dev/docs) and explore the different examples and
Celest is the Flutter cloud platform, enabling Flutter and Dart developers to define their backend infrastructure purely in Dart.
3
+
Celest is the Flutter cloud platform, enabling Dart and Flutter developers to define their backend infrastructure purely in Dart.
4
4
5
-
**This package is not intended to be used directly.** It is used by the Celest CLI to generate code for your backend. To learn more about how to use this package and integrate it with the Celest CLI, visit our [documentation](https://celest.dev/docs).
5
+
Celest offers a simple and intuitive way to define cloud functions, authentication, and database services. With Celest, you can build full-stack Flutter applications with ease,
6
+
all while using the same language and tools you already know.
7
+
8
+
## Getting Started
9
+
10
+
To get started with Celest, you need to install the Celest CLI. You can do this by downloading the latest release from our [website](https://celest.dev/download).
11
+
12
+
Once you have the CLI installed, you can create a new project by running the following command:
13
+
14
+
```bash
15
+
$ celest init
16
+
```
17
+
You can run this command from within your Flutter project which will create a new `celest/` directory for your project. Or you can run
18
+
this in another directory to have a standalone Celest project.
19
+
20
+
Once you have a project, run `celest start` to start a local development environment.
21
+
22
+
```bash
23
+
$ celest start
24
+
✓ Celest is running on http://localhost:7777
25
+
```
26
+
27
+
This command will start a local server which will run in the background as you write your backend logic. As you make changes to the files in the `celest/` directory,
28
+
the server will hot-reload those changes so you can see them live.
29
+
30
+
To interact with the running environment, Celest will generate a Dart client which you can use in any Dart or Flutter project. This client
31
+
is generated in the `client/` directory of your `celest/` folder. As you make changes in the local environment, this client will be updated to reflect those changes.
32
+
33
+
### Example
34
+
35
+
Here is an example of a simple Celest function:
36
+
37
+
```dart
38
+
import 'package:celest/celest.dart';
39
+
40
+
@cloud
41
+
Future<String> sayHello(String name) async {
42
+
print('Saying hello to $name');
43
+
return 'Hello, $name';
44
+
}
45
+
```
46
+
47
+
This function can be called from a Dart project like so:
0 commit comments