Project Structure
A reference layout for a Titan-based project. The Omnitron monorepo itself follows this shape; consumer projects do not need to be a monorepo to use the same conventions.
Single-app layout
src/modules/users/users.service.tsusers.module.tsusers.types.ts
orders/
app.module.ts— Root module that imports the restmain.ts— Application.create + start
tsconfig.jsonpackage.json
Monorepo layout
For multi-service projects, mirror the Omnitron monorepo:
apps/api/— Titan service exposed over HTTP/WSworker/— Titan service exposed over TCP onlyweb/— React frontend (Prism + netron-react)
packages/shared-types/— Service interfaces shared by all appsshared-modules/— Reusable Titan modules
pnpm-workspace.yamlturbo.json
pnpm-workspace.yaml
packages:
- apps/*
- packages/*Sharing service types
Service interfaces should live in a shared package so both the server
implementation and the client queryInterface<T>() call see the same type:
src/users.contract.ts—interface UsersContract { … }orders.contract.ts
package.json
The server class implements the contract; the client parameterises
queryInterface<UsersContract>() against it.
Configuration
Titan's ConfigModule reads from any combination of files, env vars, and
schema-validated overrides. A typical project:
config/default.yaml— Defaults that apply everywheredevelopment.yaml— Local-dev overridesproduction.yaml— Prod overrides
src/app.module.ts— Root module and configuration registration
See ConfigModule for configuration sources, validation and precedence.
Conventions
Module per bounded context. Group services, repositories, and schemas by domain, not by layer.
Contracts in a shared package. Keep
*.contract.tsfiles free of runtime imports so the browser bundle does not pull in the server.One
main.tsper app. The root file bootsApplication.create; it should be the only entrypoint that performs side effects at import time.