Docs
Folder Structure

Folder structure

Every Celest project uses a standard folder structure for defining the different parts of your backend.

my_project/
└── celest/
    ├── pubspec.yaml                      # (1) Dependencies for your backend
    │
    ├── client/                           # (2) Generated Dart client
    │   ├── pubspec.yaml
    │   └── my_project_client.dart
    │
    └── lib/src/                          # (3) Your backend code           
        │── project.dart                  # (4) Project configuration
        └── functions/                    # (5) Cloud functions
            └── orders_api.dart
            └── shipping_api.dart

The folder structure should look very familiar. The celest/ directory is just a Dart package, and the lib/src/ directory is where you will define all of your backend logic. Of note:

  • (1) The pubspec.yaml file in the celest/ directory is where you define your dependencies for your backend. These dependencies are separate from both your generated client's dependencies and your Flutter project's dependencies.

  • (2) The client/ directory is where the Dart client is generated. This client is used to interact with your backend from your Dart or Flutter app. As the client is generated by the CLI, you should not modify it directly.

  • (3) The lib/src/ directory is where you define your backend logic. This is where you will define your cloud functions, data models, and any other backend logic.

  • (4) The project.dart file is where you define your project configuration. This file is where you define your project name, and any other project-wide configuration. Any project-level configuration must be placed in this file.

  • (5) The functions/ directory is where you define your cloud functions. Each file in this directory groups and organizes multiple Celest Functions of similar functionality into a namespace called an API.

    All of your Cloud Functions must be defined in the lib/src/functions folder for Celest to recognize them.

Outside of the project.dart and functions/ directories, you can create any other directories and files you need to organize your backend logic however you like.