0.0.92 • Published 10 months ago

aca.ts v0.0.92

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

English | 中文文档

Aca.ts

ACA.ts is a fullstack development toolkit, which can automatically synchronize databases and generate database query APIs according to a typescript ORM document; Automatically generate the frontend access backend APIs according to the backend functions and database query APIs, so that the backend code can be developed on the frontend.

Use the class syntax of Typescript to define ORM:

  • Define a root namespace to represent your database
  • Define a table with a class (class name as table name)
  • Define a column or a relationship with a class property (property name as column name)
  • Add constraints to a table or a column with decorators

An example could be found below:

example-blog.ts

namespace db {
  export class user {
    id: id
    @$_.unique name: string
    age?: int
    married = false
    profile?: profile
    posts: post[]
  }

  export class profile {
    id: id
    password: string
    @$_.foreign('userId') user: user
  }

  @$.view('select "user"."id" as "userid", "user"."name", "user"."married", "user"."age", "profile"."password" from "user" left join "profile" as "profile" on "user"."id" = "profile"."userId"')
  class userProfile {
    userid: id
    @$_.unique name: string
    married = false
    age?: int
    password?: string
  }

  export class post {
    id: id
    content: string
    score: float
    @$_.foreign('userId') user: user
    categories: category[]
  }

  export class category {
    id: id
    name: string
    @$_.foreign('categoryId') parent?: category
    children: category[]
    posts: post[]
  }
}

Installation

npm install -g aca.ts

Usage

  1. Create an aca project:
$ aca create <projectName>
$ cd <projectName>
  1. Open .aca directory, copy your custom ORM file into the directory, and add this file name to config.json/orm field.
  1. Use the following method to create aca.ts apps:

Create a backend app (a simple koa framework):

$ aca server

Create a frontend app (a react app with create-react-app):

$ aca client

Add self built app to the project:

$ aca add <appName> --server --client --apiDir <path>
  path default: src/aca.server  src/aca.client
  1. Generate api
$ aca up

Then the database, frontend (if necessary), and backend are all set up, you can start your project now. Happy coding!

The generated backend APIs usage example are as follows:

The generated frontend APIs usage example are as follows:

Supported databases for now:

  • PostgreSQL
  • MSSQL
  • Better-Sqlite3
0.0.92

10 months ago

0.0.89

12 months ago

0.0.90

11 months ago

0.0.91

11 months ago

0.0.87

1 year ago

0.0.88

1 year ago

0.0.82

1 year ago

0.0.81

1 year ago

0.0.80

2 years ago

0.0.79

2 years ago

0.0.78

2 years ago

0.0.76

2 years ago

0.0.75

2 years ago

0.0.74

2 years ago

0.0.73

2 years ago

0.0.72

2 years ago

0.0.71

2 years ago

0.0.70

2 years ago

0.0.69

2 years ago

0.0.68

2 years ago

0.0.67

2 years ago

0.0.66

2 years ago

0.0.65

2 years ago

0.0.64

2 years ago

0.0.63

2 years ago

0.0.62

2 years ago

0.0.61

2 years ago

0.0.60

2 years ago

0.0.59

2 years ago

0.0.58

2 years ago

0.0.57

2 years ago

0.0.56

2 years ago

0.0.55

2 years ago

0.0.54

2 years ago

0.0.53

2 years ago

0.0.52

2 years ago

0.0.51

2 years ago

0.0.50

2 years ago

0.0.49

2 years ago

0.0.48

2 years ago

0.0.47

2 years ago

0.0.46

2 years ago

0.0.45

2 years ago

0.0.44

2 years ago

0.0.43

2 years ago

0.0.42

2 years ago

0.0.41

2 years ago

0.0.40

2 years ago

0.0.39

2 years ago

0.0.38

2 years ago

0.0.36

2 years ago

0.0.35

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago