0.4.8 ā€¢ Published 4 years ago

desolid v0.4.8

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

šŸ¤– Desolid: Single file BaaS

Open source, single file, self hosted, Backend as a service.

Documentation: https://desolid.netlify.app/

Blog: https://dev.to/desolid

Features

  • GraphQL API: CRUDs
  • Authentication & Authorization: inline definition
  • File storage: Local and S3 support
  • Database agnostic: SQLite, MariaDB, PostgreSQL, MS SQL Server

Quick start

Let's create an api for a blog service:

  1. Install NodeJS
  2. Create a desolid schema file: schema.graphql

    extend enum UserGroup {
        Editor
        Author
    }
    
    extend type User
        @model
        @authorization(
            CREATE: [Admin, Editor]
            READ: [Admin, "$user.id == {{id}}"]
            UPDATE: [Admin, "$user.id == {{id}}"]
            DELETE: [Admin] #
        ) {
        avatar: File @upload(accept: ["image/jpeg"], size: { max: "5", min: "0.1" })
    }
    
    """
    This is a description of a Post
    """
    type Post
        @model
        @authorization(
            READ: [Admin, Editor, "{{published}} || $user.id == {{author.id}}"]
            CREATE: [Admin, Editor, "$user.group == 'Author' && !$input.published"]
            UPDATE: [Admin, Editor, "$user.id == {{author.id}} && !$input.published"]
            DELETE: [Admin, Editor, "!{{published}} && $user.id == {{author.id}}"] #
        ) {
        id: ID!
        createdAt: DateTime!
        updatedAt: DateTime!
        author: User!
        title: String!
        content: String!
        published: Boolean!
        categories: [Category]
    }
    
    """
    This is a description of a Category
    """
    type Category
        @model
        @authorization(
            CREATE: [Admin, Editor]
            UPDATE: [Admin, Editor]
            DELETE: [Admin, Editor] #
        ) {
        id: ID!
        createdAt: DateTime!
        updatedAt: DateTime!
        name: String!
        posts: [Post]
    }
  3. Run this command on your terminal

    npx desolid
    • Compiles the schema and creates CRUDs
    • Creates and uses by default a SQLite database on the root ./database.sqlite
    • Stores files under ./upload directory
    • Logs errors and warnings on ./desolid.log file
    • Must output something like this:
____                         _   _       _
|  _ \    ___   ___    ___   | | (_)   __| |
| | | |  / _ \ / __|  / _ \  | | | |  / _` |
| |_| | |  __/ \__ \ | (_) | | | | | | (_| |
|____/   \___| |___/  \___/  |_| |_|  \__,_|

šŸ¤– Desolid: Single file self hosted backend as a service
šŸ”„ v0.2.11 running in "win32" on "./home/user/app"

[2020-05-20 10:38:57]  INFO  Compiling Schema ...
[2020-05-20 10:38:57]  WARN  Authentication Secret value didn't set into configuration file. the genrated JWT tokens will expire on every restart.
[2020-05-20 10:38:57]  INFO  Connecting to database ...
[2020-05-20 10:38:57]  INFO  Connected to "sqlite://./databse.sqlite"
[2020-05-20 10:38:57]  INFO  Starting server ...
[2020-05-20 10:38:57]  INFO  Server is running on http://localhost:3000
[2020-05-20 10:38:57]  INFO  šŸš€ in 488ms
  1. Open http://localhost:3000/ on your browser.

Acknowledgement

This project is based On these cool stuffs:

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago