MCPcopy Index your code
hub / github.com/camesine/Typescript-restful-starter

github.com/camesine/Typescript-restful-starter @1.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.4.0 ↗ · + Follow
48 symbols 102 edges 16 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Typescript-restful-starter

Node.js + ExpressJS + TypeOrm + Typescript + JWT + ES2015 + Clustering + Tslint + Mocha + Chai + Supertest

What use is this Starter App?

  • JWT for protecting routes.
  • Clustering mode for loading many forks depending of the CPU's units.
  • Typeorm for ORM.
  • ES2015 the lastest javascript version has promises and async/await
  • Mocha - Chai for testing
  • Supertest to load the entire server into the tests seamlessly

Structure

/app
    /controllers (Controllers of the app)
    /middlewares (Middlewares for the routes of the app)
    /routes (Routes for Controllers of the app)
    /service (Services for using in any Controller)
    /entity (Models configuration for use)
    /repository (Custom queries)
/config
    /Router.ts (Config file for Routing)
    /Database (DB configuration for use)
    /Server.ts (Server configuration)
config.ts (Config file for the app)
tsconfig.json (File configuration typescript)
tslint.json (File configuration rules typescript)
Index.ts (Main file to start the app)

Install

  1. First clone this repository. git@github.com:camesine/Typescript-restful-starter.git
  2. Download all dependencies. npm install
  3. Edit the file ./config.ts with your own settings:


const LOCAL_CONFIGURATION = {
    SERVER: "127.0.0.1",
    PORT_DB: 3306,
    DB: "test",
    USER_DB: "root",
    PASSWORD: "",
    DIALECT: "mysql",
}

const PRODUCTION_CONFIGURATION = {
    SERVER: process.env.SERVER || 'localhost',
    DB: process.env.DB || "prod",
    PORT_DB: process.env.PORT_DB || 3306,
    USER_DB: process.env.USER_DB || 'root',
    PASSWORD: process.env.PASSWORD || '',
    DIALECT: process.env.DIALECT || 'mysql',
}

export const config = {
    SECRET: "HltH3R3",
    PORT_APP: 1344,
    DATABASE: process.env.NODE_ENV === 'PRODUCTION' ? PRODUCTION_CONFIGURATION : LOCAL_CONFIGURATION
}


Start App

When execute any of this commands the app start with clustering, creating many cluster apps depending of the numbers of CPU's your computer had.

Development: In Development mode the express app is starter with nodemon for automatic refresh when do changes.

npm run dev

Test: Run test in development environment

npm test

Production: Run app in production environment

npm start

Extension points exported contracts — how you extend this code

IROUTER (Interface)
(no doc)
config/Router.ts

Core symbols most depended-on inside this repo

delete
called by 3
app/controllers/Sample.controller.ts
findOneById
called by 3
app/services/Sample.service.ts
remove
called by 3
app/services/Sample.service.ts
save
called by 3
app/services/Sample.service.ts
signToken
called by 2
app/services/Jwt.service.ts
Start
called by 2
config/Server.ts
all
called by 1
app/controllers/Sample.controller.ts
find
called by 1
app/controllers/Sample.controller.ts

Shape

Method 29
Class 18
Interface 1

Languages

TypeScript100%

Modules by API surface

app/services/Sample.service.ts9 symbols
config/Server.ts8 symbols
app/controllers/Sample.controller.ts8 symbols
app/repository/Sample.repository.ts6 symbols
app/services/Jwt.service.ts4 symbols
app/controllers/Jwt.controller.ts4 symbols
app/routes/Sample.route.ts3 symbols
app/routes/Jwt.route.ts3 symbols
app/models/Sample.model.ts2 symbols
config/Router.ts1 symbols

For agents

$ claude mcp add Typescript-restful-starter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact