Lab 15: Capstone — Enterprise Platform

Time: 60 minutes | Level: Architect | Docker: node:20-alpine

Overview

Build a complete enterprise TypeScript platform integrating all concepts from Labs 01–14: Effect-TS typed effects + DI, Drizzle ORM, Pothos GraphQL, fp-ts pipelines, Zod→OpenAPI, Vitest type tests, branded security types, and OpenTelemetry spans.


Step 1: Platform Architecture

platform/
├── src/
│   ├── telemetry/
│   │   └── sdk.ts              # OTel setup
│   ├── db/
│   │   ├── schema.ts           # Drizzle schema + type exports
│   │   └── index.ts            # Database connection
│   ├── domain/
│   │   ├── types.ts            # Domain types + branded types
│   │   ├── schemas.ts          # Zod schemas → OpenAPI
│   │   └── errors.ts           # Tagged error types
│   ├── services/
│   │   ├── UserService.ts      # Effect-TS service with DI
│   │   └── OrderService.ts     # fp-ts ReaderTaskEither
│   ├── graphql/
│   │   ├── builder.ts          # Pothos builder
│   │   └── schema.ts           # Schema definition
│   └── server.ts               # GraphQL Yoga server
└── tests/
    ├── types.test-d.ts         # Type-level tests
    └── services.test.ts        # Vitest + fast-check

Step 2: Domain Types + Branded Types


Step 3: Zod Schemas → OpenAPI


Step 4: Effect-TS Service with DI


Step 5: fp-ts ReaderTaskEither Pipeline


Step 6: Pothos GraphQL Schema


Step 7: Vitest Type Tests + Property-Based


Step 8: Capstone — Full Integration Verification

📸 Verified Output:


Summary

Component
Technology
Status

Type system

Branded types + satisfies

✅ Compile-time safety

Compiler

ts-morph AST transforms

✅ Auto-inject logging

Monorepo

npm workspaces + tsc refs

✅ Incremental builds

Runtime safety

Zod → OpenAPI

✅ Schema-first

FP patterns

fp-ts ReaderTaskEither

✅ Typed DI + errors

Effect system

Effect-TS gen + Layer

✅ Structured effects

Database

Drizzle ORM + Kysely

✅ Type-inferred SQL

GraphQL

Pothos + Yoga

✅ Code-first typed

Testing

Vitest + fast-check

✅ Type + property tests

Observability

OpenTelemetry spans

✅ Typed attributes

AI Integration

Vercel AI SDK + Zod

✅ Structured output

Last updated