$npx -y skills add adrianhajdin/skild --skill firebase-data-connectBuild and deploy Firebase Data Connect backends with PostgreSQL. Use for schema design, GraphQL queries/mutations, authorization, and SDK generation for web, Android, iOS, and Flutter apps.
| 1 | # Firebase Data Connect |
| 2 | |
| 3 | Firebase Data Connect is a relational database service using Cloud SQL for PostgreSQL with GraphQL schema, auto-generated queries/mutations, and type-safe SDKs. |
| 4 | |
| 5 | ## Project Structure |
| 6 | |
| 7 | ``` |
| 8 | dataconnect/ |
| 9 | ├── dataconnect.yaml # Service configuration |
| 10 | ├── schema/ |
| 11 | │ └── schema.gql # Data model (types with @table) |
| 12 | └── connector/ |
| 13 | ├── connector.yaml # Connector config + SDK generation |
| 14 | ├── queries.gql # Queries |
| 15 | └── mutations.gql # Mutations |
| 16 | ``` |
| 17 | |
| 18 | ## Development Workflow |
| 19 | |
| 20 | Follow this strict workflow to build your application. You **must** read the linked reference files for each step to understand the syntax and available features. |
| 21 | |
| 22 | ### 1. Define Data Model (`schema/schema.gql`) |
| 23 | Define your GraphQL types, tables, and relationships. |
| 24 | > **Read [reference/schema.md](reference/schema.md)** for: |
| 25 | > * `@table`, `@col`, `@default` |
| 26 | > * Relationships (`@ref`, one-to-many, many-to-many) |
| 27 | > * Data types (UUID, Vector, JSON, etc.) |
| 28 | |
| 29 | ### 2. Define Operations (`connector/queries.gql`, `connector/mutations.gql`) |
| 30 | Write the queries and mutations your client will use. Data Connect generates the underlying SQL. |
| 31 | > **Read [reference/operations.md](reference/operations.md)** for: |
| 32 | > * **Queries**: Filtering (`where`), Ordering (`orderBy`), Pagination (`limit`/`offset`). |
| 33 | > * **Mutations**: Create (`_insert`), Update (`_update`), Delete (`_delete`). |
| 34 | > * **Upserts**: Use `_upsert` to "insert or update" records (CRITICAL for user profiles). |
| 35 | > * **Transactions**: use `@transaction` for multi-step atomic operations. |
| 36 | |
| 37 | ### 3. Secure Your App (`connector/` files) |
| 38 | Add authorization logic closely with your operations. |
| 39 | > **Read [reference/security.md](reference/security.md)** for: |
| 40 | > * `@auth(level: ...)` for PUBLIC, USER, or NO_ACCESS. |
| 41 | > * `@check` and `@redact` for row-level security and validation. |
| 42 | |
| 43 | ### 4. Generate & Use SDKs |
| 44 | Generate type-safe code for your client platform. |
| 45 | > **Read [reference/sdks.md](reference/sdks.md)** for: |
| 46 | > * Android (Kotlin), iOS (Swift), Web (TypeScript), Flutter (Dart). |
| 47 | > * How to initialize and call your queries/mutations. |
| 48 | > * **Nested Data**: See how to access related fields (e.g., `movie.reviews`). |
| 49 | |
| 50 | --- |
| 51 | |
| 52 | ## Feature Capability Map |
| 53 | |
| 54 | If you need to implement a specific feature, consult the mapped reference file: |
| 55 | |
| 56 | | Feature | Reference File | Key Concepts | |
| 57 | | :--- | :--- | :--- | |
| 58 | | **Data Modeling** | [reference/schema.md](reference/schema.md) | `@table`, `@unique`, `@index`, Relations | |
| 59 | | **Vector Search** | [reference/advanced.md](reference/advanced.md) | `Vector`, `@col(dataType: "vector")` | |
| 60 | | **Full-Text Search** | [reference/advanced.md](reference/advanced.md) | `@searchable` | |
| 61 | | **Upserting Data** | [reference/operations.md](reference/operations.md) | `_upsert` mutations | |
| 62 | | **Complex Filters** | [reference/operations.md](reference/operations.md) | `_or`, `_and`, `_not`, `eq`, `contains` | |
| 63 | | **Transactions** | [reference/operations.md](reference/operations.md) | `@transaction`, `response` binding | |
| 64 | | **Environment Config** | [reference/config.md](reference/config.md) | `dataconnect.yaml`, `connector.yaml` | |
| 65 | |
| 66 | --- |
| 67 | |
| 68 | ## Deployment & CLI |
| 69 | |
| 70 | > **Read [reference/config.md](reference/config.md)** for deep dive on configuration. |
| 71 | |
| 72 | Common commands (run from project root): |
| 73 | |
| 74 | ```bash |
| 75 | # Initialize Data Connect |
| 76 | npx -y firebase-tools@latest init dataconnect |
| 77 | |
| 78 | # Start local emulator |
| 79 | npx -y firebase-tools@latest emulators:start --only dataconnect |
| 80 | |
| 81 | # Generate SDK code |
| 82 | npx -y firebase-tools@latest dataconnect:sdk:generate |
| 83 | |
| 84 | # Deploy to production |
| 85 | npx -y firebase-tools@latest deploy --only dataconnect |
| 86 | ``` |
| 87 | |
| 88 | ## Examples |
| 89 | |
| 90 | For complete, working code examples of schemas and operations, see **[examples.md](examples.md)**. |