Code Monkey home page Code Monkey logo

platformatic's Introduction

The Platformatic logo

CI Documentation js-standard-style NPM version Discord


The Open Source Toolkit for Node.js

Platformatic's Open Source toolkit helps you build modern Node.js
applications without the endless loop of setup and maintenance.


How does it work?

Platformatic puts Node development on autopilot, with:

  • 🧱 Opinionated structures and composable templates
  • 🔋 Batteries-included API setup
  • 📄 Out-of-the-box documentation, logs, and metrics
  • ⚙️ Shareable and reusable configurations

Ready to get started?

Install


# Create a new application
npm create platformatic@latest

# Or install manually:
npm install platformatic

Follow our Quick Start Guide to get up and running with Platformatic.

Documentation


Check out our full documentation at docs.platformatic.dev.

Support


Join our community on Discord. For a dedicated support, explore our Enterprise Plans

Platformatic for Teams


Find out more about the enterprise command center that simplifies the development, management and operations of your Node.js apps at platformaticHQ.com.

Command Center

Issues

If you run into a bug or have a suggestion for improvement, please raise an issue on GitHub or join our Discord feedback channel.

platformatic's People

Contributors

abdelrazzaq-dev avatar abdullah0sama avatar abhilakshsinghreen avatar cjihrig avatar flakey5 avatar floresj avatar giacomocerquone avatar github-actions[bot] avatar gunjam avatar hassanbahati avatar iamfortune avatar ivan-tymoshenko avatar leorossi avatar marcelom97 avatar marcopiraccini avatar mateonunez avatar mbrunjadze-crocobet avatar mcollina avatar mikaelkaron avatar mzugm avatar renovate[bot] avatar ricfio avatar rozzilla avatar ruheni avatar salvdel avatar shogunpanda avatar simone-sanfratello avatar simonplend avatar tonysnowboardunderthebridge avatar waynegibson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platformatic's Issues

Migrations should not be triggered by hot reload

Migration applied automatically when a file is created can be messy because a user can:

  • Save a a file with a partial migration
  • Platformatic DB applies the partial migration
  • The user complete the mifration and saves again
  • Platformatic DB doesn't execute the migration (because already applied).

To fix this we need to disable the automatic execution on migration, user must always execute npx platformatic db migrate
Also, migrations must live reload the server when done.

Platformatic DB fails to start if migrations are missing

To reproduce it:

mkdir test
cd test
npm init --yes
npm install platformatic
npm pkg set scripts.db="platformatic db"
npm run db --init
rm ./migrations/001.do.sql
npm run db --start

Actual result:

GraphQLError: Type Query must define one or more fields.
    at SchemaValidationContext.reportError (/home/marco/workspace/workspace-platformatic/TEST3/node_modules/graphql/type/validate.js:73:7)
    at validateFields (/home/marco/workspace/workspace-platformatic/TEST3/node_modules/graphql/type/validate.js:271:13)

Create nested routes based on relations

Consider these two tables:

