TypeORM Init Generator
Generate a starter TypeORM data-source.ts with a ready PostgreSQL connection, in TypeScript. Copy the file and start using entities and migrations.
A TypeORM data source wired for Postgres
TypeORM makes you build a DataSource before a single entity does anything useful. That is where host, port, the synchronize flag and the entity and migration globs live, and getting any of them wrong produces connection errors that look like database trouble but are pure configuration. This page gives you a starter data-source.ts for Postgres that reads everything from environment variables.
The output is fixed and there is no form: one function returns the same text every time, already rendered when the page opens. Every field has a fallback, so DB_HOST becomes localhost, DB_PORT becomes 5432 and DB_NAME becomes app, and you can run locally with no .env at all. synchronize is false on purpose; with true, TypeORM rewrites your schema on every boot, which is fine for a sketch and dangerous in production.
Check three things after pasting. Your tsconfig needs experimentalDecorators and emitDecoratorMetadata or the entities will not compile. The globs point at src/entities/*.ts, so once tsc emits to dist you have to point them at dist/entities/*.js. And the data source never connects on its own: call AppDataSource.initialize() during bootstrap and handle the promise it returns. Generation happens entirely in your browser.
Frequently asked questions
Can it generate a MySQL or SQLite version?
Why are my entities not found in production?
Do I really need import 'reflect-metadata'?
Related Tools
Prisma Init Generator
Generate an initial schema.prisma.
Sequelize Init Generator
Generates the Sequelize ORM config/config.js with development, test and production environments, all on the postgres dialect. Copy it and adjust the credentials.
Drizzle Init Generator
Generates a drizzle.config.ts for the Drizzle ORM with the PostgreSQL dialect, ready for migrations. Copy the file and set up your type-safe schema.