This project is a practical exercise to learn how to use Prisma ORM with a PostgreSQL database in a TypeScript environment. It includes basic setup, database modeling, migrations, and CRUD operations.
- Learn how to set up and use Prisma with PostgreSQL
- Practice defining models and running migrations
- Write clean and type-safe database logic with TypeScript
- Language: TypeScript
- Database: PostgreSQL
- ORM: Prisma
- β Prisma setup with PostgreSQL connection
- β .env configuration for secure DB access
- β Schema modeling in schema.prisma
- β Migration and database initialization
- β Sample CRUD operations (Create, Read, Update, Delete)
- β Seed script to populate sample data
git clone https://github.com/your-username/prisma-postgresql-typescript-demo.git
cd prisma-postgresql-typescript-demo
2. Install dependencies
npm install
3. Setup your .env file
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
4. Run Prisma migrations
npx prisma migrate dev --name init
5. Generate Prisma client
npx prisma generate
6. Run the app
npm run dev
---
π Project Structure
/prisma β Prisma schema & migrations
/src
βββ index.ts β Entry point
βββ db.ts β Prisma client instance
βββ logic/ β CRUD logic
---
π Resources
Prisma Docs
PostgreSQL Tutorial
TypeScript Handbook
---
π License
MIT β Free to use and modify.
---