-- Add SQL in this file to create the database tables for your API
CREATE TABLE IF NOT EXISTS movies (
  id INTEGER PRIMARY KEY,
  title TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS quotes (
  id INTEGER PRIMARY KEY,
  quote TEXT NOT NULL,
  movie_id INTEGER NOT NULL REFERENCES movies(id)
);

Currently we are creating routes for /movies/:id and /quotes/:id, however it would be really nice if we could create /movies/:movideId/quotes and /movies/:movieId/quotes/:id set of routes.

Support for JSON columns

Using the automatically generated REST API to get entities contaning object fields, you'll get
[object Object] instead of the value string serialization, for each of such fields.

openapi `limit` and `offset` parameters do not work adding authorization config for entity with find:true

Adding authorization node with find: true in platformatic.db.json the parameters limit and offset do not work:

  ...
  "authorization": {
    "rules": [
      {
        "role": "anonymous",
        "entity": "movie",
        "find": true
      }
    ],
    "roleKey": "X-PLATFORMATIC-ROLE",
    "anonymousRole": "anonymous"
  }

You can try it adding the above snippet configuration in the "tutorial movie" here:
tutorial-movie-quotes-app/apps/movie-quotes-api/platformatic.db.json

Here the different API responses for the following request:
http://127.0.0.1:3042/movies?limit=1&offset=2

Using the original platformatic.db.json (without authorization node):

[{"id":3,"name":"Star Wars"}]

Adding the above authorization node in the original platformatic.db.json:

[{"id":1,"name":"The Wizard of Oz"},{"id":2,"name":"Jaws"},{"id":3,"name":"Star Wars"},{"id":4,"name":"A Streetcar Named Desire"}]

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
docker-compose-apple-silicon.yml
  • arm64v8/postgres 15-alpine
  • arm64v8/mariadb 11.4
  • arm64v8/mysql 9-oracle
  • redis 7
docker-compose-mac.yml
  • postgres 15-alpine
  • mariadb 11.4
  • redis 7
docker-compose.yml
  • postgres 15-alpine
  • mariadb 11.4
  • redis 7
dockerfile
Dockerfile
  • node 18-alpine
  • node 18-alpine
github-actions
.github/workflows/announce-releases.yml
.github/workflows/ci.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • ikalnytskyi/action-setup-postgres v6
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
.github/workflows/docker-release.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • docker/build-push-action v6
.github/workflows/docker.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • docker/login-action v3
  • docker/build-push-action v6
.github/workflows/issues.yml
  • actions/create-github-app-token v1
  • actions/add-to-project f5473ace9aeee8b97717b281e26980aa5097023f
.github/workflows/md-lint.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4
  • xt0rted/markdownlint-problem-matcher v3
.github/workflows/publish-releases.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
  • nick-fields/retry v3.0.0
  • nick-fields/retry v3.0.0
.github/workflows/publish-schemas.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • pnpm/action-setup v4.0.0
  • actions/setup-node v4
.github/workflows/update-docs.yml
npm
package.json
  • @fastify/pre-commit ^2.1.0
  • desm ^1.3.1
  • markdownlint-cli2 ^0.13.0
  • pnpm 9.5.0
packages/cli/package.json
  • @fastify/error ^3.4.1
  • colorette ^2.0.20
  • commist ^3.2.0
  • desm ^1.3.1
  • dotenv ^16.4.5
  • execa ^8.0.1
  • fast-json-stringify ^5.14.1
  • graphql ^16.8.1
  • help-me ^5.0.0
  • inquirer ^9.2.16
  • minimist ^1.2.8
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • undici ^6.9.0
  • borp ^0.16.0
  • c8 ^10.0.0
  • fastify ^4.26.2
  • license-checker ^25.0.1
  • mkdirp ^2.1.6
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • typescript ^5.5.3
packages/client-cli/package.json
  • @fastify/error ^3.4.1
  • abstract-logging ^2.0.1
  • code-block-writer ^13.0.1
  • desm ^1.3.1
  • es-main ^1.3.0
  • find-up ^7.0.0
  • graphql ^16.8.1
  • help-me ^5.0.0
  • jsonpointer ^5.0.1
  • minimist ^1.2.8
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • undici ^6.9.0
  • yaml ^2.4.1
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • dotenv ^16.4.5
  • execa ^8.0.1
  • fastify ^4.26.2
  • fastify-tsconfig ^2.0.0
  • fs-extra ^11.2.0
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • typescript ^5.4.2
  • tsd ^0.31.0
  • why-is-node-running ^2.2.2
packages/client/package.json
  • @apidevtools/json-schema-ref-parser ^11.5.4
  • @fastify/error ^3.4.1
  • abstract-logging ^2.0.1
  • ajv ^8.12.0
  • jsonpointer ^5.0.1
  • undici ^6.9.0
  • desm ^1.3.1
  • borp ^0.16.0
  • c8 ^10.0.0
  • execa ^8.0.1
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • tsd ^0.31.0
  • typescript ^5.4.2
packages/composer/package.json
  • @fastify/error ^3.4.1
  • @fastify/http-proxy ^9.4.0
  • @fastify/reply-from ^9.7.0
  • @fastify/static ^7.0.1
  • @fastify/swagger ^8.14.0
  • @platformatic/graphql-composer ^0.7.0
  • @scalar/fastify-api-reference ^1.19.5
  • ajv ^8.12.0
  • commist ^3.2.0
  • console-table-printer ^2.12.0
  • desm ^1.3.1
  • es-main ^1.3.0
  • execa ^8.0.1
  • fast-deep-equal ^3.1.3
  • fastify ^4.26.2
  • fastify-openapi-glue ^4.6.0
  • fastify-plugin ^4.5.1
  • graphql ^16.8.1
  • help-me ^5.0.0
  • json-schema-traverse ^1.0.0
  • mercurius ^14.0.0
  • minimist ^1.2.8
  • my-ua-parser ^2.0.2
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • rfdc ^1.3.1
  • undici ^6.9.0
  • borp ^0.16.0
  • c8 ^10.0.0
  • dedent ^1.5.1
  • json-schema-to-typescript ^14.0.0
  • openapi-schema-validator ^12.1.3
  • single-user-cache ^1.0.1
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • tsd ^0.31.0
packages/config/package.json
  • @fastify/deepmerge ^1.3.0
  • @fastify/error ^3.4.1
  • abstract-logging ^2.0.1
  • ajv ^8.12.0
  • dotenv ^16.4.5
  • jsonpath ^1.1.1
  • minimist ^1.2.8
  • pupa ^3.1.0
  • semver ^7.6.0
  • undici ^6.9.0
  • @iarna/toml ^2.2.5
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • c8 ^10.0.0
  • fastify ^4.26.2
  • json5 ^2.2.3
  • pino ^8.17.2
  • pino-test ^1.0.1
  • snazzy ^9.0.0
  • standard ^17.1.0
  • yaml ^2.4.1
packages/control/package.json
  • @fastify/error ^3.4.1
  • commist ^3.2.0
  • help-me ^5.0.0
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • table ^6.8.1
  • undici ^6.9.0
  • ws ^8.16.0
  • borp ^0.16.0
  • desm ^1.3.1
  • execa ^8.0.1
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • tsd ^0.31.0
packages/create-platformatic/package.json
  • @types/node ^20.11.28
  • boring-name-generator ^1.0.3
  • chalk ^5.3.0
  • columnify ^1.6.0
  • commist ^3.2.0
  • desm ^1.3.1
  • es-main ^1.3.0
  • execa ^8.0.1
  • help-me ^5.0.0
  • inquirer ^9.2.16
  • log-update ^6.0.0
  • minimist ^1.2.8
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • resolve ^1.22.8
  • semver ^7.6.0
  • strip-ansi ^7.1.0
  • undici ^6.9.0
  • which ^3.0.1
  • ajv ^8.12.0
  • borp ^0.16.0
  • c8 ^10.0.0
  • cross-env ^7.0.3
  • dotenv ^16.4.5
  • esmock ^2.6.4
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0
  • typescript ~5.5.0
  • yaml ^2.4.1
packages/db-authorization/package.json
  • @fastify/error ^3.4.1
  • @fastify/jwt ^8.0.0
  • fastify-plugin ^4.5.1
  • fastify-user ^0.3.3
  • get-jwks ^9.0.1
  • undici ^6.9.0
  • @fastify/cookie ^8.3.0
  • @fastify/session ^10.7.0
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • fast-jwt ^4.0.0
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0
  • tsd ^0.31.0
  • why-is-node-running ^2.2.2
  • ws ^8.16.0
packages/db-core/package.json
  • fastify-plugin ^4.5.1
  • borp ^0.16.0
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0
  • why-is-node-running ^2.2.2
packages/db/package.json
  • @fastify/accepts ^4.3.0
  • @fastify/basic-auth ^5.1.1
  • @fastify/cors ^9.0.1
  • @fastify/deepmerge ^1.3.0
  • @fastify/error ^3.4.1
  • @fastify/static ^7.0.1
  • @fastify/swagger ^8.14.0
  • close-with-grace ^1.3.0
  • code-block-writer ^13.0.1
  • commist ^3.2.0
  • console-table-printer ^2.12.0
  • desm ^1.3.1
  • env-schema ^5.2.1
  • es-main ^1.3.0
  • execa ^8.0.1
  • fastify ^4.26.2
  • fastify-metrics ^11.0.0
  • fastify-plugin ^4.5.1
  • fastify-print-routes ^3.1.1
  • graphql ^16.8.1
  • help-me ^5.0.0
  • minimist ^1.2.8
  • my-ua-parser ^2.0.2
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • postgrator ^7.2.0
  • rfdc ^1.3.1
  • rimraf ^4.4.1
  • semgrator ^0.3.0
  • @databases/pg ^5.5.0
  • @databases/sql ^3.3.0
  • ajv ^8.12.0
  • bindings ^1.5.0
  • borp ^0.16.0
  • c8 ^10.0.0
  • execa ^8.0.1
  • json-schema-to-typescript ^14.0.0
  • mercurius ^14.0.0
  • openapi-types ^12.1.3
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • strip-ansi ^7.1.0
  • ts-standard ^12.0.2
  • tsd ^0.31.0
  • typescript ^5.4.2
  • undici ^6.9.0
  • vscode-json-languageservice ^5.3.9
  • why-is-node-running ^2.2.2
  • yaml ^2.4.1
packages/frontend-template/package.json
  • code-block-writer ^13.0.1
  • desm ^1.3.1
  • es-main ^1.3.0
  • execa ^8.0.1
  • help-me ^5.0.0
  • jsonpointer ^5.0.1
  • minimist ^1.2.8
  • undici ^6.9.0
  • @playwright/test ^1.42.1
  • @types/react ^18.2.66
  • @types/react-dom ^18.2.22
  • @vitejs/plugin-react ^3.1.0
  • react ^18.2.0
  • react-dom ^18.2.0
  • snazzy ^9.0.0
  • standard ^17.1.0
  • typescript ^5.4.2
  • vite ^5.1.6
packages/generate-errors-doc/package.json
  • snazzy ^9.0.0
  • standard ^17.1.0
packages/generators/package.json
  • @fastify/error ^3.4.1
  • boring-name-generator ^1.0.3
  • change-case-all ^2.1.0
  • fastify ^4.26.2
  • pino ^8.19.0
  • undici ^6.9.0
  • @types/inquirer ^9.0.7
  • borp ^0.16.0
  • c8 ^10.0.0
  • snazzy ^9.0.0
  • standard ^17.1.0
  • tsd ^0.31.0
  • typescript ^5.4.2
packages/runtime/fixtures/dbApp/package.json
packages/runtime/fixtures/dbAppNoName/package.json
packages/runtime/fixtures/dbAppWithMigrationError/package.json
packages/runtime/fixtures/management-api-custom-labels/package.json
packages/runtime/fixtures/management-api-custom-labels/services/service-db/package.json
packages/runtime/fixtures/management-api-without-metrics/package.json
packages/runtime/fixtures/management-api/package.json
packages/runtime/fixtures/management-api/services/service-db/package.json
packages/runtime/fixtures/monorepo-with-dependencies/main/clients/service-1/package.json
packages/runtime/fixtures/monorepo-with-dependencies/main/clients/service-2/package.json
packages/runtime/fixtures/monorepo-with-dependencies/service-1/clients/service-2/package.json
packages/runtime/fixtures/monorepo/serviceApp/with-logger/package.json
packages/runtime/fixtures/sample-runtime-with-2-services/package.json
  • platformatic ^1.25.0
  • @fastify/oauth2 7.9.0
  • fastify ^4.26.0
  • node ^18.8.0 || >=20.6.0
packages/runtime/fixtures/sample-runtime-with-2-services/services/foobar/package.json
  • platformatic ^1.25.0
  • @platformatic/service ^1.25.0
  • fastify ^4.26.0
  • node ^18.8.0 || >=20.6.0
packages/runtime/fixtures/sample-runtime-with-2-services/services/rival/package.json
  • platformatic ^1.25.0
  • @platformatic/service ^1.25.0
  • fastify ^4.26.0
  • node ^18.8.0 || >=20.6.0
packages/runtime/fixtures/sample-runtime/package.json
  • platformatic ^1.25.0
  • @fastify/oauth2 7.9.0
  • fastify ^4.26.0
  • node ^18.8.0 || >=20.6.0
packages/runtime/fixtures/sample-runtime/services/rival/package.json
  • platformatic ^1.25.0
  • @platformatic/service ^1.25.0
  • fastify ^4.26.0
  • node ^18.8.0 || >=20.6.0
packages/runtime/fixtures/typescript-custom-flags/services/titles/client/package.json
packages/runtime/fixtures/typescript-no-env/services/titles/client/package.json
packages/runtime/fixtures/typescript/services/titles/client/package.json
packages/runtime/package.json
  • @fastify/error ^3.4.1
  • @fastify/websocket ^10.0.0
  • @hapi/topo ^6.0.2
  • boring-name-generator ^1.0.3
  • change-case-all ^2.1.0
  • close-with-grace ^1.3.0
  • commist ^3.2.0
  • debounce ^2.0.0
  • desm ^1.3.1
  • dotenv-tool ^0.1.1
  • es-main ^1.3.0
  • fastest-levenshtein ^1.0.16
  • fastify ^4.26.2
  • fastify-undici-dispatcher ^0.6.0
  • graphql ^16.8.1
  • help-me ^5.0.0
  • minimist ^1.2.8
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • pino-roll ^1.0.0
  • semgrator ^0.3.0
  • tail-file-stream ^0.1.0
  • undici ^6.9.0
  • ws ^8.16.0
  • @fastify/express ^3.0.0
  • @fastify/formbody ^7.4.0
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • c8 ^10.0.0
  • execa ^8.0.1
  • express ^4.18.3
  • fast-jwt ^4.0.0
  • get-port ^7.1.0
  • pino-abstract-transport ^1.1.0
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • tsd ^0.31.0
  • typescript ^5.4.2
  • undici-oidc-interceptor ^0.5.0
  • why-is-node-running ^2.2.2
packages/scalar-theme/package.json
packages/service/fixtures/hello-client-ts/hello/package.json
packages/service/fixtures/hello-client/hello/package.json
packages/service/package.json
  • @fastify/accepts ^4.3.0
  • @fastify/autoload ^5.8.0
  • @fastify/basic-auth ^5.1.1
  • @fastify/cors ^9.0.1
  • @fastify/deepmerge ^1.3.0
  • @fastify/error ^3.4.1
  • @fastify/restartable ^2.3.1
  • @fastify/static ^7.0.1
  • @fastify/swagger ^8.14.0
  • @fastify/under-pressure ^8.3.0
  • @mercuriusjs/federation ^3.0.0
  • @scalar/fastify-api-reference ^1.19.5
  • @types/ws ^8.5.10
  • ajv ^8.12.0
  • cli-progress ^3.12.0
  • close-with-grace ^1.3.0
  • code-block-writer ^13.0.1
  • colorette ^2.0.20
  • commist ^3.2.0
  • console-table-printer ^2.12.0
  • desm ^1.3.1
  • env-schema ^5.2.1
  • es-main ^1.3.0
  • execa ^8.0.1
  • fastify ^4.28.1
  • fastify-metrics ^11.0.0
  • fastify-openapi-glue ^4.4.3
  • fastify-plugin ^4.5.1
  • graphql ^16.8.1
  • help-me ^5.0.0
  • mercurius ^14.0.0
  • minimist ^1.2.8
  • my-ua-parser ^2.0.2
  • pino ^8.19.0
  • pino-pretty ^11.0.0
  • prom-client ^15.1.2
  • rfdc ^1.3.1
  • semgrator ^0.3.0
  • undici ^6.9.0
  • @fastify/aws-lambda ^4.0.0
  • @fastify/compress ^7.0.0
  • bindings ^1.5.0
  • borp ^0.16.0
  • json-schema-to-typescript ^14.0.0
  • openapi-types ^12.1.3
  • pino-abstract-transport ^1.1.0
  • self-cert ^2.0.0
  • snazzy ^9.0.0
  • split2 ^4.2.0
  • standard ^17.1.0
  • strip-ansi ^7.1.0
  • ts-standard ^12.0.2
  • tsd ^0.31.0
  • typescript ^5.4.2
  • undici ^6.0.0
  • vscode-json-languageservice ^5.3.9
  • why-is-node-running ^2.2.2
  • yaml ^2.4.1
packages/sql-events/package.json
  • @fastify/error ^3.4.1
  • fastify-plugin ^4.5.1
  • mqemitter ^5.0.0
  • mqemitter-redis ^5.0.0
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • fastify ^4.26.2
  • ioredis ^5.3.2
  • snazzy ^9.0.0
  • standard ^17.1.0
  • tsd ^0.31.0
packages/sql-graphql/package.json
  • @fastify/error ^3.4.1
  • @mercuriusjs/federation ^3.0.0
  • fastify-plugin ^4.5.1
  • graphql ^16.8.1
  • graphql-scalars ^1.22.5
  • graphql-type-json ^0.3.2
  • inflected ^2.1.0
  • mercurius ^14.0.0
  • @matteo.collina/snap ^0.3.0
  • @matteo.collina/tspl ^0.1.1
  • @mercuriusjs/gateway ^3.0.0
  • borp ^0.16.0
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0
  • tsd ^0.31.0
  • why-is-node-running ^2.2.2
  • ws ^8.16.0
packages/sql-json-schema-mapper/package.json
  • code-block-writer ^13.0.1
  • safe-identifier ^0.4.2
  • borp ^0.16.0
  • dtsgenerator ^3.19.1
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0
  • why-is-node-running ^2.2.2
packages/sql-mapper/package.json
  • @databases/mysql ^6.0.0
  • @databases/pg ^5.5.0
  • @databases/sql ^3.3.0
  • @fastify/error ^3.4.1
  • @hapi/topo ^6.0.2
  • @matteo.collina/sqlite-pool ^0.4.0
  • async-cache-dedupe ^2.1.0
  • fastify-plugin ^4.5.1
  • inflected ^2.1.0
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0
  • tsd ^0.31.0
packages/sql-openapi/package.json
  • @fastify/deepmerge ^1.3.0
  • @fastify/error ^3.4.1
  • @fastify/swagger ^8.14.0
  • @scalar/fastify-api-reference ^1.19.5
  • fastify-plugin ^4.5.1
  • inflected ^2.1.0
  • @matteo.collina/snap ^0.3.0
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • fastify ^4.26.2
  • mercurius ^14.0.0
  • openapi-types ^12.1.3
  • snazzy ^9.0.0
  • standard ^17.1.0
  • tsd ^0.31.0
  • why-is-node-running ^2.2.2
  • yaml ^2.4.1
packages/swagger-ui-theme/package.json
packages/telemetry/package.json
  • @fastify/swagger ^8.14.0
  • @opentelemetry/api ^1.8.0
  • @opentelemetry/core ^1.22.0
  • @opentelemetry/exporter-trace-otlp-proto ^0.52.0
  • @opentelemetry/exporter-zipkin ^1.22.0
  • @opentelemetry/resources ^1.22.0
  • @opentelemetry/sdk-trace-base ^1.22.0
  • @opentelemetry/semantic-conventions ^1.22.0
  • fast-uri ^2.3.0
  • fastify-plugin ^4.5.1
  • borp ^0.16.0
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0
packages/ts-compiler/package.json
  • execa ^8.0.1
  • pino ^9.2.0
  • pino-pretty ^11.0.0
  • resolve ^1.22.8
  • c8 ^10.0.0
  • fastify ^4.26.2
  • pino-test ^1.0.1
  • snazzy ^9.0.0
  • standard ^17.1.0
  • typescript ^5.5.3
packages/utils/package.json
  • @fastify/deepmerge ^1.3.0
  • @fastify/error ^3.4.1
  • minimatch ^8.0.4
  • undici ^6.9.0
  • @matteo.collina/tspl ^0.1.1
  • borp ^0.16.0
  • fastify ^4.26.2
  • snazzy ^9.0.0
  • standard ^17.1.0

  • Check this box to trigger a request for Renovate to run again on this repository

GraphQL setup fails when using table whose primary key are named using snake case convention

It seems the GraphQL api initialization fails when there are tables whose primary key are not named using camel case convention.
in my case it was a field named id_currency.
It seems that in following snippet in (packages/sql-graphql/lib/entity-to-type.js),
the code is expecting the camel case form of the primary key, while it receive the original name:

  queryTopFields[getBy] = {
    type,
    args: {
      [primaryKey]: { type: new graphql.GraphQLNonNull(fields[primaryKey].type) }
    }
  }

Choose and integrate documentation tooling

We should integrate tooling to help maintain consistency across all documentation. The areas we'd like to ensure consistency in are:

  • Markdown formatting, including things like line length
  • Stylistic rules, including title formatting, as well as the use of specific grammar and phrasing

I've created this issue so that we can capture discussion on the tools that can help us in these areas. Once we've agreed on the tools we want to use, we'll then want to:

  • Discuss and agree on a set of rules
  • Integrate the tooling with the agreed rules, likely into a GitHub Actions workflow
  • Ensure that the grammatical and phrasing rules are documented in the Documentation Style Guide

Logging documentation

We should document that we use pino and we log as newline delimited JSON.
Morever, we should document that the "pretty printing" of logs is enabled by default only if the user is using a TTY (as well as the ASCII art).

Live notification, GraphQL Subscriptions, and WebSocket in Platformatic DB

We should support some form of "live updates" for all changes that goes into Platformatic DB.
This is an epic composed by a few subtasks:

  • create a new @platformatic/sql-events module that publishes updates to a mqemitter, this should use the hooks.
  • add support for sql-events in sql-graphql, automatically creating a few Subscription to be notified on updates.
  • augment @platformatic/db-authorization so that it protects graphql subscriptions
  • support configuring it with redis as the broker
  • reference docs

Enable query logging with SQLite

Currently, query logging as trace level is only logged by PostgreSQL, MariaDB, and MySQL. We should enable it for SQLite too.

Use Hypermedia in RESTlike API

Hello,

this is an Idea not a bug.

Consider the following minimal example:

CREATE TABLE pages (
  id INTEGER PRIMARY KEY,
  title VARCHAR(255) NOT NULL
);

CREATE TABLE posts (
    id INTEGER PRIMARY KEY,
    page_id INTEGER NOT NULL,
    title VARCHAR(255) NOT NULL,
    FOREIGN KEY (page_id) REFERENCES  pages (id) 
);

What I would expect from a more restful API is Hypermedia support (https://reflectoring.io/rest-hypermedia/).

An example response would be:

http GET /posts

[
  {
    "id": 1,
    "pageId": 1,
    "title": "Page 1 Post 1",
    "_links": { "self": "/posts/1", "page": "pages/1" }
  }
]

GET http /posts

[
  {
    "id": 1,
    "title": "Page 1",
    "_links": { "self": "/pages/1", "posts": "/posts?where.id.eq=1" }
  }
]

The same would apply to response to POST/PUT/PATCH requests.

In order to accomplish this, Hypermedia must either "baked in", or there must be a plugin api where you can hook into the schema AST and construct the resource presentation in this plugin. imo this is currently not possible?

In SQL-to-REST API `limit` and `offset` do work only when used together

In SQL-to-REST API the get parameters limit and offset do work only when used together.
http://127.0.0.1:3042/movies

[{"id":1,"name":"The Wizard of Oz"},{"id":2,"name":"Jaws"},{"id":3,"name":"Star Wars"},{"id":4,"name":"A Streetcar Named Desire"}]

http://127.0.0.1:3042/movies?limit=1&offset=2

[{"id":3,"name":"Star Wars"}]

The get parameter limit does not work when used alone:
http://127.0.0.1:3042/movies?limit=1

[{"id":1,"name":"The Wizard of Oz"},{"id":2,"name":"Jaws"},{"id":3,"name":"Star Wars"},{"id":4,"name":"A Streetcar Named Desire"}]

The get parameter offset does not work when used alone:
http://127.0.0.1:3042/movies?offset=1

[{"id":1,"name":"The Wizard of Oz"},{"id":2,"name":"Jaws"},{"id":3,"name":"Star Wars"},{"id":4,"name":"A Streetcar Named Desire"}]

Relations fields are always returned in REST API

Having this schema (dumped from PostgreSQL)

CREATE SEQUENCE IF NOT EXISTS categories_id_seq1;
CREATE TABLE "public"."categories" (
    "id" int4 NOT NULL DEFAULT nextval('categories_id_seq1'::regclass),
    "name" varchar(255) NOT NULL,
    PRIMARY KEY ("id")
);

CREATE SEQUENCE IF NOT EXISTS pages_id_seq1;
CREATE TABLE "public"."pages" (
    "id" int4 NOT NULL DEFAULT nextval('pages_id_seq1'::regclass),
    "title" varchar(255) NOT NULL,
    "category_id" int4,
    "user_id" int4,
    CONSTRAINT "pages_category_id_fkey" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id"),
    PRIMARY KEY ("id")
);

If you call this endpoint GET /pages/?fields=title&fields=id the categoryId field is always returned because is a foreign key.

That should not be send out

Types generation is not documented in cli help

 ➜ npx platformatic db help  
     (...)
Available commands:

* `help` - show this help message.
* `help <command>` - shows more information about a command.
* `init` - initiate default application.
* `start` - start the server.
* `migrate` - run migrations.
* `seed` - run a seed file.

GET with `fields` requires all not-nullable field on responses

To reproduce it, apply this migration:

CREATE TABLE IF NOT EXISTS movies (
  id INTEGER PRIMARY KEY,
  title TEXT NOT NULL,
  author TEXT
);

Then ADD SOME DATA, start the server and query for the authors:

➜ curl --location --request GET 'http://localhost:3042/movies?fields=author'
{"statusCode":500,"error":"Internal Server Error","message":"\"title\" is required!"}% 

So, the data returned are validated using the schema (in this case, title is mandatory) but this should not happen on GET
Note that this happens only if there are actual data in the table, with no data, [] is (correctly) returned.

MySql db setup fails

Running npx platformic db start, using simple mysql database (8.0.16) db setup fails fails with error message:
Error: unknown database
at setupDB (~/quick-start/node_modules/@platformatic/db/lib/utils.js:20:11)
It seems a trivial error in file /db/lib/utils, where the if conditions should be
else if (db.isMySQL)
and not
else if (db.isMySql)

Missing import in Reference > SQL-Mapper example

The base code example under Reference > SQL-Mapper docs seems to be missing the mapper import in the main branch.

File docs/reference/sql-mapper/introduction.md
Missing line const { connect } = require('@platformatic/sql-mapper')

PS. Thank you for making this available. Looks amazing.

Make graphql fields required?

I've been going through the guide and noticed that for some reason, a lot of returning types in the gql schema are optional, although it looks like they shouldn't be.

Here's the schema:

type Query {
  getPageById(id: ID!): Page
  # orderBy items should be required. Why not? orderBy: [PageOrderByArguments!]
  # Probably we always get pages. Why not?  ...ere: PageWhereArguments): [Page!]!
  pages(limit: Int, offset: Int, orderBy: [PageOrderByArguments], where: PageWhereArguments): [Page]
  # Why not? countPages(where: PageWhereArguments): pagesCount!
  countPages(where: PageWhereArguments): pagesCount
}

type Page {
  # It's the primary key. Why not? id: ID!
  id: ID
  # It's NOT NULL. Why not? title: String!
  title: String
}

input PageOrderByArguments {
  field: PageOrderByField
  direction: OrderByDirection!
}

enum PageOrderByField {
  id
  title
}

enum OrderByDirection {
  ASC
  DESC
}

input PageWhereArguments {
  id: PageWhereArgumentsid
  title: PageWhereArgumentstitle
}

input PageWhereArgumentsid {
  eq: ID
  neq: ID
  gt: ID
  gte: ID
  lt: ID
  lte: ID
  # Should be:  in: [ID!]
  in: [ID]
  # Should be:  in: [ID!]
  nin: [ID]
}

input PageWhereArgumentstitle {
  eq: String
  neq: String
  gt: String
  gte: String
  lt: String
  lte: String
  # Should be:  in: [String!]
  in: [String]
  # Should be:  in: [String!]
  nin: [String]
}

type pagesCount {
  # Why not? total: Int!
  total: Int
}

type Mutation {
  # Why not? savePage(input: PageInput!): Page!
  savePage(input: PageInput!): Page
  # Why not? insertPages(inputs: [PageInput!]!): [Page!]!
  insertPages(inputs: [PageInput]!): [Page]
   # Why not? deletePages(where: PageWhereArguments): [Page!]!
  deletePages(where: PageWhereArguments): [Page]
}

input PageInput {
  # The id is primary key. Why not? id: ID!
  id: ID
  # The title is NOT NULL. Why not? title: String!
  title: String
}

I'm not sure whether my logic is correct, so I'd like to ask first whether it's correct behavior or not.

Is it a part of Platformatic DB or some other tool it is using?

The reason why the problem might be important is that when you generate code from gql schema, it'd have a lot of unnecessary optional fields that you'd manually need to check.

Transactions with entities

The db exposed by platformatic allows for transactions but transactions do not work with entities as the available methods use the pre-computed database and associated queries.

Current state of transactions:

async function createNewUser (input, platformatic) {
  const { db, sql } = platformatic

  const result = await db.tx(async tx => {
    const userResult = await tx.query(sql`
      INSERT INTO
        users (id, username)
      VALUES
        (${randomUUID()}, ${input.userName})
      RETURNING id
    `)

    const teamResult = await tx.query(sql`
      INSERT INTO
        user_team (team_id, user_id)
      VALUES
        (${input.teamId}, ${userResult[0].id})
    `)

    return { id: userResult[0].id }
  })

  return result
}

It would be cool to do this with entities though, something like:

async function createNewUser (input, platformatic) {
  const { db, entities } = platformatic

  const result = await db.tx(async tx => {
    const userResult = await entities.user.save({
      fields: ['id', 'username'],
      input: { username: input.userName },
      db: tx
    })

    await entities.userTeam.save({
      fields: ['teamId', 'userId'],
      input: { teamId: input.teamId, userId: userResult.id },
      db: tx
    })

    return { id: userResult.id }
  })

  return result
}

[Docs] How to write automated tests

Should include how to write tests for a service whether or not it has a plugin. Without a custom plugin, the tests act like a contract. With a plugin, the user can validate their custom functionality.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.