Automatic schema generation for your service logic.
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.
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? Psylon does exactly that.
Psylon 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 Psylon, you can build APIs faster, with fewer errors, and with less code.
Psylon is a Pylon v2 fork maintained by Netsnek e. U., tuned to behave like its predecessor snek-functions and laser-focused on seamless microservice interoperability.
Unlike Pylon v3, which aims to become a full-stack framework, Psylon is and will remain a GraphQL-based microservice framework. Security fixes and compatible behavioural changes from Pylon v3 that improve the v2 runtime will be backported to Psylon where appropriate.
Canonical repository: https://github.com/netsnek/psylon
Psylons roadmap is centered around GraphQL via GQty and its pgqty fork. For current plans and discussion, see gqty-dev/gqty#2051.
To create a new Psylon project, run the following command:
npm create psylon@latestAfterwards, you can navigate to the newly created project and start the development server:
cd my-psylon
npm run devThis will start the development server on http://localhost:3000.
Open the Psylon Playground in your browser and start building your API.
Update your service logic in the src directory.
import {app} from 'psylon'
export const graphql = {
Query: {
user: (id: string) => {
return {
id,
name: 'John Doe',
email: 'johndoe@example.com'
}
},
products: () => [
{id: '1', name: 'Laptop', price: 999.99},
{id: '2', name: 'Smartphone', price: 499.99},
{id: '3', name: 'Tablet', price: 299.99}
]
},
Mutation: {
updateUserEmail: (id: string, newEmail: string) => {
return {
id,
email: newEmail
}
},
createOrder: (userId: string, productIds: string[]) => {
return {
id: 'order-123',
userId,
productIds,
status: 'PENDING'
}
}
}
}
export default appQuery:
query GetUser {
user(id: "1") {
id
name
email
}
}
query GetProducts {
products {
id
name
price
}
}Mutation:
mutation UpdateUserEmail {
updateUserEmail(id: "1", newEmail: "johndoe2@example.com") {
id
email
}
}
mutation CreateOrder {
createOrder(userId: "1", productIds: ["1", "2"]) {
id
userId
productIds
status
}
}Psylon 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 Psylon.
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.
docker build -t my-pylon .
docker run -p 3000:3000 my-pylonDesigned to be flexible, Psylon can be run on various platforms, including:
| Bun.js | Node.js | Cloudflare Workers | Deno |
Psylon offers a comprehensive set of features to streamline the development of modern web services:
| Feature | Description |
|---|---|
| Automatic Schema Generation | Psylon generates GraphQL schemas based on your TypeScript definitions, ensuring type safety and reducing manual coding effort. |
| Type Safety | By leveraging TypeScript, Psylon 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. |
You can try Psylon in the Playground without installing anything. Or simply click the image below to open the Playground.
Documentation, bug reports, pull requests, and other contributions are welcomed!
See CONTRIBUTING.md for more information.
- Community Support: Join the Psylon community on GitHub to report bugs and request features.
- Professional Support: For professional support and consulting services, contact office@cronit.io.
- Join the Psylon Discord server to connect with other users and contributors.
Psylon is brought to you by Cronit.
