{"id":26442510,"url":"https://github.com/alt-javascript/boot","last_synced_at":"2026-04-01T21:07:42.600Z","repository":{"id":346233045,"uuid":"1187681466","full_name":"alt-javascript/boot","owner":"alt-javascript","description":"A Spring-inspired IoC / DI application framework for pure JavaScript.","archived":false,"fork":false,"pushed_at":"2026-03-21T04:50:10.000Z","size":413,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-23T16:30:07.627Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alt-javascript.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-21T02:40:03.000Z","updated_at":"2026-03-21T04:49:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/alt-javascript/boot","commit_stats":null,"previous_names":["alt-javascript/boot"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/alt-javascript/boot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fboot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fboot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fboot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fboot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alt-javascript","download_url":"https://codeload.github.com/alt-javascript/boot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alt-javascript%2Fboot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292006,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-18T10:19:45.078Z","updated_at":"2026-04-01T21:07:42.579Z","avatar_url":"https://github.com/alt-javascript.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @alt-javascript\n\n[![Language](https://img.shields.io/badge/language-JavaScript-yellow.svg)](https://developer.mozilla.org/en-US/docs/Web/JavaScript)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![CI](https://github.com/alt-javascript/boot/actions/workflows/node.js.yml/badge.svg)](https://github.com/alt-javascript/boot/actions/workflows/node.js.yml)\n\nA Spring Framework inspired lite IoC / DI application framework for pure JavaScript.\n\nDependency injection, hierarchical configuration, structured logging, lifecycle management, application events, AOP, profile-based activation, and a CDI middleware pipeline — all in ES modules that run identically in Node.js and the browser, with no TypeScript and no build step required.\n\n## Why\n\nJavaScript has mature DI frameworks, but they require TypeScript decorators (InversifyJS, tsyringe, NestJS) or build tooling. If you want structured dependency injection in a project that stays in pure JavaScript — or if you want the same IoC code to run server-side and in a `\u003cscript type=\"module\"\u003e` tag — your options are limited.\n\n`@alt-javascript` fills that gap. It brings Spring's proven patterns to the JavaScript ecosystem without requiring a transpiler, bundler, or type system.\n\n## Quick Start\n\n```bash\nnpm install @alt-javascript/boot @alt-javascript/cdi @alt-javascript/config @alt-javascript/logger\n```\n\n```javascript\nimport { Boot } from '@alt-javascript/boot';\nimport { ApplicationContext, Context, Singleton } from '@alt-javascript/cdi';\nimport { EphemeralConfig } from '@alt-javascript/config';\n\nclass UserRepository {\n  constructor() { this.users = []; }\n  add(user) { this.users.push(user); }\n  findAll() { return this.users; }\n}\n\nclass UserService {\n  constructor() { this.userRepository = null; } // autowired by name\n  createUser(name) { this.userRepository.add({ name }); }\n}\n\nconst config = new EphemeralConfig({ logging: { level: { ROOT: 'info' } } });\nBoot.boot({ config });\n\nconst context = new Context([\n  new Singleton(UserRepository),\n  new Singleton(UserService),\n]);\n\nconst appCtx = new ApplicationContext({ contexts: [context], config });\nawait appCtx.start();\n\nconst userService = appCtx.get('userService');\nuserService.createUser('Craig');\nconsole.log(appCtx.get('userRepository').findAll()); // [{ name: 'Craig' }]\n```\n\n## Packages\n\n### Core\n\n| Package | Purpose |\n|---|---|\n| [`@alt-javascript/boot`](packages/boot) | Application bootstrap — environment detection, config resolution, global context, middleware pipeline |\n| [`@alt-javascript/cdi`](packages/cdi) | IoC container — components, autowiring, lifecycle, events, AOP, conditions |\n| [`@alt-javascript/config`](packages/config) | Hierarchical config — profiles, property sources, `.env` files, placeholder resolution |\n| [`@alt-javascript/logger`](packages/logger) | Pluggable logging — config-driven levels, category caching, console/Winston |\n| [`@alt-javascript/common`](packages/common) | Shared kernel — environment detection, global reference resolution |\n\n### Database\n\n| Package | Purpose |\n|---|---|\n| [`@alt-javascript/jsdbc-template`](packages/jsdbc-template) | JsdbcTemplate + NamedParameterJsdbcTemplate — CDI-managed database access |\n| [`@alt-javascript/flyway`](packages/flyway) | Flyway-inspired database migrations in JavaScript |\n| [`@alt-javascript/boot-flyway`](packages/boot-flyway) | CDI auto-configuration for Flyway migrations |\n| [`@alt-javascript/boot-jsdbc`](packages/boot-jsdbc) | CDI auto-configuration for JSDBC data sources |\n| [`@alt-javascript/boot-jsnosqlc`](packages/boot-jsnosqlc) | CDI auto-configuration for NoSQL clients |\n\n### HTTP Adapters\n\nAll HTTP adapters share the same controller convention (`static __routes`) and the same middleware pipeline (`static __middleware`). Middleware written once works across every adapter.\n\n| Package | Purpose |\n|---|---|\n| [`@alt-javascript/boot-express`](packages/boot-express) | Express adapter |\n| [`@alt-javascript/boot-fastify`](packages/boot-fastify) | Fastify adapter |\n| [`@alt-javascript/boot-koa`](packages/boot-koa) | Koa adapter with built-in JSON body parser |\n| [`@alt-javascript/boot-hono`](packages/boot-hono) | Hono adapter (Web Standards API — Node.js, Bun, Deno, CF Workers) |\n| [`@alt-javascript/boot-lambda`](packages/boot-lambda) | AWS Lambda adapter (API Gateway HTTP API v2) |\n| [`@alt-javascript/boot-cloudflare-worker`](packages/boot-cloudflare-worker) | Cloudflare Workers adapter |\n| [`@alt-javascript/boot-azure-function`](packages/boot-azure-function) | Azure Functions adapter |\n\n### Frontend Adapters\n\n| Package | Purpose |\n|---|---|\n| [`@alt-javascript/boot-vue`](packages/boot-vue) | Vue 3 integration — CDI services via provide/inject |\n| [`@alt-javascript/boot-alpine`](packages/boot-alpine) | Alpine.js integration — CDI services via Alpine.store |\n| [`@alt-javascript/boot-react`](packages/boot-react) | React integration — CdiProvider, useCdi, useBean hooks |\n| [`@alt-javascript/boot-angular`](packages/boot-angular) | Angular integration — CDI beans as Angular providers |\n\n## Middleware Pipeline\n\nThe middleware pipeline is the CDI equivalent of Spring Security's filter chain or Express middleware. Any CDI component with `static __middleware = { order: N }` participates in the pipeline automatically — lower order runs outermost.\n\n```javascript\n// Declare a middleware component — same as any other CDI bean\nclass AuthMiddleware {\n  static __middleware = { order: 5 }; // outermost (runs first in, last out)\n\n  constructor() { this.logger = null; } // autowired\n\n  async handle(request, next) {\n    const token = request.headers.authorization?.replace('Bearer ', '');\n    if (!token) return { statusCode: 401, body: { error: 'Unauthorized' } };\n    return next({ ...request, user: decodeToken(token) });\n  }\n}\n\n// Register alongside controllers — no other wiring needed\nconst context = new Context([\n  ...expressStarter(),\n  new Singleton(AuthMiddleware),   // picked up automatically\n  new Singleton(MyController),\n]);\n```\n\nThree built-in middleware components are registered by every `*Starter()`:\n\n| Component | Order | Behaviour |\n|---|---|---|\n| `RequestLoggerMiddleware` | 10 | Logs `[METHOD] /path → status (Xms)` via CDI logger |\n| `ErrorHandlerMiddleware` | 20 | Converts unhandled exceptions to `{ statusCode, body: { error } }` |\n| `NotFoundMiddleware` | 30 | Returns 404 when no route matches |\n\nDisable any built-in via config: `middleware.requestLogger.enabled: false`.\n\n## Design Principles\n\n**Pure JavaScript.** No TypeScript. No decorators. No transpilation. Every source file is a standard ES module that Node.js and browsers execute directly.\n\n**Isomorphic.** The same code runs in Node.js and as `\u003cscript type=\"module\"\u003e` in the browser.\n\n**Spring-inspired, not Spring-cloned.** The patterns come from Spring. The implementation is idiomatic JavaScript — null-property naming instead of annotations, plain class statics instead of decorator metadata, `NODE_ACTIVE_PROFILES` instead of `spring.profiles.active`.\n\n**Convention over configuration.** Autowiring by name. Profile activation via `NODE_ACTIVE_PROFILES`. Config file discovery follows `application-{profile}.{json,yaml,yml,properties,.env}`.\n\n## Documentation\n\n- **[Getting Started](docs/getting-started.md)** — Build a working app from scratch\n- **[Dependency Injection](docs/dependency-injection.md)** — Contexts, components, scopes, autowiring\n- **[Configuration](docs/configuration.md)** — Property sources, profiles, environment variables, `.env` files\n- **[Lifecycle \u0026 Events](docs/lifecycle.md)** — init/start/run/stop/destroy, BeanPostProcessor\n- **[Middleware Pipeline](docs/middleware.md)** — Cross-cutting concerns: auth, logging, error handling, 404\n- **[Advanced Features](docs/advanced.md)** — AOP, auto-discovery, conditional beans, primary beans\n- **[Database Access](docs/database.md)** — JsdbcTemplate, named parameters, auto-configuration\n- **[HTTP Adapters](docs/http-adapters.md)** — Express, Fastify, Koa, Hono, Lambda, Cloudflare Workers, Azure Functions\n- **[Frontend Integration](docs/frontend-integration.md)** — Vue, Alpine, React, Angular + browser profiles\n- **[Browser Usage](docs/browser.md)** — ESM imports, CDN, import maps\n- **[Spring Comparison](docs/spring-comparison.md)** — Conceptual migration guide\n- **[API Reference](docs/api-reference.md)** — All exports, all packages\n- **[Decisions](decisions/)** — Architecture Decision Records\n\n## License\n\nMIT — Copyright (c) 2021–2026 Craig Parravicini\n\n## Spring Framework Attribution\n\nThe design of `@alt-javascript` is directly influenced by the [Spring Framework](https://spring.io/projects/spring-framework) and [Spring Boot](https://spring.io/projects/spring-boot).\n\nSpecific concepts ported from Spring:\n\n| Spring concept | @alt-javascript equivalent |\n|---|---|\n| `ApplicationContext` | `@alt-javascript/cdi` `ApplicationContext` |\n| `@Component`, `@Service`, `@Repository` | `Singleton`, `Service`, `ComponentRegistry` |\n| `@Autowired` (field injection) | Null-property naming convention (`this.service = null`) |\n| `@Value(\"${key:default}\")` | Property placeholder strings in component constructors |\n| `@PostConstruct` / `@PreDestroy` | `init()` / `destroy()` lifecycle methods |\n| `BeanPostProcessor` | `BeanPostProcessor` |\n| `ApplicationEvent` / `ApplicationListener` | `ApplicationEvent`, event bus in `ApplicationContext` |\n| `@Conditional` / `@ConditionalOnProperty` | `conditionalOnProperty`, `conditionalOnMissingBean` etc. |\n| `@EnableAutoConfiguration` / starters | `expressStarter()`, `fastifyStarter()`, etc. |\n| `@Aspect` / AOP Alliance | `createProxy()`, `matchMethod()`, advice functions |\n| `Environment` / `PropertySource` | `PropertySourceChain`, `EnvPropertySource` |\n| `application.properties` / `application.yml` | `ProfileConfigLoader` — same file conventions |\n| `spring.profiles.active` | `NODE_ACTIVE_PROFILES` |\n| `@Profile` | `conditionalOnProfile()` |\n| `JdbcTemplate` / `NamedParameterJdbcTemplate` | `JsdbcTemplate` / `NamedParameterJsdbcTemplate` |\n| `Flyway` integration | `@alt-javascript/boot-flyway` / `@alt-javascript/flyway` |\n| Spring MVC `@RestController` / `@RequestMapping` | `static __routes` metadata on controller classes |\n| Spring Security filter chain | `MiddlewarePipeline` — `static __middleware = { order: N }` |\n\nThe Spring Framework is copyright VMware, Inc. / Broadcom. `@alt-javascript` began as an independent re-implementation, \nand subsequent port and is not affiliated with, endorsed by, or associated with VMware, Broadcom, or the Spring team.\n\n\u003e Spring Framework and Spring Boot are trademarks of VMware, Inc. / Broadcom.\n\u003e This project is independent and not affiliated with VMware, Broadcom, or the Spring team.\n\n## Flyway Attribution\n\n\u003eThe design of `@alt-javascript/flyway` is directly influenced by the Java project. \n\u003e Flyway is a registered trademark of Boxfuse GmbH, which is owned by Red Gate Software.\n\u003e This project is independent and not affiliated with Boxfuse GmbH, Red Gate Software, or the Flyway team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt-javascript%2Fboot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falt-javascript%2Fboot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falt-javascript%2Fboot/lists"}