Skip to content

Latest commit

 

History

History
93 lines (67 loc) · 2.74 KB

README.md

File metadata and controls

93 lines (67 loc) · 2.74 KB

Kickstart

Kickstart is a monorepo boilerplate based on TS to start building something cool.

Features

Docker image building

API

To build backend part, simply run npx nx docker-build kickstart.

OpenAPI Integration

Kickstart supports NestJS built-in OpenAPI/Swagger implementation available at http://localhost:3333/api/.

Database Integration

Kickstart has database integration with TypeORM. Built-in integration is configured to work with MongoDB. To avoid type-specific discrepancies of primary key in mongodb ( named id and cast to String) using MongoDB ObjectIdColumn decorator.

Basic database entity interface defined as follows:

export interface Entity {
  id: string;
}

Authentication

Kickstart uses passport framework for auth under the hood. Current implementation has authentication using username/password pair, returning JWT, which can be used in further authorized requests. For more details, please refer to OpenAPI docs (section auth).

Sessions and JWT blacklisting is the subject of possible further development.

User management

To support user management, Kickstart has the following basic entity:

export interface User extends Entity {
  username: string;
  role: Role;
  hashedPassword: string;
}

Kickstart codebase also supports ability to create a user without any authentication, get/update authorized user's profile based on passed credentials, get/list/update/delete any user for users having role === Role.Admin. For more details, please refer to OpenAPI docs (section users).

Role-based access control

Kickstart contains integrated RBAC with the following basic Role structure, which can be assigned to a user:

export enum Role {
  Regular = 'regular',
  Admin = 'admin',
}

If route/controller must be restricted by some role, it can be done by combination of the following decorators:

@Controller()
@UseGuards(AuthGuard('jwt'), RoleGuard)
@Roles([Role.Admin])
class AdminRestrictedController {
  // TODO: your controller's logic
}

More features TBD on demand.