Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylon V2 #10

Merged
merged 55 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5165b5f
fix(bundler): handle build errors and throw an error if Pylon fails t…
schettn Jul 31, 2024
05c3565
Merge remote-tracking branch 'origin/main' into beta
schettn Sep 6, 2024
fee86ee
chore: add cSpell word 'consola' to VSCode settings
schettn Sep 6, 2024
97ed3e1
feat: multiple runtimes, create package, rework core concepts
schettn Sep 6, 2024
756a99c
chore: update README.md
schettn Sep 6, 2024
19271d1
chore: remove "pylon-template" from package workspaces
schettn Sep 6, 2024
73e7e74
chore: add "publishConfig" to package.json
schettn Sep 6, 2024
51efef4
chore: move "publishConfig"
schettn Sep 6, 2024
4b8a5c7
fix: update package version to 1.0.0
schettn Sep 6, 2024
1f0ab09
fix: update create-pylon package to use fileURLToPath and dirname
schettn Sep 6, 2024
681d691
fix: update dependencies for v2
schettn Sep 6, 2024
286fe77
fix: move esbuild from dev to dependencies
schettn Sep 6, 2024
098d606
fix: update "@getcronit/pylon-builder" dependency to "beta" for prere…
schettn Sep 6, 2024
004af3e
fix: update npm dependencies
schettn Sep 6, 2024
4fe7fec
fix: recursive file search in create-pylon
schettn Sep 6, 2024
b54459f
fix: update final create-pylon package with helpful messages and inst…
schettn Sep 6, 2024
72e0666
chore: update readme disclaimer
schettn Sep 6, 2024
c6a4b40
chore: update readme.md disclaimer
schettn Sep 6, 2024
76564a8
fix: add chalk
schettn Sep 6, 2024
b916922
fix: add missing node version requirements
schettn Sep 6, 2024
8fcc89c
fix: update actions/checkout to v4 in publish.yaml workflow
schettn Sep 6, 2024
f1a540b
fix: add missing node version requirements
schettn Sep 6, 2024
14926f9
fix: add ts loader to `injectCodePlugin`
schettn Sep 8, 2024
f23fc9b
fix: improve error handling in Pylon schema build process
schettn Sep 8, 2024
bbf7d61
fix: auth env loading on any runtime
schettn Sep 8, 2024
db245a7
fix: add `@hono/node-server` to node template
schettn Sep 8, 2024
b7218ed
chore: update dependencies in pylon/package.json
schettn Sep 8, 2024
31ffa1a
fix: add consola warning instead of error for undefined context in re…
schettn Sep 8, 2024
6950335
feat: add `esbuildPluginTsc` to support more complex ts
schettn Sep 9, 2024
04d888e
fix: add missing builder dep
schettn Sep 9, 2024
fe3f83e
fix: authInitialize now loads the key at startup and the key env at r…
schettn Sep 9, 2024
1f69aec
fix: update @getcronit/pylon-builder dependency to "beta"
schettn Sep 9, 2024
579906e
fix: enable bundling to support module imports
schettn Sep 9, 2024
faadee8
fix: remove console.log statement in authInitialize
schettn Sep 9, 2024
52c6c0f
chore: add NOTICE file with copyright information
schettn Sep 9, 2024
cbcccee
fix: insert graphql handler after custom middlewares
schettn Sep 10, 2024
1aa9c42
fix: handle error when building schema
schettn Sep 11, 2024
be42eb4
docs: update README.md
schettn Sep 12, 2024
051bb27
docs: update README.md
schettn Sep 12, 2024
be049a0
perf: remove debug timeout
schettn Sep 12, 2024
eca48f3
feat: add telemetry client
schettn Sep 17, 2024
3a56c4a
feat: integrate pylon telemetry with core packages
schettn Sep 17, 2024
0780588
fix: update pylon-telemetry to beta version in package.json
schettn Sep 17, 2024
f7642e3
fix: include pylon-telemetry in build process
schettn Sep 17, 2024
167af09
fix: update pylon to beta version in package.json
schettn Sep 17, 2024
c1bd3a9
fix: make `@getcronit/pylon` dept optional and fallback to process.env
schettn Sep 17, 2024
a20670e
fix: update @getcronit/pylon version in pylon-telemetry package.json
schettn Sep 17, 2024
9bd0d51
fix: update version retrieval in create-pylon
schettn Sep 17, 2024
a9ff06d
fix: unfinished top-level await
schettn Sep 17, 2024
1e07c19
chore: update version to 1.0.0 in pylon-dev package.json
schettn Sep 17, 2024
4b4a71b
feat: add telemetry call in authRequire middleware
schettn Sep 17, 2024
cd6f875
fix: update versions from beta semver
schettn Sep 17, 2024
85f5697
fix: remove optional peer dependency for "@getcronit/pylon" in pylon-…
schettn Sep 17, 2024
c484053
chore: update package.json workspaces.
schettn Sep 17, 2024
6aa52b6
chore: update package.json workspaces
schettn Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"consola"
]
}
5 changes: 5 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Pylon
Copyright 2024 Nico Schett <[email protected]>

This product includes software developed at
cronit (https://www.cronit.io/).
137 changes: 117 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,137 @@
:warning: **Pylon Requires Bun:** This project currently depends on the [Bun runtime](https://bun.sh). If you need support for a different runtime, please upvote and follow the discussion on Issue https://github.com/getcronit/pylon/issues/6 to help us prioritize it.
![Pylon cover](https://github.com/user-attachments/assets/c28e49b2-5672-4849-826e-8b2eab0360cc)

<p align="center">
<a href="https://pylon.cronit.io">
<img src="https://github.com/getcronit/pylon/assets/52858351/ec8aa54e-6b24-45cb-82a1-03b9c8b8f45f" height="100" alt="gqty" />
</a>
</p>
<div align="center"><strong>Pylon</strong></div>
<div align="center">The next generation of building APIs.<br />Automatic schema generation for your service logic.</div>
<br />
<div align="center">
<a href="https://pylon.cronit.io">Website</a>
<span> · </span>
<a href="https://github.com/getcronit/pylon">GitHub</a>
<span> · </span>
<a href="https://discord.com/invite/cbJjkVrnHe">Discord</a>

<h2 align="center">
From Functions to APIs - Instantly
<br />
<br />

[![Documentation](https://img.shields.io/badge/documentation-documentation?color=C00B84)](https://pylon.cronit.io)
[![Documentation](https://img.shields.io/badge/documentation-documentation?color=000000)](https://pylon.cronit.io/docs)
[![NPM](https://img.shields.io/npm/v/%40getcronit%2Fpylon)](https://www.npmjs.com/package/@getcronit/pylon)

</h2>
</div>

[![Pylon Hero Section](https://github.com/getcronit/pylon/assets/52858351/9ce5833f-c4ce-4dc5-85a9-6eb3910b40bd)](https://pylon.cronit.io)
## Introduction

The GraphQL schema is generated in real-time from your TypeScript definitions,
allowing you to focus solely on writing your service logic.
This approach significantly improves development speed, enhances type safety, and reduces errors.
A framework for building GraphQL APIs without defining any kind of schema.
It reduces the time spent on writing and maintaining API definitions, allowing you to focus solely on writing your service logic.

Any breaking changes in your code are instantly reflected in your API,
enabling you to immediately see how changes impact its functionality.
## Why

**Head over to [pylon.cronit.io](https://pylon.cronit.io) to explore features and
documentations!**
We believe that the current approach to building APIs is outdated. Writing and maintaining API definitions is time-consuming and error-prone. When you already have TypeScript definitions, why not use them to infer the API schema? Pylon does exactly that.

## Get involved
Pylon also provides a set of tools to help you build, test, and deploy your APIs. We believe that building services should be easy and fun. Major functionalities like authentication, authorization, and context management are built-in, so you can focus on what matters most: your service logic.

With Pylon, you can build APIs faster, with fewer errors, and with less code.

## Create

To create a new Pylon project, run the following command:

```bash
npm create pylon
```

Afterwards, you can navigate to the newly created project and start the development server:

```bash
cd my-pylon
npm run dev
```

This will start the development server on `http://localhost:3000`.

Open the [Pylon Playground](https://pylon.cronit.io/docs/getting-started#built-in-graphql-playground) in your browser and start building your API.

## Develop

Update your service logic in the `src` directory.

```typescript
import {app} from '@getcronit/pylon'

export const graphql = {
Query: {
sum: (a: number, b: number) => {
console.log(`Calculating sum of ${a} and ${b}`)
return a + b
}
},
Mutation: {
divide: (a: number, b: number) => {
if (b === 0) {
console.error('Attempt to divide by zero')
throw new Error('Division by zero is not allowed')
}
console.log(`Dividing ${a} by ${b}`)
return a / b
}
}
}

export default app
```

## Deploy

Pylon is fully compatible with Cloudflare Workers, allowing you to deploy your service to the edge in just one minute.
Watch the video below to see how easy it is to deploy a Pylon.

[![Cloudflare Workers](https://video.com)]

If you prefer to deploy your service to a different platform, you can use the provided Dockerfile to build a Docker image and deploy it to your favorite cloud provider.

```bash
docker build -t my-pylon .
docker run -p 3000:3000 my-pylon
```

## Runtimes

Designed to be flexible, Pylon can be run on various platforms, including:

| <img src="https://bun.sh/logo.svg" width="48px" height="48px" alt="Bun.js logo"> | <img src="https://nodejs.org/static/logos/jsIconWhite.svg" width="48px" height="48px" alt="Node.JS"> | <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQgW7cAlhYN23JXGKy9Uji4Ae2mnHOR9eXX9g&s" width="48px" height="48px" alt="Gmail logo"> |
| :------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------: |
| Bun.js | Node.js | Cloudflare Workers |

## Features

Pylon offers a comprehensive set of features to streamline the development of modern web services:

| Feature | Description |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| **Automatic Schema Generation** | Pylon generates GraphQL schemas based on your TypeScript definitions, ensuring type safety and reducing manual coding effort. |
| **Type Safety** | By leveraging TypeScript, Pylon ensures that your services are type-safe, catching errors at compile time. |
| **Authentication and Authorization** | Built-in support for OIDC standard and integration with ZITADEL for managing user authentication and role-based access control. |
| **Logging and Monitoring** | Sentry for error tracking, providing robust monitoring capabilities. |
| **Database Integration** | Seamlessly works with Prisma to generate extended models that support automatic resolution of relations and paginatable connections. |
| **Deployment Ready** | Includes pre-configured Dockerfile for easy deployment using Docker or manual methods. |

## Playground

You can try Pylon in the [Playground](https://pylon.cronit.io/playground) without installing anything.
Or simply click the image below to open the Playground.

[![Playground](https://github.com/user-attachments/assets/39df08d0-4094-4836-a36b-37ad62e292cf)](https://pylon.cronit.io/playground)

## Contributing

Documentation, bug reports, pull requests, and other contributions are welcomed!
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for more information.

## Getting help
## Support

- **Community Support:** Join the Pylon community on GitHub to report bugs and request features.
- **Professional Support:** For professional support and consulting services, contact [[email protected]](mailto:[email protected]).
- Join the [Pylon Discord server](https://discord.gg/cbJjkVrnHe) to connect with other users and contributors.

---

Pylon is brought to you by Cronit.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"private": true,
"workspaces": {
"packages": [
"packages/pylon-telemetry",
"packages/*"
]
},
"scripts": {
"build": "bun run --filter ./packages/pylon build && bun run --filter ./packages/pylon-builder build && bun run --filter ./packages/pylon-server build && bun run --filter ./packages/pylon-cli build"
"build": "bun run --filter ./packages/pylon-telemetry build && bun run --filter ./packages/pylon-builder build && bun run --filter ./packages/pylon build && bun run --filter ./packages/pylon-dev build && bun run --filter ./packages/create-pylon build"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
Expand Down
33 changes: 33 additions & 0 deletions packages/create-pylon/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "create-pylon",
"type": "module",
"version": "1.0.0",
"description": "CLI for creating a Pylon",
"scripts": {
"build": "bun build ./src/index.ts --target=bun --outdir=./dist --sourcemap=inline --packages external"
},
"bin": "./dist/index.js",
"files": [
"dist",
"templates"
],
"author": "Nico Schett <[email protected]>",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/getcronit/pylon.git",
"directory": "packages/create-pylon"
},
"homepage": "https://pylon.cronit.io",
"dependencies": {
"@inquirer/prompts": "^5.4.0",
"chalk": "^5.3.0",
"commander": "^12.1.0",
"consola": "^3.2.3",
"detect-package-manager": "^3.0.2",
"@getcronit/pylon-telemetry": "^1.0.0"
},
"engines": {
"node": ">=18.0.0"
}
}
Loading
Loading