1.0.3 • Published 6 months ago

@xkvip/shape-it v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

Why

Have you ever found yourself in a situation where you need to develop a a cutting-edge🤑 feature? For example, you have to create a ChatGPT API application that analyzes user sentences, shows them errors, and explains the grammatical rules. Then you realize it would be great to have a UI🤔, so you create one. But you also need a database to store the dialogue contexts—you get sidetracked🤨 by that, and now you need API endpoints to connect everything together😟. Now you find yourself writing unit tests😠 to finally stop testing manually, but now you’re testing for multiple users, and you need authentication😤, so you implement that. Then another developer joins you and asks for API documentation—now you’re writing😡 documentation for the API. Finally, you think😊 you can get back to... writing input validation🤬. You were supposed to be working on a cutting-edge feature, but hours, days (months?😱) have gone by, and you’re dealing with completely different tasks! And then, when you finally present your MVP, it crashes☠️ at the most critical moment! Why? Because you tested it differently than how users would actually use🤪 it and simply didn’t anticipate that.

This is why this project exists—you just shape the desired structure of the application in a config file, and the package, even at the generation stage, will notify you of potential issues and how to fix them😎. Then it will generate in a few seconds😇 what would have taken days—you can calmly implement your feature without worrying about everything else.🤝

Watch the video

Video 👆 See on YouTube

Feature list

  • Validation of the future application even at the generation stage
  • Generation of CRUD API for databases.
  • Validation of input data and forms using ZOD.
  • Generation of a CMS admin panel.
  • Generation of API endpoints.
  • Generation of API documentation according to the OpenAPI (Swagger) standard.
  • Generation of client-side pages.
  • Generation of unit tests.
  • Generation of authentication.
  • Generation of an API for an image storage.
  • Generation of a sitemap.

Get started

  1. Create a new SvelteKit application.
npx sv create my-app
cd my-app
npm install    
  1. Install Shape-it via npm
npm install @xkvip/shape-it
  1. In the root of the project, create a file shape-it.js.
import {ShapeIt} from '@xkvip/shape-it';

ShapeIt({      
    book:{
        $id:{
            type:'string'
        },

        name:{
            type:'string',
            min:10,
            max:500
        },

        description:{
            type:'string',
            max:1024,
            optional:true
        },
        zipCode:{
            type:"string",
            length:9
        },
        authors:{
            type:"Author[]",
            array:{
                max:10
            }
        }
        ...
    },

    Author:{
        $id:{
            type:'number'
        },
        name:{
            type:"string",
        }
    }
    ...
})
  1. Open package.json and add the following command to section "scripts".
{    
    "scripts":{
       "shape-it":"node shape-it.js",       
    }
}
  1. Run
npm run shape-it
  1. Fix errors. When done, run:
npm run dev
  1. Open webiste and go to /admin and explore.
login: admin
password: admin
  1. Go to /api and explore.
  2. Back to code. Open docs/swagger.json Copy. Navigate to https://editor-next.swagger.io/ and paste.

  3. Checkout API-reference

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago