Kickstart is a monorepo boilerplate based on TS to start building something cool.
- Monorepo based on NX
- Docker image build
- Backend/API implemented using NestJS
- OpenAPI integration
- Role-based access control
- Database integration
- Authentication
- User management
- Microservices support
- Pagination
- Health checks
- Monitoring
- Webhooks support
To build backend part, simply run npx nx docker-build kickstart
.
Kickstart supports NestJS built-in OpenAPI/Swagger implementation available at http://localhost:3333/api/.
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;
}
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.
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
).
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.