Skip to main content
Version: 3.3.0

Get Started

To get started on JSONClasses is quite easy as it designs. In less than several minutes, you can get your first JSONClasses server running.

Setup Dependencies#

JSONClasses requires Python 3.10. If you don't have it installed, you can follow the download guide here.

JSONClasses uses MongoDB for its ORM feature. In the future, SQL databases will be supported. But for now, the only supporting database is MongoDB. If you don't have it installed, you can download it here.

Install#

Read the installation guide to create a starter JSONClasses server project.

The First Model#

Let's declare the very first model of our own. To declare a model is easy in JSONClasses. Just declare a plain python class with type hint and decorate it with the convenient decorators. You can try to declare your own or paste the code into your project.

@api@pymongo@jsonclassclass Article:    id: str = types.readonly.str.primary.mongoid.required    title: str = types.str.trim.required    content: str    created_at: datetime = types.readonly.datetime.tscreated.required    updated_at: datetime = types.readonly.datetime.tsupdated.required

Start the Server#

Now type flask run to start the server. You can send HTTP requests documented in this guide to the server.

Going Next#