Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aca.ts

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aca.ts

ACA.ts is a fullstack development toolkit, which can automatically synchronize database schema and generate database query APIs according to a typescript ORM document; Automatically generate the client access server APIs according to the server functions

  • 0.0.75
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

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
  }

  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

Keywords

FAQs

Package last updated on 08 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc