You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d07ce67
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+187-8Lines changed: 187 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
13
13
Node.js Backend is a comprehensive, production-ready RESTful API built with Express.js, featuring JWT authentication, role-based access control, real-time activity logging, advanced security middleware, and comprehensive monitoring capabilities.
This project uses **Prisma ORM**, which provides exceptional database flexibility and support for multiple database systems. While the project is configured for **PostgreSQL** by default, Prisma allows you to easily switch between different databases without changing your application code.
72
+
73
+
#### Currently Configured Database
74
+
75
+
-**PostgreSQL 16+**: The default database for this project, providing robust relational database features, JSON support, and advanced querying capabilities.
76
+
77
+
#### Prisma Supported Databases
78
+
79
+
Prisma ORM supports **10+ database systems**, giving you the flexibility to choose the best database for your needs:
80
+
81
+
**Self-hosted Databases:**
82
+
- ✅ **PostgreSQL** (9.6 - 17) - Currently configured
83
+
- ✅ **MySQL** (5.6, 5.7, 8.0, 8.4)
84
+
- ✅ **MariaDB** (10.0+)
85
+
- ✅ **SQLite** (All versions)
86
+
- ✅ **Microsoft SQL Server** (2017, 2019, 2022)
87
+
- ✅ **MongoDB** (4.2+)
88
+
- ✅ **CockroachDB** (21.2.4+)
89
+
90
+
**Managed/Cloud Databases:**
91
+
- ✅ **AWS Aurora** (All versions)
92
+
- ✅ **AWS Aurora Serverless** (All versions)
93
+
- ✅ **Azure SQL** (All versions)
94
+
- ✅ **CockroachDB-as-a-Service** (All versions)
95
+
- ✅ **MongoDB Atlas** (All versions)
96
+
- ✅ **Neon Serverless Postgres** (All versions)
97
+
- ✅ **PlanetScale** (All versions)
98
+
- ✅ **Cloudflare D1** (Preview)
99
+
- ✅ **Aiven** (MySQL & Postgres)
100
+
101
+
#### Advantages of Using Prisma
102
+
103
+
1.**Database Agnostic**: Switch between databases by simply changing the `provider` in `schema.prisma`
104
+
2.**Type Safety**: Auto-generated TypeScript types based on your database schema
105
+
3.**Migration Management**: Built-in migration system for schema versioning
106
+
4.**Connection Pooling**: Automatic connection pool management for optimal performance
107
+
5.**Query Optimization**: Intelligent query builder that generates optimized SQL
108
+
6.**Developer Experience**: Intuitive API with excellent IDE autocomplete support
109
+
7.**Multi-Database Support**: Use different databases for different environments (e.g., SQLite for development, PostgreSQL for production)
110
+
111
+
#### Switching Databases
112
+
113
+
To switch to a different database, simply update the `datasource` provider in `api/prisma/schema.prisma`:
114
+
115
+
```prisma
116
+
// For PostgreSQL (current)
117
+
datasource db {
118
+
provider = "postgresql"
119
+
url = env("DATABASE_URL")
120
+
}
121
+
122
+
// For MySQL
123
+
datasource db {
124
+
provider = "mysql"
125
+
url = env("DATABASE_URL")
126
+
}
127
+
128
+
// For SQLite
129
+
datasource db {
130
+
provider = "sqlite"
131
+
url = "file:./dev.db"
132
+
}
133
+
134
+
// For MongoDB
135
+
datasource db {
136
+
provider = "mongodb"
137
+
url = env("DATABASE_URL")
138
+
}
139
+
```
140
+
141
+
Then run:
142
+
```bash
143
+
npm run prisma:generate # Regenerate Prisma Client
144
+
npm run db:push # Push schema to new database
145
+
```
146
+
147
+
**Note**: Some schema features may vary between databases. Refer to [Prisma Database Documentation](https://www.prisma.io/docs/orm/reference/supported-databases) for database-specific considerations.
0 commit comments