# TypeORM (/docs/prisma-postgres/quickstart/typeorm) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. Get started with TypeORM and Prisma Postgres by connecting your TypeScript ORM to a managed PostgreSQL database Location: Prisma Postgres > Quickstart > TypeORM [TypeORM](https://typeorm.io) is a TypeScript ORM. In this guide, you'll learn how to connect TypeORM to [Prisma Postgres](https://www.prisma.io/docs/postgres). ## Prerequisites [#prerequisites] * Node.js version 16 or higher * TypeScript version 4.5 or higher ## 1. Generate a TypeORM project [#1-generate-a-typeorm-project] Use the TypeORM CLI to generate a starter project: #### bun ```bash bunx typeorm init --name typeorm-quickstart --database postgres ``` #### pnpm ```bash pnpm dlx typeorm init --name typeorm-quickstart --database postgres ``` #### yarn ```bash yarn dlx typeorm init --name typeorm-quickstart --database postgres ``` #### npm ```bash npx typeorm init --name typeorm-quickstart --database postgres ``` This command will generate a new project with the following structure: ``` typeorm-quickstart ├── src │ ├── entity │ │ └── User.ts # Sample entity │ ├── migration # Migrations folder │ ├── data-source.ts # Data source configuration │ └── index.ts # Application entry point ├── .gitignore ├── package.json ├── README.md └── tsconfig.json ``` ## 2. Install dependencies [#2-install-dependencies] Navigate to the project directory and install dependencies: #### bun ```bash cd typeorm-quickstart bun install ``` #### pnpm ```bash cd typeorm-quickstart pnpm install ``` #### yarn ```bash cd typeorm-quickstart yarn install ``` #### npm ```bash cd typeorm-quickstart npm install ``` Install dotenv to load environment variables: #### bun ```bash bun add dotenv ``` #### pnpm ```bash pnpm add dotenv ``` #### yarn ```bash yarn add dotenv ``` #### npm ```bash npm install dotenv ``` ## 3. Create a Prisma Postgres database [#3-create-a-prisma-postgres-database] Create a Prisma Postgres database with the `create-db` CLI tool: #### bun ```bash bunx create-db ``` #### pnpm ```bash pnpm dlx create-db ``` #### yarn ```bash yarn dlx create-db ``` #### npm ```bash npx create-db ``` Then the CLI tool should output: ```bash ┌ 🚀 Creating a Prisma Postgres database │ │ Provisioning a temporary database in us-east-1... │ │ It will be automatically deleted in 24 hours, but you can claim it. │ ◇ Database created successfully! │ │ ● Database Connection │ │ │ Connection String: │ │ postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require │ │ ◆ Claim Your Database │ │ Keep your database for free: │ │ https://create-db.prisma.io/claim?CLAIM_CODE │ │ Database will be deleted on 11/18/2025, 1:55:39 AM if not claimed. │ └ ``` Create a `.env` file and add the connection string from the output: ```text title=".env" DATABASE_URL="postgresql://hostname:password@db.prisma.io:5432/postgres?sslmode=require" ``` > [!WARNING] > **Never commit `.env` files to version control.** Add `.env` to your `.gitignore` file to keep credentials secure. The database created is temporary and will be deleted in 24 hours unless claimed. Claiming moves the database into your [Prisma Data Platform](https://console.prisma.io/?utm_source=docs\&utm_medium=content\&utm_content=%28index%29) account. Visit the claim URL from the output to keep your database. > [!NOTE] > To learn more about the `create-db` CLI tool, see the [create-db documentation](https://www.prisma.io/docs/postgres/npx-create-db). ## 4. Configure database connection [#4-configure-database-connection] Update the `src/data-source.ts` file to use your Prisma Postgres connection: ```typescript title="src/data-source.ts" import "reflect-metadata"; import "dotenv/config"; // [!code ++] import { DataSource } from "typeorm"; import { User } from "./entity/User"; // Parse DATABASE_URL into connection parameters // [!code ++] function parseConnectionString(url: string) { // [!code ++] const parsed = new URL(url); // [!code ++] return { // [!code ++] host: parsed.hostname, // [!code ++] port: parseInt(parsed.port), // [!code ++] username: parsed.username, // [!code ++] password: parsed.password, // [!code ++] database: parsed.pathname.slice(1), // Remove leading '/' // [!code ++] }; // [!code ++] } // [!code ++] const connectionParams = parseConnectionString(process.env.DATABASE_URL!); // [!code ++] export const AppDataSource = new DataSource({ type: "postgres", host: "localhost", // [!code --] port: 5432, // [!code --] username: "test", // [!code --] password: "test", // [!code --] database: "test", // [!code --] ...connectionParams, // [!code ++] ssl: true, // [!code ++] synchronize: true, logging: false, entities: [User], migrations: [], subscribers: [], }); ``` ## 5. Run the application [#5-run-the-application] Start the application: #### bun ```bash bun start ``` #### pnpm ```bash pnpm start ``` #### yarn ```bash yarn start ``` #### npm ```bash npm start ``` You should see output indicating the connection was successful and a new user was inserted into the database: ```bash Inserting a new user into the database... Saved a new user with id: 1 Loading users from the database... Loaded users: [ User { id: 1, firstName: 'Timber', lastName: 'Saw', age: 25 } ] ``` ## Next steps [#next-steps] TypeORM is now connected to Prisma Postgres. For entities, migrations, and queries, see the [TypeORM documentation](https://typeorm.io/docs/getting-started). > [!NOTE] > Deploy to Compute > > To run this app in the cloud, deploy it to [Prisma Compute](https://www.prisma.io/docs/compute), which runs your app next to your Prisma Postgres database. Follow [Deploy your first app](https://www.prisma.io/docs/prisma-compute/deploy). ## Related pages - [`Drizzle ORM`](https://www.prisma.io/docs/prisma-postgres/quickstart/drizzle-orm): Get started with Drizzle ORM and Prisma Postgres - [`Kysely`](https://www.prisma.io/docs/prisma-postgres/quickstart/kysely): Get started with Kysely and Prisma Postgres by creating a type-safe SQL query builder for your database - [`Prisma ORM`](https://www.prisma.io/docs/prisma-postgres/quickstart/prisma-orm): Create a Prisma ORM app with Prisma Postgres.