Protobuf definitions and generated TypeScript types
npm install @3d-outlet/contractsProtobuf definitions and generated TypeScript types for 3D OUTLET microservices


---
- š Protobuf Definitions - Type-safe gRPC service definitions
- š¦ TypeScript Types - Auto-generated TypeScript interfaces from .proto files
- š NestJS Integration - Ready-to-use with NestJS microservices
- š Event Types - Shared event interfaces for inter-service communication
- š Type Safety - Full type checking across microservices
---
``bash`
npm install @3d-outlet/contractsor
pnpm add @3d-outlet/contractsor
yarn add @3d-outlet/contractsor
bun add @3d-outlet/contracts
---
`typescript
import { PROTO_PATHS } from '@3d-outlet/contracts'
// In your NestJS microservice
const app = await NestFactory.createMicroservice(AppModule, {
transport: Transport.GRPC,
options: {
protoPath: PROTO_PATHS.AUTH,
package: 'auth.v1'
}
})
`
`typescript
import { SendOtpRequest, SendOtpResponse } from '@3d-outlet/contracts'
async function sendOtp(data: SendOtpRequest): Promise
// Type-safe implementation
return { ok: true }
}
`
`typescript
import { OtpRequestedEvent } from '@3d-outlet/contracts'
function handleOtpRequested(event: OtpRequestedEvent) {
console.log(OTP requested for ${event.identifier})`
}
---
``
contracts/
āāā proto/ # Protobuf definition files
ā āāā auth.proto # Authentication service definitions
āāā gen/ # Generated TypeScript files (auto-generated)
ā āāā ts/
āāā src/ # Source TypeScript files
ā āāā events/ # Event interfaces
ā ā āāā auth/ # Auth-related events
ā āāā proto/ # Proto path utilities
āāā dist/ # Compiled JavaScript (after build)
---
- Node.js: >= 16.0.0
- protoc: Protocol Buffer compiler
- TypeScript: ^5.9.3
macOS:
`bash`
brew install protobuf
Ubuntu/Debian:
`bash`
sudo apt-get update && sudo apt-get install -y protobuf-compiler
Windows: Download from
`bashInstall dependencies
npm installor
pnpm installor
bun install
---
š Available Services
$3
Authentication and authorization service with OTP-based authentication.
RPC Methods:
-
SendOtp - Send OTP code to user
- VerifyOtp - Verify OTP code and get tokens
- Refresh - Refresh access tokenExample:
`typescript
import { AuthServiceController } from '@3d-outlet/contracts'@Controller()
export class AuthController implements AuthServiceController {
async sendOtp(request: SendOtpRequest): Promise {
// Implementation
return { ok: true }
}
}
`---
šÆ Usage in NestJS
$3
`typescript
import { ClientGrpc } from '@nestjs/microservices'
import { AuthServiceClient } from '@3d-outlet/contracts'@Injectable()
export class AuthClient {
private authService: AuthServiceClient
constructor(@Inject('AUTH_PACKAGE') private client: ClientGrpc) {}
onModuleInit() {
this.authService = this.client.getService('AuthService')
}
async sendOtp(identifier: string, type: string) {
return this.authService.sendOtp({ identifier, type })
}
}
`$3
`typescript
import { PROTO_PATHS } from '@3d-outlet/contracts'// In main.ts or app.module.ts
const microserviceOptions: MicroserviceOptions = {
transport: Transport.GRPC,
options: {
protoPath: PROTO_PATHS.AUTH,
package: 'auth.v1',
url: '0.0.0.0:5000'
}
}
``---
ISC Ā© TeaCoder & Ilnaz Mingaleev
---
TeaCoder (Vadim)
- Email: admin@teacoder.ru
Ilnaz Mingaleev
- Email: development@teamkaif.com
---
Made with ā¤ļø for the 3D OUTLET project (private repo)
Internal use only.