The heart of any modern web application is its database, the single source of truth for all data within your application. Psychic comes equipped out of the box with Dream, an ORM which empowers developers to leverage beautiful active record paradigms to compose keep their database layer beautiful and expressive.
Leverage the query building API within Dream to easily construct powerful queries. Dream provides tools to enable you to easily construct even the most sophisticated queries without ever writing a line of sql.
saving records
Use built-in methods for easily updating data on your records
associations
Take advantage of powerful association mechanisms to clarify your domain, as well as to gain easy access to your associated models.
validations
Leverage our validation decorators to easily apply validations before saving your records.
encryption
Automatically encrypt columns on their way into the database, and decrypt them upon accessing.
Psychic leverages the Model View Controller paradigm to drive routes to specific controllers and methods. We provide controllers with deep integrations to your model layer, enabling you to quickly and easily respond to requests.
Easily bring params into your controller layer, running implicit validations under the hood to protect you from invalid data. Any params failing to cast will cause the controller to raise a 400 status code.
status codes
Leverage helpful status code methods to easily render specific HTTP statuses.
To provide mechanisms to direct specific routes to your controllers, Psychic provides you with an elegant routing solution. Take advantage of resourceful routing patterns and elegant callback mechanisms to create beautiful nested route patterns.
express RESTful routes programatically
namespacing
Leverage namespace and scope methods to group route expressions together
Unit testing
No application is complete without a functioning test suite to prove its capabilities. Psychic bootstraps your app with Vitest, a powerful testing tool which has become the standard testing platform for modern typescript applications.
Take advantage of custom vitest assertions, designed to help you easily interact with Psychic and Dream constructs.
specRequest
Use our in-house specRequest singleton for making requests to your endpoints, facilitating easy assertion of response expectations and payloads.
Feature testing
For those doing full-stack development, Psychic provides a testing paradigm for driving a headless browser through your front end, enabling you to perform end-to-end testing on your application.
In addition to providing vitest bindings for testing your backend, Psychic also provides a framework for writing end-to-end tests. When configuring Psychic with a client application, it will automatically generate a framework for running `feature tests`, enabling you to drive a headless browser through your front end and backend at once.
This is all driven by vitest and puppeteer, both of which are configured in your Psychic application by default. Since the configurations are provided, but committed to your repository, you can make any changes you see fit to adapt to your own custom setup.
Maintaining specs for your api can often be a chore, since though you are aware of what your response shapes are, to communicate them to others often involves constructing api documents using OpenAPI and manually shaping each endpoint to match your actual response payloads. Psychic provides deep and powerful OpenAPI integrations to enable the application to automatically know what the payload shapes will be, and to automatically shape the document to reflect these shapes.
Define OpenAPI decorators on your controller endpoints, enabling you to easily express payload shapes by simply pointing the decorator at a serializer.