Create your first Inversify HTTP API
A running API is the fastest way to see what Inversify HTTP feels like. The scaffolded API already has controllers, request validation, OpenAPI docs, and a Postgres-backed todo list, so you can try a real project before you decide how to shape your own.
Start with one command
@inversifyjs/create-http asks for a package manager, an HTTP adapter, and an API style. It writes the project, installs the dependencies, and builds it.
npm create @inversifyjs/http@latest my-app
pnpm create @inversifyjs/http my-app
yarn create @inversifyjs/http my-app
The prompts accept npm, pnpm, or yarn, an adapter (express, fastify, hono, or uwebsockets), and an API style (code-first or schema-first). Pass --pm, --adapter, and --apiStyle when you already know the answers. Yarn projects use Yarn Berry, so run corepack enable once before the create command.
Run the sample
Todos live in PostgreSQL. Start the database from the generated docker-compose.yml, apply the migrations, and serve the API. Use the script names that match the package manager you picked (npm run, pnpm, or yarn).
cd my-app
docker compose up -d
npm run db:migrate
npm run serve
Then open:
- http://localhost:3000/docs for the OpenAPI UI
- http://localhost:3000/v1/status to check that the server is up
- http://localhost:3000/v1/todos for the todo API
The generated .env sets DEV_PROFILER_ENABLED=true. With that flag on, the same server records each call and serves HTTP Insights at http://localhost:3000/.inversify/http-insights-ui. Send a few requests from the docs UI and open a call to see the middleware, the validation pipe, and the controller on one timeline.
Where to go next
The getting started guide walks through the scaffold, then shows how to add the packages to a project you already have. Controllers are the next page after that.
Stuck on the generated project? Open an issue on GitHub or ask in Discord.
