Skip to content

Xeno CLI: Generated Project Structure, Files & Dependencies Reference

Project Structure, File Artifacts & Dependency Mapping

Section titled “Project Structure, File Artifacts & Dependency Mapping”

When @xeno-js/cli executes the scaffolding pipeline, its internal generators evaluate the active ScaffoldingOptions matrix to output a structured project hierarchy, tailored dependencies, and type-safe bootstrap configurations.


Depending on the flags or prompt options chosen, the CLI populates the project directory with the following artifacts:

<target-directory>/
├── .env.example # Environment variable key placeholders
├── .gitignore # Git tracking rules
├── drizzle.config.ts # (Optional) Drizzle ORM configuration
├── package.json # Target scripts and module dependencies
├── tsconfig.json # TypeScript compiler configuration
├── README.md # Project quickstart guide & architecture docs
└── src/
├── bootstrap.ts # Programmatic AppBuilder pipeline assembly
├── main.ts # Application entry point orchestrator
├── registry.ts # Type-safe IoC XenoRegistry definitions
├── schema.ts # (Optional) PostgreSQL table schema definitions
└── infrastructure/
└── db/
└── sqlite-schema.ts # (Optional) SQLite/libSQL table schema definitions

2. Dynamic Dependency Mapping (package.json)

Section titled “2. Dynamic Dependency Mapping (package.json)”

The CLI dynamically populates dependencies and devDependencies based on your module selections:

Baseline Core Dependencies (Always Included)

Section titled “Baseline Core Dependencies (Always Included)”
  • @xeno-js/core: latest — Framework kernel and CQRS abstractions.

  • dotenv: ^16.4.5 — Environment variable loader.

  • DevDependencies: @xeno-js/cli (latest), tsx (^4.7.0), typescript (^5.4.0), @types/node (^20.0.0).

Selected Feature Prompt / Flag Installed dependencies Installed devDependencies
Validation (zod) zod (^4.4.3)
Database: Postgres (database) drizzle-orm (^0.45.2), pg (^8.22.0), postgres (^3.4.9) drizzle-kit (^0.31.10), @types/pg (^8.11.0)
Database: SQLite (sqlLite) @libsql/client (^0.14.0) drizzle-kit (^0.31.10)
HTTP Client (http) axios (^1.16.1), cockatiel (^4.0.0)
Auth (supabase) @supabase/supabase-js (^2.35.0)
Logging (logging) pino (^10.3.1) pino-pretty (^11.2.2)
Error Tracking (sentry) @sentry/node (^7.64.0)
Caching (redis) ioredis (^5.3.1)

Note on NPM Scripts: If either PostgreSQL or SQLite is selected, the CLI injects database scripts into package.json: "db:generate": "drizzle-kit generate", "db:push": "drizzle-kit push", and "db:migrate": "drizzle-kit migrate".


3. Detailed File Breakdown & Generated Source Code

Section titled “3. Detailed File Breakdown & Generated Source Code”

The orchestrator script that invokes bootstrap() and boots transport services:

import { bootstrap } from './bootstrap.js'
async function main() {
try {
console.log('Bootstrapping @xeno application...')
// Initializes IoC container and infrastructure modules
const container = await bootstrap()
console.log('Application started successfully!')
} catch (error) {
console.error('Critical error during startup:', error)
process.exit(1)
}
}
main()

B. Programmatic Pipeline Assembly (src/bootstrap.ts)

Section titled “B. Programmatic Pipeline Assembly (src/bootstrap.ts)”

Generated dynamically by BootstrapGenerator, assembling selected modules inside AppBuilder:

import { AppBuilder, LOG_LEVEL } from '@xeno-js/core'
import { MyRegistry } from './registry'
export async function bootstrap() {
const builder = new AppBuilder<MyRegistry>()
// 1. Database Module (PostgreSQL example)
builder.addDb((opts, config) => {
opts.connectionString = config.getOrThrow('DATABASE_URL')
})
// 2. HTTP Core Module
builder.addHttpCore((opts, config) => {
opts.http.client.baseURL = config.getOrThrow('HTTP_BASE_URL')
opts.resilience.retry.attempts =
Number(config.get('HTTP_RETRY_ATTEMPTS')) ?? 3
})
// 3. Cache Module (Redis)
builder.addCache((opts, config) => {
opts.inMemory = false
opts.redis = {
host: config.getOrThrow('REDIS_HOST'),
port: Number(config.get('REDIS_PORT')) ?? 6379,
password: config.get('REDIS_PASSWORD') ?? '',
username: config.get('REDIS_USERNAME') ?? '',
tls: config.get('REDIS_TLS') === 'true',
maxRetriesPerRequest: 3,
}
})
// 4. Authentication Module
builder.addAuth((opts, config) => {
opts.url = config.getOrThrow('SUPABASE_URL')
opts.key = config.getOrThrow('SUPABASE_KEY')
})
// 5. Logger Module
builder.addLogger((opts, config) => {
opts.level = (config.get('LOG_LEVEL') as any) ?? LOG_LEVEL.INFO
opts.console = false
})
return await builder.build()
}

C. Type-Safe Injection Registry (src/registry.ts)

Section titled “C. Type-Safe Injection Registry (src/registry.ts)”

Provides the interface extension point for defining IoC container injection tokens:

import { XenoRegistry } from '@xeno-js/core'
// export interface MyRegistry extends XenoRegistry<{ /** Db Schema **/ }> {
// MY_SERVICE: MyService;
// }

D. Database Schema & Drizzle Configuration

Section titled “D. Database Schema & Drizzle Configuration”

Depending on the persistence choice:

  • PostgreSQL (drizzle.config.ts & src/schema.ts): Configures dialect: 'postgresql', links process.env.DATABASE_URL, and creates an example usersTable using drizzle-orm/pg-core.

  • SQLite (drizzle.config.ts & src/infrastructure/db/sqlite-schema.ts): Configures dialect: 'sqlite', links process.env.SQLITE_DATABASE_URL, and creates an example tenantsTable using drizzle-orm/libsql.


E. Environment Key Placeholders (.env.example)

Section titled “E. Environment Key Placeholders (.env.example)”

EnvGenerator creates an environment documentation file matching enabled drivers:

# Xeno APPLICATION ENVIRONMENT VARIABLES
NODE_ENV=development
# --- Database (Drizzle & PG) ---
DATABASE_URL=postgres://postgres:password@localhost:5432/xeno_db
# --- HTTP Client (Axios & Cockatiel) ---
HTTP_BASE_URL=https://api.example.com
HTTP_TIMEOUT_MS=5000
HTTP_RETRY_ATTEMPTS=3
# --- Cache (Redis) ---
REDIS_HOST=localhost
REDIS_PORT=6379
# --- Authentication (Supabase) ---
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-anon-key
# --- Logging (Pino) ---
LOG_LEVEL=debug

Xeno is an MIT-licensed open source project. It can grow thanks to the support of these awesome people. If you’d like to join them, please read more at support section