Skip to content

GlassworkTransparent Serverless Framework

Build OpenAPI-compliant REST APIs with clean architecture, zero magic, and Lambda-first design.

Glasswork

Quick Example โ€‹

typescript
import { defineModule, bootstrap, route, createRoutes } from 'glasswork';
import { object, string } from 'valibot';

// 1. Define your DTOs with Valibot
const LoginDto = object({
  email: pipe(string(), email()),
  password: pipe(string(), minLength(8)),
});

const SessionDto = object({
  token: string(),
  expiresAt: string(),
});

// 2. Create type-safe routes
export const authRoutes = createRoutes((router, { authService }, route) => {
  router.post('/login', ...route({
    tags: ['Auth'],
    summary: 'User login',
    public: true,
    body: LoginDto,
    responses: { 200: SessionDto },
    handler: ({ body }) => {
      // Body is fully typed from LoginDto
      return authService.login(body.email, body.password);
    },
  }));
});

// 3. Define modules
export const AuthModule = defineModule({
  name: 'auth',
  basePath: 'auth',
  providers: [AuthService],
  routes: authRoutes,
});

// 4. Bootstrap
const { app } = bootstrap(AuthModule, {
  openapi: { enabled: true }
});

export default app; // Ready for Lambda or local server

Your OpenAPI spec is automatically generated at /api/openapi.json.


Why Glasswork? โ€‹

Glasswork provides NestJS-style architecture optimized for serverless deployment.

It uses common patterns from NestJS (modules, DI, OpenAPI) with smaller bundle sizes and Lambda-optimized performance:

Optimized For โ€‹

  • Lambda-first projects
  • MVPs and hobby APIs
  • Services where bundle size matters
  • Teams that value clean architecture

Consider Alternatives โ€‹

  • GraphQL? Use Apollo Server or Pothos
  • Container deployment? NestJS is excellent for this
  • Full-stack app? Use Next.js or Remix
  • Minimal framework? Use Hono directly

Released under the MIT License.